@dotobokuri/fleet-console 1.28.0 → 1.29.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/dist/cli.mjs +148 -345
- package/dist/client/assets/{_baseUniq-0TpVlb56.js → _baseUniq-DEvADUqz.js} +1 -1
- package/dist/client/assets/{arc-BIRhKPNZ.js → arc-pB9oYw5d.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-CJzkivmk.js → architectureDiagram-Q4EWVU46-D0gUBsh1.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-PkVBy6UB.js → blockDiagram-DXYQGD6D-9NSt9xrC.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-TOO0Zc07.js → c4Diagram-AHTNJAMY-BS1EhMAN.js} +1 -1
- package/dist/client/assets/channel-BSgCfWXO.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-Ugm2Ht26.js → chunk-4BX2VUAB-BKkeF7mF.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-Byfwafb_.js → chunk-4TB4RGXK-DRp3Dsap.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-2I_nwtuS.js → chunk-55IACEB6-De-sLT-H.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-JYP41aJo.js → chunk-EDXVE4YY-ByYWvw6c.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-Duh-U1jY.js → chunk-FMBD7UC4-BDpIWnNm.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-64cqkTOO.js → chunk-OYMX7WX6-qxbtvneQ.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-engflZJB.js → chunk-QZHKN3VN-BnkLN840.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-BwnK_1vX.js → chunk-YZCP3GAM-HfizEXdz.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-C3WhxxfZ.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-C3WhxxfZ.js +1 -0
- package/dist/client/assets/clone-DjOK69th.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-D43_BnnE.js → cose-bilkent-S5V4N54A-B4U_tiL9.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-Wh_p74YO.js → dagre-KV5264BT-De3dSv-R.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-BNcxA6wC.js → diagram-5BDNPKRD-CZAF0Kro.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-HQdA06kX.js → diagram-G4DWMVQ6-BHyDlHAq.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DlMdX_ng.js → diagram-MMDJMWI5-CV93x0hu.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-C1hKAjZD.js → diagram-TYMM5635-CTRzVEQp.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-CsSiuv9G.js → erDiagram-SMLLAGMA-xW-UvBlm.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-DfjQ3Ug9.js → flowDiagram-DWJPFMVM-C21IECUy.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B0QHKePg.js → ganttDiagram-T4ZO3ILL-DVzOf8Xv.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-_zejoqTH.js → gitGraphDiagram-UUTBAWPF-B-NQC3Ae.js} +1 -1
- package/dist/client/assets/{graph-Dr6IPcji.js → graph-BDzdWbuy.js} +1 -1
- package/dist/client/assets/index-BDJVPQd1.css +1 -0
- package/dist/client/assets/index-CjBu8lNT.js +451 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-dhruAwPt.js → infoDiagram-42DDH7IO-2KCXFMZg.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DPoZZiH0.js → ishikawaDiagram-UXIWVN3A-D4Fvy3ms.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-DQk8gmrd.js → journeyDiagram-VCZTEJTY-DkXZkeED.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-B9rOgVFq.js → kanban-definition-6JOO6SKY-CTrIp4rv.js} +1 -1
- package/dist/client/assets/{layout-D54BXsv2.js → layout-DKdT-A2u.js} +1 -1
- package/dist/client/assets/{linear-DJxG7kFF.js → linear-Dn21C3ab.js} +1 -1
- package/dist/client/assets/{mermaid.core-BBFWA-zA.js → mermaid.core-ho7gOyUr.js} +4 -4
- package/dist/client/assets/{min-Dv_aLAYb.js → min-DV-zxfLU.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-Dv5woCon.js → mindmap-definition-QFDTVHPH-By8nfvJ0.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B_V_vCG8.js → pieDiagram-DEJITSTG-B4ndzH1J.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-QHqq3tFD.js → quadrantDiagram-34T5L4WZ-CiDb6b3-.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-BhPhfMzK.js → requirementDiagram-MS252O5E-TTr1SzvX.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-D2-ZsaS_.js → sankeyDiagram-XADWPNL6-CUyxk-WA.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-Di0qgM3v.js → sequenceDiagram-FGHM5R23-CyBxBNAZ.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-BAuqrwY8.js → stateDiagram-FHFEXIEX-Cj4j5FFK.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CWhJmDZj.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-BcMGkC6T.js → timeline-definition-GMOUNBTQ-MQzKGbxg.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-C9dkwyKX.js → vennDiagram-DHZGUBPP-sG3K7NAZ.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-BLLCncPa.js → wardley-RL74JXVD-ID5rQjqH.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-Yb9mlL0_.js → wardleyDiagram-NUSXRM2D-AMajCCI5.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-BAHLdje7.js → xychartDiagram-5P7HB3ND-DUb36W9E.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/repository/routes.mjs +25 -100
- package/dist/fleet-plugins/skills/routes.mjs +51 -73
- package/dist/fleet-plugins/terminal/routes.mjs +364 -27
- package/package.json +1 -1
- package/dist/client/assets/channel-CqmujVSi.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DLXkYur6.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DLXkYur6.js +0 -1
- package/dist/client/assets/clone-KonJWRw9.js +0 -1
- package/dist/client/assets/index-CsmxZ8UQ.js +0 -453
- package/dist/client/assets/index-DC8tBAf_.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DhNebJyd.js +0 -1
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
function XE(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function zb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tee(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var t_={exports:{}},iu={};var zx;function o6(){if(zx)return iu;zx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var c=null;if(o!==void 0&&(c=""+o),r.key!==void 0&&(c=""+r.key),"key"in r){o={};for(var d in r)d!=="key"&&(o[d]=r[d])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:c,ref:r!==void 0?r:null,props:o}}return iu.Fragment=t,iu.jsx=n,iu.jsxs=n,iu}var Hx;function l6(){return Hx||(Hx=1,t_.exports=o6()),t_.exports}var u=l6();const c6=zb(u),u6=XE({__proto__:null,default:c6},[u]);var n_={exports:{}},st={};var Fx;function h6(){if(Fx)return st;Fx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function S(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function O(D,V,J){this.props=D,this.context=V,this.refs=C,this.updater=J||w}O.prototype.isReactComponent={},O.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,V,"setState")},O.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function P(){}P.prototype=O.prototype;function z(D,V,J){this.props=D,this.context=V,this.refs=C,this.updater=J||w}var T=z.prototype=new P;T.constructor=z,x(T,O.prototype),T.isPureReactComponent=!0;var j=Array.isArray;function M(){}var H={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function ee(D,V,J){var ce=J.ref;return{$$typeof:e,type:D,key:V,ref:ce!==void 0?ce:null,props:J}}function ae(D,V){return ee(D.type,V,D.props)}function K(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function B(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return V[J]})}var N=/\/+/g;function R(D,V){return typeof D=="object"&&D!==null&&D.key!=null?B(""+D.key):V.toString(36)}function A(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(M,M):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function E(D,V,J,ce,ie){var ve=typeof D;(ve==="undefined"||ve==="boolean")&&(D=null);var Se=!1;if(D===null)Se=!0;else switch(ve){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(D.$$typeof){case e:case t:Se=!0;break;case g:return Se=D._init,E(Se(D._payload),V,J,ce,ie)}}if(Se)return ie=ie(D),Se=ce===""?"."+R(D,0):ce,j(ie)?(J="",Se!=null&&(J=Se.replace(N,"$&/")+"/"),E(ie,V,J,"",function(ct){return ct})):ie!=null&&(K(ie)&&(ie=ae(ie,J+(ie.key==null||D&&D.key===ie.key?"":(""+ie.key).replace(N,"$&/")+"/")+Se)),V.push(ie)),1;Se=0;var Oe=ce===""?".":ce+":";if(j(D))for(var Ne=0;Ne<D.length;Ne++)ce=D[Ne],ve=Oe+R(ce,Ne),Se+=E(ce,V,J,ve,ie);else if(Ne=S(D),typeof Ne=="function")for(D=Ne.call(D),Ne=0;!(ce=D.next()).done;)ce=ce.value,ve=Oe+R(ce,Ne++),Se+=E(ce,V,J,ve,ie);else if(ve==="object"){if(typeof D.then=="function")return E(A(D),V,J,ce,ie);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Se}function L(D,V,J){if(D==null)return D;var ce=[],ie=0;return E(D,ce,"","",function(ve){return V.call(J,ve,ie++)}),ce}function $(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(J){(D._status===0||D._status===-1)&&(D._status=1,D._result=J)},function(J){(D._status===0||D._status===-1)&&(D._status=2,D._result=J)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var q=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},X={map:L,forEach:function(D,V,J){L(D,function(){V.apply(this,arguments)},J)},count:function(D){var V=0;return L(D,function(){V++}),V},toArray:function(D){return L(D,function(V){return V})||[]},only:function(D){if(!K(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return st.Activity=_,st.Children=X,st.Component=O,st.Fragment=n,st.Profiler=r,st.PureComponent=z,st.StrictMode=i,st.Suspense=p,st.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,st.__COMPILER_RUNTIME={__proto__:null,c:function(D){return H.H.useMemoCache(D)}},st.cache=function(D){return function(){return D.apply(null,arguments)}},st.cacheSignal=function(){return null},st.cloneElement=function(D,V,J){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ce=x({},D.props),ie=D.key;if(V!=null)for(ve in V.key!==void 0&&(ie=""+V.key),V)!F.call(V,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&V.ref===void 0||(ce[ve]=V[ve]);var ve=arguments.length-2;if(ve===1)ce.children=J;else if(1<ve){for(var Se=Array(ve),Oe=0;Oe<ve;Oe++)Se[Oe]=arguments[Oe+2];ce.children=Se}return ee(D.type,ie,ce)},st.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:o,_context:D},D},st.createElement=function(D,V,J){var ce,ie={},ve=null;if(V!=null)for(ce in V.key!==void 0&&(ve=""+V.key),V)F.call(V,ce)&&ce!=="key"&&ce!=="__self"&&ce!=="__source"&&(ie[ce]=V[ce]);var Se=arguments.length-2;if(Se===1)ie.children=J;else if(1<Se){for(var Oe=Array(Se),Ne=0;Ne<Se;Ne++)Oe[Ne]=arguments[Ne+2];ie.children=Oe}if(D&&D.defaultProps)for(ce in Se=D.defaultProps,Se)ie[ce]===void 0&&(ie[ce]=Se[ce]);return ee(D,ve,ie)},st.createRef=function(){return{current:null}},st.forwardRef=function(D){return{$$typeof:d,render:D}},st.isValidElement=K,st.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:$}},st.memo=function(D,V){return{$$typeof:f,type:D,compare:V===void 0?null:V}},st.startTransition=function(D){var V=H.T,J={};H.T=J;try{var ce=D(),ie=H.S;ie!==null&&ie(J,ce),typeof ce=="object"&&ce!==null&&typeof ce.then=="function"&&ce.then(M,q)}catch(ve){q(ve)}finally{V!==null&&J.types!==null&&(V.types=J.types),H.T=V}},st.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},st.use=function(D){return H.H.use(D)},st.useActionState=function(D,V,J){return H.H.useActionState(D,V,J)},st.useCallback=function(D,V){return H.H.useCallback(D,V)},st.useContext=function(D){return H.H.useContext(D)},st.useDebugValue=function(){},st.useDeferredValue=function(D,V){return H.H.useDeferredValue(D,V)},st.useEffect=function(D,V){return H.H.useEffect(D,V)},st.useEffectEvent=function(D){return H.H.useEffectEvent(D)},st.useId=function(){return H.H.useId()},st.useImperativeHandle=function(D,V,J){return H.H.useImperativeHandle(D,V,J)},st.useInsertionEffect=function(D,V){return H.H.useInsertionEffect(D,V)},st.useLayoutEffect=function(D,V){return H.H.useLayoutEffect(D,V)},st.useMemo=function(D,V){return H.H.useMemo(D,V)},st.useOptimistic=function(D,V){return H.H.useOptimistic(D,V)},st.useReducer=function(D,V,J){return H.H.useReducer(D,V,J)},st.useRef=function(D){return H.H.useRef(D)},st.useState=function(D){return H.H.useState(D)},st.useSyncExternalStore=function(D,V,J){return H.H.useSyncExternalStore(D,V,J)},st.useTransition=function(){return H.H.useTransition()},st.version="19.2.7",st}var Ux;function Hb(){return Ux||(Ux=1,n_.exports=h6()),n_.exports}var y=Hb();const d6=zb(y),Hf=XE({__proto__:null,default:d6},[y]),f6="fc-operation-body";let ki=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function ZE(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new ki(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(m6).filter(i=>i!==null):[]}function Ff(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)||JE(t))throw new ki(500,"Invalid operation response");return t}function JE(e){return Bv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function p6({children:e,className:t}){return u.jsx("div",{className:_6(f6,t),children:e})}function m6(e){if(!QE(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(g6).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function g6(e){return!QE(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 QE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Bv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Bv(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Bv(i,t))}function _6(...e){return e.filter(t=>!!t).join(" ")}const v6=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ki,OperationBody:p6,assertOperationNode:Ff,fetchOperationCatalog:ZE,hasForbiddenBrowserPayloadKey:JE},Symbol.toStringTag,{value:"Module"}));function y6(e){return e}function b6(e){return e}function e5(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(i_(n,i),r).then(E6),subscribe:(n,i,r)=>{const o=new EventSource(i_(n,i));o.onmessage=r;const c=()=>o.close();return t.add(c),()=>{c(),t.delete(c)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const c=await fetch(i_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!c.ok)throw new ki(c.status,`Terminal ticket request failed: ${c.status}`);const d=await c.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new ki(c.status,"Invalid terminal ticket response");return{ticket:d.ticket,ttlMs:d.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async n=>{const i=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new ki(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return Ff(r.operation)},rename:async(n,i)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw new ki(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Ff(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new ki(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>A6(n,i),write:(n,i)=>R6(n,i)},settings:{read:async n=>{const i=await fetch(Wx(n));if(!i.ok)throw new ki(i.status,`Plugin settings read failed: ${i.status}`);const o=(await i.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(n,i)=>{const r=await fetch(Wx(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new ki(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function t5(e,t){return y.useSyncExternalStore(e,t,t)}function S6(){const[e,t]=y.useState([]),n=y.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new ki(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(Ff):[])},[]);return y.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function w6(e,t){return y.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function x6(e,t){return y.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function C6(e,t,n){const[i,r]=y.useState(()=>e.read(t,n)),o=y.useCallback(c=>{r(c),e.write(t,c)},[e,t]);return[i,o]}function k6(e,t){return y.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function E6(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new ki(e.status,`Plugin request failed: ${e.status}`,t)}return e}function i_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new ki(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new ki(400,"Invalid plugin path");return`/plugins/${e}${n}`}const T6=/^[a-z0-9][a-z0-9._-]*$/;function Wx(e){if(!T6.test(e))throw new ki(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function A6(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(`fleet-plugin.${e}`);return n===null?t:JSON.parse(n)}catch{return t}}function R6(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const N6=Object.freeze(Object.defineProperty({__proto__:null,React:Hf,createClientCapabilities:e5,defineOperationKind:b6,definePlugin:y6,useOperationStatus:k6,useOperations:S6,usePluginApi:w6,usePluginSettings:x6,usePluginStorage:C6,useStoreSnapshot:t5},Symbol.toStringTag,{value:"Module"}));function L6(e){return e}function M6({title:e,description:t,children:n}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:n})]})}function O6({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:n})]})}function D6({checked:e,onChange:t,label:n,disabled:i=!1}){const r=y.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[u.jsx("input",{id:r,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?u.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function j6({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=y.useId(),c=u.jsx("select",{id:o,className:"fc-settings-select__control",value:e,disabled:r,"aria-label":i?void 0:"Select setting",onChange:d=>n(d.currentTarget.value),children:t.map(d=>u.jsx("option",{value:d.value,children:d.label},d.value))});return i?u.jsxs("label",{className:"fc-settings-select",htmlFor:o,children:[u.jsx("span",{className:"fc-settings-select__label",children:i}),c]}):u.jsx("div",{className:"fc-settings-select",children:c})}function I6({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:n})]})}const B6=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:M6,SettingsField:I6,SettingsRow:O6,SettingsSelect:j6,SettingsToggle:D6,defineSettingsSection:L6},Symbol.toStringTag,{value:"Module"}));function P6(e){return e}const $6=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:P6},Symbol.toStringTag,{value:"Module"})),z6=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Uf extends y.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??z6:this.props.children}}const H6=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Uf,React:Hf,default:Hf},Symbol.toStringTag,{value:"Module"}));var s_={exports:{}},su={},r_={exports:{}},a_={};var qx;function F6(){return qx||(qx=1,(function(e){function t(E,L){var $=E.length;E.push(L);e:for(;0<$;){var q=$-1>>>1,X=E[q];if(0<r(X,L))E[q]=L,E[$]=X,$=q;else break e}}function n(E){return E.length===0?null:E[0]}function i(E){if(E.length===0)return null;var L=E[0],$=E.pop();if($!==L){E[0]=$;e:for(var q=0,X=E.length,D=X>>>1;q<D;){var V=2*(q+1)-1,J=E[V],ce=V+1,ie=E[ce];if(0>r(J,$))ce<X&&0>r(ie,J)?(E[q]=ie,E[ce]=$,q=ce):(E[q]=J,E[V]=$,q=V);else if(ce<X&&0>r(ie,$))E[q]=ie,E[ce]=$,q=ce;else break e}}return L}function r(E,L){var $=E.sortIndex-L.sortIndex;return $!==0?$:E.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],f=[],g=1,_=null,b=3,S=!1,w=!1,x=!1,C=!1,O=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function T(E){for(var L=n(f);L!==null;){if(L.callback===null)i(f);else if(L.startTime<=E)i(f),L.sortIndex=L.expirationTime,t(p,L);else break;L=n(f)}}function j(E){if(x=!1,T(E),!w)if(n(p)!==null)w=!0,M||(M=!0,B());else{var L=n(f);L!==null&&A(j,L.startTime-E)}}var M=!1,H=-1,F=5,ee=-1;function ae(){return C?!0:!(e.unstable_now()-ee<F)}function K(){if(C=!1,M){var E=e.unstable_now();ee=E;var L=!0;try{e:{w=!1,x&&(x=!1,P(H),H=-1),S=!0;var $=b;try{t:{for(T(E),_=n(p);_!==null&&!(_.expirationTime>E&&ae());){var q=_.callback;if(typeof q=="function"){_.callback=null,b=_.priorityLevel;var X=q(_.expirationTime<=E);if(E=e.unstable_now(),typeof X=="function"){_.callback=X,T(E),L=!0;break t}_===n(p)&&i(p),T(E)}else i(p);_=n(p)}if(_!==null)L=!0;else{var D=n(f);D!==null&&A(j,D.startTime-E),L=!1}}break e}finally{_=null,b=$,S=!1}L=void 0}}finally{L?B():M=!1}}}var B;if(typeof z=="function")B=function(){z(K)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,R=N.port2;N.port1.onmessage=K,B=function(){R.postMessage(null)}}else B=function(){O(K,0)};function A(E,L){H=O(function(){E(e.unstable_now())},L)}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(E){E.callback=null},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(E){switch(b){case 1:case 2:case 3:var L=3;break;default:L=b}var $=b;b=L;try{return E()}finally{b=$}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(E,L){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var $=b;b=E;try{return L()}finally{b=$}},e.unstable_scheduleCallback=function(E,L,$){var q=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?q+$:q):$=q,E){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=$+X,E={id:g++,callback:L,priorityLevel:E,startTime:$,expirationTime:X,sortIndex:-1},$>q?(E.sortIndex=$,t(f,E),n(p)===null&&E===n(f)&&(x?(P(H),H=-1):x=!0,A(j,$-q))):(E.sortIndex=X,t(p,E),w||S||(w=!0,M||(M=!0,B()))),E},e.unstable_shouldYield=ae,e.unstable_wrapCallback=function(E){var L=b;return function(){var $=b;b=L;try{return E.apply(this,arguments)}finally{b=$}}}})(a_)),a_}var Gx;function U6(){return Gx||(Gx=1,r_.exports=F6()),r_.exports}var o_={exports:{}},xi={};var Kx;function W6(){if(Kx)return xi;Kx=1;var e=Hb();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(p,f,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:_==null?null:""+_,children:p,containerInfo:f,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return xi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,xi.createPortal=function(p,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(p,f,null,g)},xi.flushSync=function(p){var f=c.T,g=i.p;try{if(c.T=null,i.p=2,p)return p()}finally{c.T=f,i.p=g,i.d.f()}},xi.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(p,f))},xi.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},xi.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var g=f.as,_=d(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:S}):g==="script"&&i.d.X(p,{crossOrigin:_,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},xi.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=d(f.as,f.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(p)},xi.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,_=d(g,f.crossOrigin);i.d.L(p,g,{crossOrigin:_,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},xi.preloadModule=function(p,f){if(typeof p=="string")if(f){var g=d(f.as,f.crossOrigin);i.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(p)},xi.requestFormReset=function(p){i.d.r(p)},xi.unstable_batchedUpdates=function(p,f){return p(f)},xi.useFormState=function(p,f,g){return c.H.useFormState(p,f,g)},xi.useFormStatus=function(){return c.H.useHostTransitionStatus()},xi.version="19.2.7",xi}var Vx;function n5(){if(Vx)return o_.exports;Vx=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(),o_.exports=W6(),o_.exports}var Yx;function q6(){if(Yx)return su;Yx=1;var e=U6(),t=Hb(),n=n5();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function c(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function p(s){if(o(s)!==s)throw Error(i(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var l=s,h=a;;){var m=l.return;if(m===null)break;var v=m.alternate;if(v===null){if(h=m.return,h!==null){l=h;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===l)return p(m),s;if(v===h)return p(m),a;v=v.sibling}throw Error(i(188))}if(l.return!==h.return)l=m,h=v;else{for(var k=!1,I=m.child;I;){if(I===l){k=!0,l=m,h=v;break}if(I===h){k=!0,h=m,l=v;break}I=I.sibling}if(!k){for(I=v.child;I;){if(I===l){k=!0,l=v,h=m;break}if(I===h){k=!0,h=v,l=m;break}I=I.sibling}if(!k)throw Error(i(189))}}if(l.alternate!==h)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),z=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function B(s){return s===null||typeof s!="object"?null:(s=K&&s[K]||s["@@iterator"],typeof s=="function"?s:null)}var N=Symbol.for("react.client.reference");function R(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===N?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case O:return"Profiler";case C:return"StrictMode";case j:return"Suspense";case M:return"SuspenseList";case ee:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case z:return s.displayName||"Context";case P:return(s._context.displayName||"Context")+".Consumer";case T:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case H:return a=s.displayName||null,a!==null?a:R(s.type)||"Memo";case F:a=s._payload,s=s._init;try{return R(s(a))}catch{}}return null}var A=Array.isArray,E=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},q=[],X=-1;function D(s){return{current:s}}function V(s){0>X||(s.current=q[X],q[X]=null,X--)}function J(s,a){X++,q[X]=s.current,s.current=a}var ce=D(null),ie=D(null),ve=D(null),Se=D(null);function Oe(s,a){switch(J(ve,a),J(ie,s),J(ce,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?cx(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=cx(a),s=ux(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}V(ce),J(ce,s)}function Ne(){V(ce),V(ie),V(ve)}function ct(s){s.memoizedState!==null&&J(Se,s);var a=ce.current,l=ux(a,s.type);a!==l&&(J(ie,s),J(ce,l))}function Ze(s){ie.current===s&&(V(ce),V(ie)),Se.current===s&&(V(Se),Qc._currentValue=$)}var Re,xe;function ze(s){if(Re===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",xe=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Re+s+xe}var le=!1;function We(s,a){if(!s||le)return"";le=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(oe){var se=oe}Reflect.construct(s,[],ge)}else{try{ge.call()}catch(oe){se=oe}s.call(ge.prototype)}}else{try{throw Error()}catch(oe){se=oe}(ge=s())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=h.DetermineComponentFrameRoot(),k=v[0],I=v[1];if(k&&I){var G=k.split(`
|
|
4
|
-
`),ne=I.split(`
|
|
5
|
-
`);for(m=h=0;h<G.length&&!G[h].includes("DetermineComponentFrameRoot");)h++;for(;m<ne.length&&!ne[m].includes("DetermineComponentFrameRoot");)m++;if(h===G.length||m===ne.length)for(h=G.length-1,m=ne.length-1;1<=h&&0<=m&&G[h]!==ne[m];)m--;for(;1<=h&&0<=m;h--,m--)if(G[h]!==ne[m]){if(h!==1||m!==1)do if(h--,m--,0>m||G[h]!==ne[m]){var he=`
|
|
6
|
-
`+G[h].replace(" at new "," at ");return s.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",s.displayName)),he}while(1<=h&&0<=m);break}}}finally{le=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?ze(l):""}function Le(s,a){switch(s.tag){case 26:case 27:case 5:return ze(s.type);case 16:return ze("Lazy");case 13:return s.child!==a&&a!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return We(s.type,!1);case 11:return We(s.type.render,!1);case 1:return We(s.type,!0);case 31:return ze("Activity");default:return""}}function it(s){try{var a="",l=null;do a+=Le(s,l),l=s,s=s.return;while(s);return a}catch(h){return`
|
|
7
|
-
Error generating stack: `+h.message+`
|
|
8
|
-
`+h.stack}}var bt=Object.prototype.hasOwnProperty,je=e.unstable_scheduleCallback,dt=e.unstable_cancelCallback,we=e.unstable_shouldYield,$e=e.unstable_requestPaint,ft=e.unstable_now,Ti=e.unstable_getCurrentPriorityLevel,An=e.unstable_ImmediatePriority,re=e.unstable_UserBlockingPriority,de=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,Te=e.unstable_IdlePriority,St=e.log,Wn=e.unstable_setDisableYieldValue,Xn=null,yt=null;function Rt(s){if(typeof St=="function"&&Wn(s),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Xn,s)}catch{}}var Pt=Math.clz32?Math.clz32:yi,_s=Math.log,yn=Math.LN2;function yi(s){return s>>>=0,s===0?32:31-(_s(s)/yn|0)|0}var Rn=256,vs=262144,$s=4194304;function qt(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function W(s,a,l){var h=s.pendingLanes;if(h===0)return 0;var m=0,v=s.suspendedLanes,k=s.pingedLanes;s=s.warmLanes;var I=h&134217727;return I!==0?(h=I&~v,h!==0?m=qt(h):(k&=I,k!==0?m=qt(k):l||(l=I&~s,l!==0&&(m=qt(l))))):(I=h&~v,I!==0?m=qt(I):k!==0?m=qt(k):l||(l=h&~s,l!==0&&(m=qt(l)))),m===0?0:a!==0&&a!==m&&(a&v)===0&&(v=m&-m,l=a&-a,v>=l||v===32&&(l&4194048)!==0)?a:m}function fe(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function be(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var s=$s;return $s<<=1,($s&62914560)===0&&($s=4194304),s}function $t(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function Nt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Be(s,a,l,h,m,v){var k=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var I=s.entanglements,G=s.expirationTimes,ne=s.hiddenUpdates;for(l=k&~l;0<l;){var he=31-Pt(l),ge=1<<he;I[he]=0,G[he]=-1;var se=ne[he];if(se!==null)for(ne[he]=null,he=0;he<se.length;he++){var oe=se[he];oe!==null&&(oe.lane&=-536870913)}l&=~ge}h!==0&&Me(s,h,0),v!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=v&~(k&~a))}function Me(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-Pt(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|l&261930}function Ye(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var h=31-Pt(l),m=1<<h;m&a|s[h]&a&&(s[h]|=a),l&=~m}}function Jt(s,a){var l=a&-a;return l=(l&42)!==0?1:pt(l),(l&(s.suspendedLanes|a))!==0?0:l}function pt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function On(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function pe(){var s=L.p;return s!==0?s:(s=window.event,s===void 0?32:Ox(s.type))}function Ct(s,a){var l=L.p;try{return L.p=s,a()}finally{L.p=l}}var Lt=Math.random().toString(36).slice(2),Xe="__reactFiber$"+Lt,Ce="__reactProps$"+Lt,zt="__reactContainer$"+Lt,Gt="__reactEvents$"+Lt,li="__reactListeners$"+Lt,bi="__reactHandles$"+Lt,Qi="__reactResources$"+Lt,Si="__reactMarker$"+Lt;function He(s){delete s[Xe],delete s[Ce],delete s[Gt],delete s[li],delete s[bi]}function U(s){var a=s[Xe];if(a)return a;for(var l=s.parentNode;l;){if(a=l[zt]||l[Xe]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=_x(s);s!==null;){if(l=s[Xe])return l;s=_x(s)}return a}s=l,l=s.parentNode}return null}function ue(s){if(s=s[Xe]||s[zt]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Ae(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function rt(s){var a=s[Qi];return a||(a=s[Qi]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ot(s){s[Si]=!0}var Ht=new Set,un={};function hn(s,a){ye(s,a),ye(s+"Capture",a)}function ye(s,a){for(un[s]=a,s=0;s<a.length;s++)Ht.add(a[s])}var qe=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]*$"),Ge={},Mt={};function dn(s){return bt.call(Mt,s)?!0:bt.call(Ge,s)?!1:qe.test(s)?Mt[s]=!0:(Ge[s]=!0,!1)}function wi(s,a,l){if(dn(a))if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+l)}}function es(s,a,l){if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+l)}}function $i(s,a,l,h){if(h===null)s.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(a,l,""+h)}}function en(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ts(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ah(s,a,l){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,v=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return m.call(this)},set:function(k){l=""+k,v.call(this,k)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return l},setValue:function(k){l=""+k},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Uo(s){if(!s._valueTracker){var a=ts(s)?"checked":"value";s._valueTracker=Ah(s,a,""+s[a])}}function dc(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return s&&(h=ts(s)?s.checked?"true":"false":s.value),s=h,s!==l?(a.setValue(s),!0):!1}function Wo(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var em=/[\n"\\]/g;function zi(s){return s.replace(em,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function fc(s,a,l,h,m,v,k,I){s.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.type=k:s.removeAttribute("type"),a!=null?k==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+en(a)):s.value!==""+en(a)&&(s.value=""+en(a)):k!=="submit"&&k!=="reset"||s.removeAttribute("value"),a!=null?qo(s,k,en(a)):l!=null?qo(s,k,en(l)):h!=null&&s.removeAttribute("value"),m==null&&v!=null&&(s.defaultChecked=!!v),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+en(I):s.removeAttribute("name")}function Ja(s,a,l,h,m,v,k,I){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),a!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){Uo(s);return}l=l!=null?""+en(l):"",a=a!=null?""+en(a):l,I||a===s.value||(s.value=a),s.defaultValue=a}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=I?s.checked:!!h,s.defaultChecked=!!h,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.name=k),Uo(s)}function qo(s,a,l){a==="number"&&Wo(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function ci(s,a,l,h){if(s=s.options,a){a={};for(var m=0;m<l.length;m++)a["$"+l[m]]=!0;for(l=0;l<s.length;l++)m=a.hasOwnProperty("$"+s[l].value),s[l].selected!==m&&(s[l].selected=m),m&&h&&(s[l].defaultSelected=!0)}else{for(l=""+en(l),a=null,m=0;m<s.length;m++){if(s[m].value===l){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}a!==null||s[m].disabled||(a=s[m])}a!==null&&(a.selected=!0)}}function Rh(s,a,l){if(a!=null&&(a=""+en(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+en(l):""}function Go(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(A(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=en(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),Uo(s)}function et(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Nh=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 Dn(s,a,l){var h=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?h?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":h?s.setProperty(a,l):typeof l!="number"||l===0||Nh.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Ft(s,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,l!=null){for(var h in l)!l.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in a)h=a[m],a.hasOwnProperty(m)&&l[m]!==h&&Dn(s,m,h)}else for(var v in a)a.hasOwnProperty(v)&&Dn(s,v,a[v])}function ea(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vr=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"]]),pc=/^[\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 ta(s){return pc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ee(){}var Fe=null;function at(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var kt=null,gn=null;function ys(s){var a=ue(s);if(a&&(s=a.stateNode)){var l=s[Ce]||null;e:switch(s=a.stateNode,a.type){case"input":if(fc(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+zi(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==s&&h.form===s.form){var m=h[Ce]||null;if(!m)throw Error(i(90));fc(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<l.length;a++)h=l[a],h.form===s.form&&dc(h)}break e;case"textarea":Rh(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&ci(s,!!l.multiple,a,!1)}}}var mc=!1;function Lh(s,a,l){if(mc)return s(a,l);mc=!0;try{var h=s(a);return h}finally{if(mc=!1,(kt!==null||gn!==null)&&(vd(),kt&&(a=kt,s=gn,gn=kt=null,ys(a),s)))for(a=0;a<s.length;a++)ys(s[a])}}function gc(s,a){var l=s.stateNode;if(l===null)return null;var h=l[Ce]||null;if(h===null)return null;l=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var yr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tm=!1;if(yr)try{var _c={};Object.defineProperty(_c,"passive",{get:function(){tm=!0}}),window.addEventListener("test",_c,_c),window.removeEventListener("test",_c,_c)}catch{tm=!1}var na=null,nm=null,Mh=null;function u1(){if(Mh)return Mh;var s,a=nm,l=a.length,h,m="value"in na?na.value:na.textContent,v=m.length;for(s=0;s<l&&a[s]===m[s];s++);var k=l-s;for(h=1;h<=k&&a[l-h]===m[v-h];h++);return Mh=m.slice(s,1<h?1-h:void 0)}function Oh(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Dh(){return!0}function h1(){return!1}function Hi(s){function a(l,h,m,v,k){this._reactName=l,this._targetInst=m,this.type=h,this.nativeEvent=v,this.target=k,this.currentTarget=null;for(var I in s)s.hasOwnProperty(I)&&(l=s[I],this[I]=l?l(v):v[I]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Dh:h1,this.isPropagationStopped=h1,this}return _(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Dh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Dh)},persist:function(){},isPersistent:Dh}),a}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jh=Hi(Qa),vc=_({},Qa,{view:0,detail:0}),rM=Hi(vc),im,sm,yc,Ih=_({},vc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:am,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==yc&&(yc&&s.type==="mousemove"?(im=s.screenX-yc.screenX,sm=s.screenY-yc.screenY):sm=im=0,yc=s),im)},movementY:function(s){return"movementY"in s?s.movementY:sm}}),d1=Hi(Ih),aM=_({},Ih,{dataTransfer:0}),oM=Hi(aM),lM=_({},vc,{relatedTarget:0}),rm=Hi(lM),cM=_({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),uM=Hi(cM),hM=_({},Qa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),dM=Hi(hM),fM=_({},Qa,{data:0}),f1=Hi(fM),pM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mM={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"},gM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _M(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=gM[s])?!!a[s]:!1}function am(){return _M}var vM=_({},vc,{key:function(s){if(s.key){var a=pM[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Oh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?mM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:am,charCode:function(s){return s.type==="keypress"?Oh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Oh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),yM=Hi(vM),bM=_({},Ih,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),p1=Hi(bM),SM=_({},vc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:am}),wM=Hi(SM),xM=_({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),CM=Hi(xM),kM=_({},Ih,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),EM=Hi(kM),TM=_({},Qa,{newState:0,oldState:0}),AM=Hi(TM),RM=[9,13,27,32],om=yr&&"CompositionEvent"in window,bc=null;yr&&"documentMode"in document&&(bc=document.documentMode);var NM=yr&&"TextEvent"in window&&!bc,m1=yr&&(!om||bc&&8<bc&&11>=bc),g1=" ",_1=!1;function v1(s,a){switch(s){case"keyup":return RM.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ko=!1;function LM(s,a){switch(s){case"compositionend":return y1(a);case"keypress":return a.which!==32?null:(_1=!0,g1);case"textInput":return s=a.data,s===g1&&_1?null:s;default:return null}}function MM(s,a){if(Ko)return s==="compositionend"||!om&&v1(s,a)?(s=u1(),Mh=nm=na=null,Ko=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return m1&&a.locale!=="ko"?null:a.data;default:return null}}var OM={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 b1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!OM[s.type]:a==="textarea"}function S1(s,a,l,h){kt?gn?gn.push(h):gn=[h]:kt=h,a=kd(a,"onChange"),0<a.length&&(l=new jh("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var Sc=null,wc=null;function DM(s){ix(s,0)}function Bh(s){var a=Ae(s);if(dc(a))return s}function w1(s,a){if(s==="change")return a}var x1=!1;if(yr){var lm;if(yr){var cm="oninput"in document;if(!cm){var C1=document.createElement("div");C1.setAttribute("oninput","return;"),cm=typeof C1.oninput=="function"}lm=cm}else lm=!1;x1=lm&&(!document.documentMode||9<document.documentMode)}function k1(){Sc&&(Sc.detachEvent("onpropertychange",E1),wc=Sc=null)}function E1(s){if(s.propertyName==="value"&&Bh(wc)){var a=[];S1(a,wc,s,at(s)),Lh(DM,a)}}function jM(s,a,l){s==="focusin"?(k1(),Sc=a,wc=l,Sc.attachEvent("onpropertychange",E1)):s==="focusout"&&k1()}function IM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Bh(wc)}function BM(s,a){if(s==="click")return Bh(a)}function PM(s,a){if(s==="input"||s==="change")return Bh(a)}function $M(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ns=typeof Object.is=="function"?Object.is:$M;function xc(s,a){if(ns(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),h=Object.keys(a);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var m=l[h];if(!bt.call(a,m)||!ns(s[m],a[m]))return!1}return!0}function T1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function A1(s,a){var l=T1(s);s=0;for(var h;l;){if(l.nodeType===3){if(h=s+l.textContent.length,s<=a&&h>=a)return{node:l,offset:a-s};s=h}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=T1(l)}}function R1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?R1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function N1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Wo(s.document);a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=Wo(s.document)}return a}function um(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var zM=yr&&"documentMode"in document&&11>=document.documentMode,Vo=null,hm=null,Cc=null,dm=!1;function L1(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;dm||Vo==null||Vo!==Wo(h)||(h=Vo,"selectionStart"in h&&um(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Cc&&xc(Cc,h)||(Cc=h,h=kd(hm,"onSelect"),0<h.length&&(a=new jh("onSelect","select",null,a,l),s.push({event:a,listeners:h}),a.target=Vo)))}function eo(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var Yo={animationend:eo("Animation","AnimationEnd"),animationiteration:eo("Animation","AnimationIteration"),animationstart:eo("Animation","AnimationStart"),transitionrun:eo("Transition","TransitionRun"),transitionstart:eo("Transition","TransitionStart"),transitioncancel:eo("Transition","TransitionCancel"),transitionend:eo("Transition","TransitionEnd")},fm={},M1={};yr&&(M1=document.createElement("div").style,"AnimationEvent"in window||(delete Yo.animationend.animation,delete Yo.animationiteration.animation,delete Yo.animationstart.animation),"TransitionEvent"in window||delete Yo.transitionend.transition);function to(s){if(fm[s])return fm[s];if(!Yo[s])return s;var a=Yo[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in M1)return fm[s]=a[l];return s}var O1=to("animationend"),D1=to("animationiteration"),j1=to("animationstart"),HM=to("transitionrun"),FM=to("transitionstart"),UM=to("transitioncancel"),I1=to("transitionend"),B1=new Map,pm="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(" ");pm.push("scrollEnd");function zs(s,a){B1.set(s,a),hn(a,[s])}var Ph=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},bs=[],Xo=0,mm=0;function $h(){for(var s=Xo,a=mm=Xo=0;a<s;){var l=bs[a];bs[a++]=null;var h=bs[a];bs[a++]=null;var m=bs[a];bs[a++]=null;var v=bs[a];if(bs[a++]=null,h!==null&&m!==null){var k=h.pending;k===null?m.next=m:(m.next=k.next,k.next=m),h.pending=m}v!==0&&P1(l,m,v)}}function zh(s,a,l,h){bs[Xo++]=s,bs[Xo++]=a,bs[Xo++]=l,bs[Xo++]=h,mm|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function gm(s,a,l,h){return zh(s,a,l,h),Hh(s)}function no(s,a){return zh(s,null,null,a),Hh(s)}function P1(s,a,l){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l);for(var m=!1,v=s.return;v!==null;)v.childLanes|=l,h=v.alternate,h!==null&&(h.childLanes|=l),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(m=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,m&&a!==null&&(m=31-Pt(l),s=v.hiddenUpdates,h=s[m],h===null?s[m]=[a]:h.push(a),a.lane=l|536870912),v):null}function Hh(s){if(50<Gc)throw Gc=0,kg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var Zo={};function WM(s,a,l,h){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function is(s,a,l,h){return new WM(s,a,l,h)}function _m(s){return s=s.prototype,!(!s||!s.isReactComponent)}function br(s,a){var l=s.alternate;return l===null?(l=is(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function $1(s,a){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,a=l.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Fh(s,a,l,h,m,v){var k=0;if(h=s,typeof s=="function")_m(s)&&(k=1);else if(typeof s=="string")k=Y3(s,l,ce.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case ee:return s=is(31,l,a,m),s.elementType=ee,s.lanes=v,s;case x:return io(l.children,m,v,a);case C:k=8,m|=24;break;case O:return s=is(12,l,a,m|2),s.elementType=O,s.lanes=v,s;case j:return s=is(13,l,a,m),s.elementType=j,s.lanes=v,s;case M:return s=is(19,l,a,m),s.elementType=M,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case z:k=10;break e;case P:k=9;break e;case T:k=11;break e;case H:k=14;break e;case F:k=16,h=null;break e}k=29,l=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=is(k,l,a,m),a.elementType=s,a.type=h,a.lanes=v,a}function io(s,a,l,h){return s=is(7,s,h,a),s.lanes=l,s}function vm(s,a,l){return s=is(6,s,null,a),s.lanes=l,s}function z1(s){var a=is(18,null,null,0);return a.stateNode=s,a}function ym(s,a,l){return a=is(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var H1=new WeakMap;function Ss(s,a){if(typeof s=="object"&&s!==null){var l=H1.get(s);return l!==void 0?l:(a={value:s,source:a,stack:it(a)},H1.set(s,a),a)}return{value:s,source:a,stack:it(a)}}var Jo=[],Qo=0,Uh=null,kc=0,ws=[],xs=0,ia=null,Js=1,Qs="";function Sr(s,a){Jo[Qo++]=kc,Jo[Qo++]=Uh,Uh=s,kc=a}function F1(s,a,l){ws[xs++]=Js,ws[xs++]=Qs,ws[xs++]=ia,ia=s;var h=Js;s=Qs;var m=32-Pt(h)-1;h&=~(1<<m),l+=1;var v=32-Pt(a)+m;if(30<v){var k=m-m%5;v=(h&(1<<k)-1).toString(32),h>>=k,m-=k,Js=1<<32-Pt(a)+m|l<<m|h,Qs=v+s}else Js=1<<v|l<<m|h,Qs=s}function bm(s){s.return!==null&&(Sr(s,1),F1(s,1,0))}function Sm(s){for(;s===Uh;)Uh=Jo[--Qo],Jo[Qo]=null,kc=Jo[--Qo],Jo[Qo]=null;for(;s===ia;)ia=ws[--xs],ws[xs]=null,Qs=ws[--xs],ws[xs]=null,Js=ws[--xs],ws[xs]=null}function U1(s,a){ws[xs++]=Js,ws[xs++]=Qs,ws[xs++]=ia,Js=a.id,Qs=a.overflow,ia=s}var ui=null,nn=null,At=!1,sa=null,Cs=!1,wm=Error(i(519));function ra(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ec(Ss(a,s)),wm}function W1(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[Xe]=s,a[Ce]=h,l){case"dialog":xt("cancel",a),xt("close",a);break;case"iframe":case"object":case"embed":xt("load",a);break;case"video":case"audio":for(l=0;l<Vc.length;l++)xt(Vc[l],a);break;case"source":xt("error",a);break;case"img":case"image":case"link":xt("error",a),xt("load",a);break;case"details":xt("toggle",a);break;case"input":xt("invalid",a),Ja(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":xt("invalid",a);break;case"textarea":xt("invalid",a),Go(a,h.value,h.defaultValue,h.children)}l=h.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||h.suppressHydrationWarning===!0||ox(a.textContent,l)?(h.popover!=null&&(xt("beforetoggle",a),xt("toggle",a)),h.onScroll!=null&&xt("scroll",a),h.onScrollEnd!=null&&xt("scrollend",a),h.onClick!=null&&(a.onclick=Ee),a=!0):a=!1,a||ra(s,!0)}function q1(s){for(ui=s.return;ui;)switch(ui.tag){case 5:case 31:case 13:Cs=!1;return;case 27:case 3:Cs=!0;return;default:ui=ui.return}}function el(s){if(s!==ui)return!1;if(!At)return q1(s),At=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||zg(s.type,s.memoizedProps)),l=!l),l&&nn&&ra(s),q1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));nn=gx(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));nn=gx(s)}else a===27?(a=nn,ya(s.type)?(s=qg,qg=null,nn=s):nn=a):nn=ui?Es(s.stateNode.nextSibling):null;return!0}function so(){nn=ui=null,At=!1}function xm(){var s=sa;return s!==null&&(qi===null?qi=s:qi.push.apply(qi,s),sa=null),s}function Ec(s){sa===null?sa=[s]:sa.push(s)}var Cm=D(null),ro=null,wr=null;function aa(s,a,l){J(Cm,a._currentValue),a._currentValue=l}function xr(s){s._currentValue=Cm.current,V(Cm)}function km(s,a,l){for(;s!==null;){var h=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),s===l)break;s=s.return}}function Em(s,a,l,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var v=m.dependencies;if(v!==null){var k=m.child;v=v.firstContext;e:for(;v!==null;){var I=v;v=m;for(var G=0;G<a.length;G++)if(I.context===a[G]){v.lanes|=l,I=v.alternate,I!==null&&(I.lanes|=l),km(v.return,l,s),h||(k=null);break e}v=I.next}}else if(m.tag===18){if(k=m.return,k===null)throw Error(i(341));k.lanes|=l,v=k.alternate,v!==null&&(v.lanes|=l),km(k,l,s),k=null}else k=m.child;if(k!==null)k.return=m;else for(k=m;k!==null;){if(k===s){k=null;break}if(m=k.sibling,m!==null){m.return=k.return,k=m;break}k=k.return}m=k}}function tl(s,a,l,h){s=null;for(var m=a,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var k=m.alternate;if(k===null)throw Error(i(387));if(k=k.memoizedProps,k!==null){var I=m.type;ns(m.pendingProps.value,k.value)||(s!==null?s.push(I):s=[I])}}else if(m===Se.current){if(k=m.alternate,k===null)throw Error(i(387));k.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Qc):s=[Qc])}m=m.return}s!==null&&Em(a,s,l,h),a.flags|=262144}function Wh(s){for(s=s.firstContext;s!==null;){if(!ns(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ao(s){ro=s,wr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function hi(s){return G1(ro,s)}function qh(s,a){return ro===null&&ao(s),G1(s,a)}function G1(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},wr===null){if(s===null)throw Error(i(308));wr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else wr=wr.next=a;return l}var qM=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(l,h){s.push(h)}};this.abort=function(){a.aborted=!0,s.forEach(function(l){return l()})}},GM=e.unstable_scheduleCallback,KM=e.unstable_NormalPriority,jn={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tm(){return{controller:new qM,data:new Map,refCount:0}}function Tc(s){s.refCount--,s.refCount===0&&GM(KM,function(){s.controller.abort()})}var Ac=null,Am=0,nl=0,il=null;function VM(s,a){if(Ac===null){var l=Ac=[];Am=0,nl=Lg(),il={status:"pending",value:void 0,then:function(h){l.push(h)}}}return Am++,a.then(K1,K1),a}function K1(){if(--Am===0&&Ac!==null){il!==null&&(il.status="fulfilled");var s=Ac;Ac=null,nl=0,il=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function YM(s,a){var l=[],h={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return s.then(function(){h.status="fulfilled",h.value=a;for(var m=0;m<l.length;m++)(0,l[m])(a)},function(m){for(h.status="rejected",h.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),h}var V1=E.S;E.S=function(s,a){Lw=ft(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&VM(s,a),V1!==null&&V1(s,a)};var oo=D(null);function Rm(){var s=oo.current;return s!==null?s:Qt.pooledCache}function Gh(s,a){a===null?J(oo,oo.current):J(oo,a.pool)}function Y1(){var s=Rm();return s===null?null:{parent:jn._currentValue,pool:s}}var sl=Error(i(460)),Nm=Error(i(474)),Kh=Error(i(542)),Vh={then:function(){}};function X1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Z1(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(Ee,Ee),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Q1(s),s;default:if(typeof a.status=="string")a.then(Ee,Ee);else{if(s=Qt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=h}},function(h){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Q1(s),s}throw co=a,sl}}function lo(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(co=l,sl):l}}var co=null;function J1(){if(co===null)throw Error(i(459));var s=co;return co=null,s}function Q1(s){if(s===sl||s===Kh)throw Error(i(483))}var rl=null,Rc=0;function Yh(s){var a=Rc;return Rc+=1,rl===null&&(rl=[]),Z1(rl,s,a)}function Nc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Xh(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function eS(s){function a(Z,Y){if(s){var te=Z.deletions;te===null?(Z.deletions=[Y],Z.flags|=16):te.push(Y)}}function l(Z,Y){if(!s)return null;for(;Y!==null;)a(Z,Y),Y=Y.sibling;return null}function h(Z){for(var Y=new Map;Z!==null;)Z.key!==null?Y.set(Z.key,Z):Y.set(Z.index,Z),Z=Z.sibling;return Y}function m(Z,Y){return Z=br(Z,Y),Z.index=0,Z.sibling=null,Z}function v(Z,Y,te){return Z.index=te,s?(te=Z.alternate,te!==null?(te=te.index,te<Y?(Z.flags|=67108866,Y):te):(Z.flags|=67108866,Y)):(Z.flags|=1048576,Y)}function k(Z){return s&&Z.alternate===null&&(Z.flags|=67108866),Z}function I(Z,Y,te,me){return Y===null||Y.tag!==6?(Y=vm(te,Z.mode,me),Y.return=Z,Y):(Y=m(Y,te),Y.return=Z,Y)}function G(Z,Y,te,me){var Ve=te.type;return Ve===x?he(Z,Y,te.props.children,me,te.key):Y!==null&&(Y.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===F&&lo(Ve)===Y.type)?(Y=m(Y,te.props),Nc(Y,te),Y.return=Z,Y):(Y=Fh(te.type,te.key,te.props,null,Z.mode,me),Nc(Y,te),Y.return=Z,Y)}function ne(Z,Y,te,me){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=ym(te,Z.mode,me),Y.return=Z,Y):(Y=m(Y,te.children||[]),Y.return=Z,Y)}function he(Z,Y,te,me,Ve){return Y===null||Y.tag!==7?(Y=io(te,Z.mode,me,Ve),Y.return=Z,Y):(Y=m(Y,te),Y.return=Z,Y)}function ge(Z,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=vm(""+Y,Z.mode,te),Y.return=Z,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return te=Fh(Y.type,Y.key,Y.props,null,Z.mode,te),Nc(te,Y),te.return=Z,te;case w:return Y=ym(Y,Z.mode,te),Y.return=Z,Y;case F:return Y=lo(Y),ge(Z,Y,te)}if(A(Y)||B(Y))return Y=io(Y,Z.mode,te,null),Y.return=Z,Y;if(typeof Y.then=="function")return ge(Z,Yh(Y),te);if(Y.$$typeof===z)return ge(Z,qh(Z,Y),te);Xh(Z,Y)}return null}function se(Z,Y,te,me){var Ve=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ve!==null?null:I(Z,Y,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return te.key===Ve?G(Z,Y,te,me):null;case w:return te.key===Ve?ne(Z,Y,te,me):null;case F:return te=lo(te),se(Z,Y,te,me)}if(A(te)||B(te))return Ve!==null?null:he(Z,Y,te,me,null);if(typeof te.then=="function")return se(Z,Y,Yh(te),me);if(te.$$typeof===z)return se(Z,Y,qh(Z,te),me);Xh(Z,te)}return null}function oe(Z,Y,te,me,Ve){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return Z=Z.get(te)||null,I(Y,Z,""+me,Ve);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return Z=Z.get(me.key===null?te:me.key)||null,G(Y,Z,me,Ve);case w:return Z=Z.get(me.key===null?te:me.key)||null,ne(Y,Z,me,Ve);case F:return me=lo(me),oe(Z,Y,te,me,Ve)}if(A(me)||B(me))return Z=Z.get(te)||null,he(Y,Z,me,Ve,null);if(typeof me.then=="function")return oe(Z,Y,te,Yh(me),Ve);if(me.$$typeof===z)return oe(Z,Y,te,qh(Y,me),Ve);Xh(Y,me)}return null}function Pe(Z,Y,te,me){for(var Ve=null,Ot=null,Ue=Y,ut=Y=0,Tt=null;Ue!==null&&ut<te.length;ut++){Ue.index>ut?(Tt=Ue,Ue=null):Tt=Ue.sibling;var Dt=se(Z,Ue,te[ut],me);if(Dt===null){Ue===null&&(Ue=Tt);break}s&&Ue&&Dt.alternate===null&&a(Z,Ue),Y=v(Dt,Y,ut),Ot===null?Ve=Dt:Ot.sibling=Dt,Ot=Dt,Ue=Tt}if(ut===te.length)return l(Z,Ue),At&&Sr(Z,ut),Ve;if(Ue===null){for(;ut<te.length;ut++)Ue=ge(Z,te[ut],me),Ue!==null&&(Y=v(Ue,Y,ut),Ot===null?Ve=Ue:Ot.sibling=Ue,Ot=Ue);return At&&Sr(Z,ut),Ve}for(Ue=h(Ue);ut<te.length;ut++)Tt=oe(Ue,Z,ut,te[ut],me),Tt!==null&&(s&&Tt.alternate!==null&&Ue.delete(Tt.key===null?ut:Tt.key),Y=v(Tt,Y,ut),Ot===null?Ve=Tt:Ot.sibling=Tt,Ot=Tt);return s&&Ue.forEach(function(Ca){return a(Z,Ca)}),At&&Sr(Z,ut),Ve}function Qe(Z,Y,te,me){if(te==null)throw Error(i(151));for(var Ve=null,Ot=null,Ue=Y,ut=Y=0,Tt=null,Dt=te.next();Ue!==null&&!Dt.done;ut++,Dt=te.next()){Ue.index>ut?(Tt=Ue,Ue=null):Tt=Ue.sibling;var Ca=se(Z,Ue,Dt.value,me);if(Ca===null){Ue===null&&(Ue=Tt);break}s&&Ue&&Ca.alternate===null&&a(Z,Ue),Y=v(Ca,Y,ut),Ot===null?Ve=Ca:Ot.sibling=Ca,Ot=Ca,Ue=Tt}if(Dt.done)return l(Z,Ue),At&&Sr(Z,ut),Ve;if(Ue===null){for(;!Dt.done;ut++,Dt=te.next())Dt=ge(Z,Dt.value,me),Dt!==null&&(Y=v(Dt,Y,ut),Ot===null?Ve=Dt:Ot.sibling=Dt,Ot=Dt);return At&&Sr(Z,ut),Ve}for(Ue=h(Ue);!Dt.done;ut++,Dt=te.next())Dt=oe(Ue,Z,ut,Dt.value,me),Dt!==null&&(s&&Dt.alternate!==null&&Ue.delete(Dt.key===null?ut:Dt.key),Y=v(Dt,Y,ut),Ot===null?Ve=Dt:Ot.sibling=Dt,Ot=Dt);return s&&Ue.forEach(function(a6){return a(Z,a6)}),At&&Sr(Z,ut),Ve}function Yt(Z,Y,te,me){if(typeof te=="object"&&te!==null&&te.type===x&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case S:e:{for(var Ve=te.key;Y!==null;){if(Y.key===Ve){if(Ve=te.type,Ve===x){if(Y.tag===7){l(Z,Y.sibling),me=m(Y,te.props.children),me.return=Z,Z=me;break e}}else if(Y.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===F&&lo(Ve)===Y.type){l(Z,Y.sibling),me=m(Y,te.props),Nc(me,te),me.return=Z,Z=me;break e}l(Z,Y);break}else a(Z,Y);Y=Y.sibling}te.type===x?(me=io(te.props.children,Z.mode,me,te.key),me.return=Z,Z=me):(me=Fh(te.type,te.key,te.props,null,Z.mode,me),Nc(me,te),me.return=Z,Z=me)}return k(Z);case w:e:{for(Ve=te.key;Y!==null;){if(Y.key===Ve)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){l(Z,Y.sibling),me=m(Y,te.children||[]),me.return=Z,Z=me;break e}else{l(Z,Y);break}else a(Z,Y);Y=Y.sibling}me=ym(te,Z.mode,me),me.return=Z,Z=me}return k(Z);case F:return te=lo(te),Yt(Z,Y,te,me)}if(A(te))return Pe(Z,Y,te,me);if(B(te)){if(Ve=B(te),typeof Ve!="function")throw Error(i(150));return te=Ve.call(te),Qe(Z,Y,te,me)}if(typeof te.then=="function")return Yt(Z,Y,Yh(te),me);if(te.$$typeof===z)return Yt(Z,Y,qh(Z,te),me);Xh(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Y!==null&&Y.tag===6?(l(Z,Y.sibling),me=m(Y,te),me.return=Z,Z=me):(l(Z,Y),me=vm(te,Z.mode,me),me.return=Z,Z=me),k(Z)):l(Z,Y)}return function(Z,Y,te,me){try{Rc=0;var Ve=Yt(Z,Y,te,me);return rl=null,Ve}catch(Ue){if(Ue===sl||Ue===Kh)throw Ue;var Ot=is(29,Ue,null,Z.mode);return Ot.lanes=me,Ot.return=Z,Ot}}}var uo=eS(!0),tS=eS(!1),oa=!1;function Lm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mm(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function la(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ca(s,a,l){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(It&2)!==0){var m=h.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),h.pending=a,a=Hh(s),P1(s,null,l),a}return zh(s,h,a,l),Hh(s)}function Lc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Ye(s,l)}}function Om(s,a){var l=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var m=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var k={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?m=v=k:v=v.next=k,l=l.next}while(l!==null);v===null?m=v=a:v=v.next=a}else m=v=a;l={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}var Dm=!1;function Mc(){if(Dm){var s=il;if(s!==null)throw s}}function Oc(s,a,l,h){Dm=!1;var m=s.updateQueue;oa=!1;var v=m.firstBaseUpdate,k=m.lastBaseUpdate,I=m.shared.pending;if(I!==null){m.shared.pending=null;var G=I,ne=G.next;G.next=null,k===null?v=ne:k.next=ne,k=G;var he=s.alternate;he!==null&&(he=he.updateQueue,I=he.lastBaseUpdate,I!==k&&(I===null?he.firstBaseUpdate=ne:I.next=ne,he.lastBaseUpdate=G))}if(v!==null){var ge=m.baseState;k=0,he=ne=G=null,I=v;do{var se=I.lane&-536870913,oe=se!==I.lane;if(oe?(Et&se)===se:(h&se)===se){se!==0&&se===nl&&(Dm=!0),he!==null&&(he=he.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Pe=s,Qe=I;se=a;var Yt=l;switch(Qe.tag){case 1:if(Pe=Qe.payload,typeof Pe=="function"){ge=Pe.call(Yt,ge,se);break e}ge=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Qe.payload,se=typeof Pe=="function"?Pe.call(Yt,ge,se):Pe,se==null)break e;ge=_({},ge,se);break e;case 2:oa=!0}}se=I.callback,se!==null&&(s.flags|=64,oe&&(s.flags|=8192),oe=m.callbacks,oe===null?m.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},he===null?(ne=he=oe,G=ge):he=he.next=oe,k|=se;if(I=I.next,I===null){if(I=m.shared.pending,I===null)break;oe=I,I=oe.next,oe.next=null,m.lastBaseUpdate=oe,m.shared.pending=null}}while(!0);he===null&&(G=ge),m.baseState=G,m.firstBaseUpdate=ne,m.lastBaseUpdate=he,v===null&&(m.shared.lanes=0),pa|=k,s.lanes=k,s.memoizedState=ge}}function nS(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function iS(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)nS(l[s],a)}var al=D(null),Zh=D(0);function sS(s,a){s=Mr,J(Zh,s),J(al,a),Mr=s|a.baseLanes}function jm(){J(Zh,Mr),J(al,al.current)}function Im(){Mr=Zh.current,V(al),V(Zh)}var ss=D(null),ks=null;function ua(s){var a=s.alternate;J(Nn,Nn.current&1),J(ss,s),ks===null&&(a===null||al.current!==null||a.memoizedState!==null)&&(ks=s)}function Bm(s){J(Nn,Nn.current),J(ss,s),ks===null&&(ks=s)}function rS(s){s.tag===22?(J(Nn,Nn.current),J(ss,s),ks===null&&(ks=s)):ha()}function ha(){J(Nn,Nn.current),J(ss,ss.current)}function rs(s){V(ss),ks===s&&(ks=null),V(Nn)}var Nn=D(0);function Jh(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Ug(l)||Wg(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Cr=0,lt=null,Kt=null,In=null,Qh=!1,ol=!1,ho=!1,ed=0,Dc=0,ll=null,XM=0;function bn(){throw Error(i(321))}function Pm(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ns(s[l],a[l]))return!1;return!0}function $m(s,a,l,h,m,v){return Cr=v,lt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,E.H=s===null||s.memoizedState===null?FS:eg,ho=!1,v=l(h,m),ho=!1,ol&&(v=oS(a,l,h,m)),aS(s),v}function aS(s){E.H=Bc;var a=Kt!==null&&Kt.next!==null;if(Cr=0,In=Kt=lt=null,Qh=!1,Dc=0,ll=null,a)throw Error(i(300));s===null||Bn||(s=s.dependencies,s!==null&&Wh(s)&&(Bn=!0))}function oS(s,a,l,h){lt=s;var m=0;do{if(ol&&(ll=null),Dc=0,ol=!1,25<=m)throw Error(i(301));if(m+=1,In=Kt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}E.H=US,v=a(l,h)}while(ol);return v}function ZM(){var s=E.H,a=s.useState()[0];return a=typeof a.then=="function"?jc(a):a,s=s.useState()[0],(Kt!==null?Kt.memoizedState:null)!==s&&(lt.flags|=1024),a}function zm(){var s=ed!==0;return ed=0,s}function Hm(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Fm(s){if(Qh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Qh=!1}Cr=0,In=Kt=lt=null,ol=!1,Dc=ed=0,ll=null}function Ai(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return In===null?lt.memoizedState=In=s:In=In.next=s,In}function Ln(){if(Kt===null){var s=lt.alternate;s=s!==null?s.memoizedState:null}else s=Kt.next;var a=In===null?lt.memoizedState:In.next;if(a!==null)In=a,Kt=s;else{if(s===null)throw lt.alternate===null?Error(i(467)):Error(i(310));Kt=s,s={memoizedState:Kt.memoizedState,baseState:Kt.baseState,baseQueue:Kt.baseQueue,queue:Kt.queue,next:null},In===null?lt.memoizedState=In=s:In=In.next=s}return In}function td(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jc(s){var a=Dc;return Dc+=1,ll===null&&(ll=[]),s=Z1(ll,s,a),a=lt,(In===null?a.memoizedState:In.next)===null&&(a=a.alternate,E.H=a===null||a.memoizedState===null?FS:eg),s}function nd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return jc(s);if(s.$$typeof===z)return hi(s)}throw Error(i(438,String(s)))}function Um(s){var a=null,l=lt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=lt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=td(),lt.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(s),h=0;h<s;h++)l[h]=ae;return a.index++,l}function kr(s,a){return typeof a=="function"?a(s):a}function id(s){var a=Ln();return Wm(a,Kt,s)}function Wm(s,a,l){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=l;var m=s.baseQueue,v=h.pending;if(v!==null){if(m!==null){var k=m.next;m.next=v.next,v.next=k}a.baseQueue=m=v,h.pending=null}if(v=s.baseState,m===null)s.memoizedState=v;else{a=m.next;var I=k=null,G=null,ne=a,he=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(Et&ge)===ge:(Cr&ge)===ge){var se=ne.revertLane;if(se===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===nl&&(he=!0);else if((Cr&se)===se){ne=ne.next,se===nl&&(he=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},G===null?(I=G=ge,k=v):G=G.next=ge,lt.lanes|=se,pa|=se;ge=ne.action,ho&&l(v,ge),v=ne.hasEagerState?ne.eagerState:l(v,ge)}else se={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},G===null?(I=G=se,k=v):G=G.next=se,lt.lanes|=ge,pa|=ge;ne=ne.next}while(ne!==null&&ne!==a);if(G===null?k=v:G.next=I,!ns(v,s.memoizedState)&&(Bn=!0,he&&(l=il,l!==null)))throw l;s.memoizedState=v,s.baseState=k,s.baseQueue=G,h.lastRenderedState=v}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function qm(s){var a=Ln(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=s;var h=l.dispatch,m=l.pending,v=a.memoizedState;if(m!==null){l.pending=null;var k=m=m.next;do v=s(v,k.action),k=k.next;while(k!==m);ns(v,a.memoizedState)||(Bn=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),l.lastRenderedState=v}return[v,h]}function lS(s,a,l){var h=lt,m=Ln(),v=At;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=a();var k=!ns((Kt||m).memoizedState,l);if(k&&(m.memoizedState=l,Bn=!0),m=m.queue,Vm(hS.bind(null,h,m,s),[s]),m.getSnapshot!==a||k||In!==null&&In.memoizedState.tag&1){if(h.flags|=2048,cl(9,{destroy:void 0},uS.bind(null,h,m,l,a),null),Qt===null)throw Error(i(349));v||(Cr&127)!==0||cS(h,a,l)}return l}function cS(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=lt.updateQueue,a===null?(a=td(),lt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function uS(s,a,l,h){a.value=l,a.getSnapshot=h,dS(a)&&fS(s)}function hS(s,a,l){return l(function(){dS(a)&&fS(s)})}function dS(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ns(s,l)}catch{return!0}}function fS(s){var a=no(s,2);a!==null&&Gi(a,s,2)}function Gm(s){var a=Ai();if(typeof s=="function"){var l=s;if(s=l(),ho){Rt(!0);try{l()}finally{Rt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:s},a}function pS(s,a,l,h){return s.baseState=l,Wm(s,Kt,typeof h=="function"?h:kr)}function JM(s,a,l,h,m){if(ad(s))throw Error(i(485));if(s=a.action,s!==null){var v={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){v.listeners.push(k)}};E.T!==null?l(!0):v.isTransition=!1,h(v),l=a.pending,l===null?(v.next=a.pending=v,mS(a,v)):(v.next=l.next,a.pending=l.next=v)}}function mS(s,a){var l=a.action,h=a.payload,m=s.state;if(a.isTransition){var v=E.T,k={};E.T=k;try{var I=l(m,h),G=E.S;G!==null&&G(k,I),gS(s,a,I)}catch(ne){Km(s,a,ne)}finally{v!==null&&k.types!==null&&(v.types=k.types),E.T=v}}else try{v=l(m,h),gS(s,a,v)}catch(ne){Km(s,a,ne)}}function gS(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){_S(s,a,h)},function(h){return Km(s,a,h)}):_S(s,a,l)}function _S(s,a,l){a.status="fulfilled",a.value=l,vS(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,mS(s,l)))}function Km(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,vS(a),a=a.next;while(a!==h)}s.action=null}function vS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function yS(s,a){return a}function bS(s,a){if(At){var l=Qt.formState;if(l!==null){e:{var h=lt;if(At){if(nn){t:{for(var m=nn,v=Cs;m.nodeType!==8;){if(!v){m=null;break t}if(m=Es(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){nn=Es(m.nextSibling),h=m.data==="F!";break e}}ra(h)}h=!1}h&&(a=l[0])}}return l=Ai(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yS,lastRenderedState:a},l.queue=h,l=$S.bind(null,lt,h),h.dispatch=l,h=Gm(!1),v=Qm.bind(null,lt,!1,h.queue),h=Ai(),m={state:a,dispatch:null,action:s,pending:null},h.queue=m,l=JM.bind(null,lt,m,v,l),m.dispatch=l,h.memoizedState=s,[a,l,!1]}function SS(s){var a=Ln();return wS(a,Kt,s)}function wS(s,a,l){if(a=Wm(s,a,yS)[0],s=id(kr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=jc(a)}catch(k){throw k===sl?Kh:k}else h=a;a=Ln();var m=a.queue,v=m.dispatch;return l!==a.memoizedState&&(lt.flags|=2048,cl(9,{destroy:void 0},QM.bind(null,m,l),null)),[h,v,s]}function QM(s,a){s.action=a}function xS(s){var a=Ln(),l=Kt;if(l!==null)return wS(a,l,s);Ln(),a=a.memoizedState,l=Ln();var h=l.queue.dispatch;return l.memoizedState=s,[a,h,!1]}function cl(s,a,l,h){return s={tag:s,create:l,deps:h,inst:a,next:null},a=lt.updateQueue,a===null&&(a=td(),lt.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=s.next=s:(h=l.next,l.next=s,s.next=h,a.lastEffect=s),s}function CS(){return Ln().memoizedState}function sd(s,a,l,h){var m=Ai();lt.flags|=s,m.memoizedState=cl(1|a,{destroy:void 0},l,h===void 0?null:h)}function rd(s,a,l,h){var m=Ln();h=h===void 0?null:h;var v=m.memoizedState.inst;Kt!==null&&h!==null&&Pm(h,Kt.memoizedState.deps)?m.memoizedState=cl(a,v,l,h):(lt.flags|=s,m.memoizedState=cl(1|a,v,l,h))}function kS(s,a){sd(8390656,8,s,a)}function Vm(s,a){rd(2048,8,s,a)}function e3(s){lt.flags|=4;var a=lt.updateQueue;if(a===null)a=td(),lt.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function ES(s){var a=Ln().memoizedState;return e3({ref:a,nextImpl:s}),function(){if((It&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function TS(s,a){return rd(4,2,s,a)}function AS(s,a){return rd(4,4,s,a)}function RS(s,a){if(typeof a=="function"){s=s();var l=a(s);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function NS(s,a,l){l=l!=null?l.concat([s]):null,rd(4,4,RS.bind(null,a,s),l)}function Ym(){}function LS(s,a){var l=Ln();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&Pm(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function MS(s,a){var l=Ln();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&Pm(a,h[1]))return h[0];if(h=s(),ho){Rt(!0);try{s()}finally{Rt(!1)}}return l.memoizedState=[h,a],h}function Xm(s,a,l){return l===void 0||(Cr&1073741824)!==0&&(Et&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=Ow(),lt.lanes|=s,pa|=s,l)}function OS(s,a,l,h){return ns(l,a)?l:al.current!==null?(s=Xm(s,l,h),ns(s,a)||(Bn=!0),s):(Cr&42)===0||(Cr&1073741824)!==0&&(Et&261930)===0?(Bn=!0,s.memoizedState=l):(s=Ow(),lt.lanes|=s,pa|=s,a)}function DS(s,a,l,h,m){var v=L.p;L.p=v!==0&&8>v?v:8;var k=E.T,I={};E.T=I,Qm(s,!1,a,l);try{var G=m(),ne=E.S;if(ne!==null&&ne(I,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var he=YM(G,h);Ic(s,a,he,ls(s))}else Ic(s,a,h,ls(s))}catch(ge){Ic(s,a,{then:function(){},status:"rejected",reason:ge},ls())}finally{L.p=v,k!==null&&I.types!==null&&(k.types=I.types),E.T=k}}function t3(){}function Zm(s,a,l,h){if(s.tag!==5)throw Error(i(476));var m=jS(s).queue;DS(s,m,a,$,l===null?t3:function(){return IS(s),l(h)})}function jS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:$},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function IS(s){var a=jS(s);a.next===null&&(a=s.alternate.memoizedState),Ic(s,a.next.queue,{},ls())}function Jm(){return hi(Qc)}function BS(){return Ln().memoizedState}function PS(){return Ln().memoizedState}function n3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=ls();s=la(l);var h=ca(a,s,l);h!==null&&(Gi(h,a,l),Lc(h,a,l)),a={cache:Tm()},s.payload=a;return}a=a.return}}function i3(s,a,l){var h=ls();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ad(s)?zS(a,l):(l=gm(s,a,l,h),l!==null&&(Gi(l,s,h),HS(l,a,h)))}function $S(s,a,l){var h=ls();Ic(s,a,l,h)}function Ic(s,a,l,h){var m={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ad(s))zS(a,m);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var k=a.lastRenderedState,I=v(k,l);if(m.hasEagerState=!0,m.eagerState=I,ns(I,k))return zh(s,a,m,0),Qt===null&&$h(),!1}catch{}if(l=gm(s,a,m,h),l!==null)return Gi(l,s,h),HS(l,a,h),!0}return!1}function Qm(s,a,l,h){if(h={lane:2,revertLane:Lg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ad(s)){if(a)throw Error(i(479))}else a=gm(s,l,h,2),a!==null&&Gi(a,s,2)}function ad(s){var a=s.alternate;return s===lt||a!==null&&a===lt}function zS(s,a){ol=Qh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function HS(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Ye(s,l)}}var Bc={readContext:hi,use:nd,useCallback:bn,useContext:bn,useEffect:bn,useImperativeHandle:bn,useLayoutEffect:bn,useInsertionEffect:bn,useMemo:bn,useReducer:bn,useRef:bn,useState:bn,useDebugValue:bn,useDeferredValue:bn,useTransition:bn,useSyncExternalStore:bn,useId:bn,useHostTransitionStatus:bn,useFormState:bn,useActionState:bn,useOptimistic:bn,useMemoCache:bn,useCacheRefresh:bn};Bc.useEffectEvent=bn;var FS={readContext:hi,use:nd,useCallback:function(s,a){return Ai().memoizedState=[s,a===void 0?null:a],s},useContext:hi,useEffect:kS,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,sd(4194308,4,RS.bind(null,a,s),l)},useLayoutEffect:function(s,a){return sd(4194308,4,s,a)},useInsertionEffect:function(s,a){sd(4,2,s,a)},useMemo:function(s,a){var l=Ai();a=a===void 0?null:a;var h=s();if(ho){Rt(!0);try{s()}finally{Rt(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=Ai();if(l!==void 0){var m=l(a);if(ho){Rt(!0);try{l(a)}finally{Rt(!1)}}}else m=a;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=i3.bind(null,lt,s),[h.memoizedState,s]},useRef:function(s){var a=Ai();return s={current:s},a.memoizedState=s},useState:function(s){s=Gm(s);var a=s.queue,l=$S.bind(null,lt,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Ym,useDeferredValue:function(s,a){var l=Ai();return Xm(l,s,a)},useTransition:function(){var s=Gm(!1);return s=DS.bind(null,lt,s.queue,!0,!1),Ai().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=lt,m=Ai();if(At){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),Qt===null)throw Error(i(349));(Et&127)!==0||cS(h,a,l)}m.memoizedState=l;var v={value:l,getSnapshot:a};return m.queue=v,kS(hS.bind(null,h,v,s),[s]),h.flags|=2048,cl(9,{destroy:void 0},uS.bind(null,h,v,l,a),null),l},useId:function(){var s=Ai(),a=Qt.identifierPrefix;if(At){var l=Qs,h=Js;l=(h&~(1<<32-Pt(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=ed++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=XM++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Jm,useFormState:bS,useActionState:bS,useOptimistic:function(s){var a=Ai();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Qm.bind(null,lt,!0,l),l.dispatch=a,[s,a]},useMemoCache:Um,useCacheRefresh:function(){return Ai().memoizedState=n3.bind(null,lt)},useEffectEvent:function(s){var a=Ai(),l={impl:s};return a.memoizedState=l,function(){if((It&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},eg={readContext:hi,use:nd,useCallback:LS,useContext:hi,useEffect:Vm,useImperativeHandle:NS,useInsertionEffect:TS,useLayoutEffect:AS,useMemo:MS,useReducer:id,useRef:CS,useState:function(){return id(kr)},useDebugValue:Ym,useDeferredValue:function(s,a){var l=Ln();return OS(l,Kt.memoizedState,s,a)},useTransition:function(){var s=id(kr)[0],a=Ln().memoizedState;return[typeof s=="boolean"?s:jc(s),a]},useSyncExternalStore:lS,useId:BS,useHostTransitionStatus:Jm,useFormState:SS,useActionState:SS,useOptimistic:function(s,a){var l=Ln();return pS(l,Kt,s,a)},useMemoCache:Um,useCacheRefresh:PS};eg.useEffectEvent=ES;var US={readContext:hi,use:nd,useCallback:LS,useContext:hi,useEffect:Vm,useImperativeHandle:NS,useInsertionEffect:TS,useLayoutEffect:AS,useMemo:MS,useReducer:qm,useRef:CS,useState:function(){return qm(kr)},useDebugValue:Ym,useDeferredValue:function(s,a){var l=Ln();return Kt===null?Xm(l,s,a):OS(l,Kt.memoizedState,s,a)},useTransition:function(){var s=qm(kr)[0],a=Ln().memoizedState;return[typeof s=="boolean"?s:jc(s),a]},useSyncExternalStore:lS,useId:BS,useHostTransitionStatus:Jm,useFormState:xS,useActionState:xS,useOptimistic:function(s,a){var l=Ln();return Kt!==null?pS(l,Kt,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Um,useCacheRefresh:PS};US.useEffectEvent=ES;function tg(s,a,l,h){a=s.memoizedState,l=l(h,a),l=l==null?a:_({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var ng={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=ls(),m=la(h);m.payload=a,l!=null&&(m.callback=l),a=ca(s,m,h),a!==null&&(Gi(a,s,h),Lc(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=ls(),m=la(h);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=ca(s,m,h),a!==null&&(Gi(a,s,h),Lc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=ls(),h=la(l);h.tag=2,a!=null&&(h.callback=a),a=ca(s,h,l),a!==null&&(Gi(a,s,l),Lc(a,s,l))}};function WS(s,a,l,h,m,v,k){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,k):a.prototype&&a.prototype.isPureReactComponent?!xc(l,h)||!xc(m,v):!0}function qS(s,a,l,h){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,h),a.state!==s&&ng.enqueueReplaceState(a,a.state,null)}function fo(s,a){var l=a;if("ref"in a){l={};for(var h in a)h!=="ref"&&(l[h]=a[h])}if(s=s.defaultProps){l===a&&(l=_({},l));for(var m in s)l[m]===void 0&&(l[m]=s[m])}return l}function GS(s){Ph(s)}function KS(s){console.error(s)}function VS(s){Ph(s)}function od(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function YS(s,a,l){try{var h=s.onCaughtError;h(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function ig(s,a,l){return l=la(l),l.tag=3,l.payload={element:null},l.callback=function(){od(s,a)},l}function XS(s){return s=la(s),s.tag=3,s}function ZS(s,a,l,h){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var v=h.value;s.payload=function(){return m(v)},s.callback=function(){YS(a,l,h)}}var k=l.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(s.callback=function(){YS(a,l,h),typeof m!="function"&&(ma===null?ma=new Set([this]):ma.add(this));var I=h.stack;this.componentDidCatch(h.value,{componentStack:I!==null?I:""})})}function s3(s,a,l,h,m){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&tl(a,l,m,!0),l=ss.current,l!==null){switch(l.tag){case 31:case 13:return ks===null?yd():l.alternate===null&&Sn===0&&(Sn=3),l.flags&=-257,l.flags|=65536,l.lanes=m,h===Vh?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),Ag(s,h,m)),!1;case 22:return l.flags|=65536,h===Vh?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([h]):l.add(h)),Ag(s,h,m)),!1}throw Error(i(435,l.tag))}return Ag(s,h,m),yd(),!1}if(At)return a=ss.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,h!==wm&&(s=Error(i(422),{cause:h}),Ec(Ss(s,l)))):(h!==wm&&(a=Error(i(423),{cause:h}),Ec(Ss(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=Ss(h,l),m=ig(s.stateNode,h,m),Om(s,m),Sn!==4&&(Sn=2)),!1;var v=Error(i(520),{cause:h});if(v=Ss(v,l),qc===null?qc=[v]:qc.push(v),Sn!==4&&(Sn=2),a===null)return!0;h=Ss(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=ig(l.stateNode,h,s),Om(l,s),!1;case 1:if(a=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ma===null||!ma.has(v))))return l.flags|=65536,m&=-m,l.lanes|=m,m=XS(m),ZS(m,s,l,h),Om(l,m),!1}l=l.return}while(l!==null);return!1}var sg=Error(i(461)),Bn=!1;function di(s,a,l,h){a.child=s===null?tS(a,null,l,h):uo(a,s.child,l,h)}function JS(s,a,l,h,m){l=l.render;var v=a.ref;if("ref"in h){var k={};for(var I in h)I!=="ref"&&(k[I]=h[I])}else k=h;return ao(a),h=$m(s,a,l,k,v,m),I=zm(),s!==null&&!Bn?(Hm(s,a,m),Er(s,a,m)):(At&&I&&bm(a),a.flags|=1,di(s,a,h,m),a.child)}function QS(s,a,l,h,m){if(s===null){var v=l.type;return typeof v=="function"&&!_m(v)&&v.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=v,ew(s,a,v,h,m)):(s=Fh(l.type,null,h,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!dg(s,m)){var k=v.memoizedProps;if(l=l.compare,l=l!==null?l:xc,l(k,h)&&s.ref===a.ref)return Er(s,a,m)}return a.flags|=1,s=br(v,h),s.ref=a.ref,s.return=a,a.child=s}function ew(s,a,l,h,m){if(s!==null){var v=s.memoizedProps;if(xc(v,h)&&s.ref===a.ref)if(Bn=!1,a.pendingProps=h=v,dg(s,m))(s.flags&131072)!==0&&(Bn=!0);else return a.lanes=s.lanes,Er(s,a,m)}return rg(s,a,l,h,m)}function tw(s,a,l,h){var m=h.children,v=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,s!==null){for(h=a.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~v}else h=0,a.child=null;return nw(s,a,v,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Gh(a,v!==null?v.cachePool:null),v!==null?sS(a,v):jm(),rS(a);else return h=a.lanes=536870912,nw(s,a,v!==null?v.baseLanes|l:l,l,h)}else v!==null?(Gh(a,v.cachePool),sS(a,v),ha(),a.memoizedState=null):(s!==null&&Gh(a,null),jm(),ha());return di(s,a,m,l),a.child}function Pc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function nw(s,a,l,h,m){var v=Rm();return v=v===null?null:{parent:jn._currentValue,pool:v},a.memoizedState={baseLanes:l,cachePool:v},s!==null&&Gh(a,null),jm(),rS(a),s!==null&&tl(s,a,h,!0),a.childLanes=m,null}function ld(s,a){return a=ud({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function iw(s,a,l){return uo(a,s.child,null,l),s=ld(a,a.pendingProps),s.flags|=2,rs(a),a.memoizedState=null,s}function r3(s,a,l){var h=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(At){if(h.mode==="hidden")return s=ld(a,h),a.lanes=536870912,Pc(null,s);if(Bm(a),(s=nn)?(s=mx(s,Cs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ia!==null?{id:Js,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},l=z1(s),l.return=a,a.child=l,ui=a,nn=null)):s=null,s===null)throw ra(a);return a.lanes=536870912,null}return ld(a,h)}var v=s.memoizedState;if(v!==null){var k=v.dehydrated;if(Bm(a),m)if(a.flags&256)a.flags&=-257,a=iw(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Bn||tl(s,a,l,!1),m=(l&s.childLanes)!==0,Bn||m){if(h=Qt,h!==null&&(k=Jt(h,l),k!==0&&k!==v.retryLane))throw v.retryLane=k,no(s,k),Gi(h,s,k),sg;yd(),a=iw(s,a,l)}else s=v.treeContext,nn=Es(k.nextSibling),ui=a,At=!0,sa=null,Cs=!1,s!==null&&U1(a,s),a=ld(a,h),a.flags|=4096;return a}return s=br(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function cd(s,a){var l=a.ref;if(l===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function rg(s,a,l,h,m){return ao(a),l=$m(s,a,l,h,void 0,m),h=zm(),s!==null&&!Bn?(Hm(s,a,m),Er(s,a,m)):(At&&h&&bm(a),a.flags|=1,di(s,a,l,m),a.child)}function sw(s,a,l,h,m,v){return ao(a),a.updateQueue=null,l=oS(a,h,l,m),aS(s),h=zm(),s!==null&&!Bn?(Hm(s,a,v),Er(s,a,v)):(At&&h&&bm(a),a.flags|=1,di(s,a,l,v),a.child)}function rw(s,a,l,h,m){if(ao(a),a.stateNode===null){var v=Zo,k=l.contextType;typeof k=="object"&&k!==null&&(v=hi(k)),v=new l(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=ng,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},Lm(a),k=l.contextType,v.context=typeof k=="object"&&k!==null?hi(k):Zo,v.state=a.memoizedState,k=l.getDerivedStateFromProps,typeof k=="function"&&(tg(a,l,k,h),v.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(k=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),k!==v.state&&ng.enqueueReplaceState(v,v.state,null),Oc(a,h,v,m),Mc(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){v=a.stateNode;var I=a.memoizedProps,G=fo(l,I);v.props=G;var ne=v.context,he=l.contextType;k=Zo,typeof he=="object"&&he!==null&&(k=hi(he));var ge=l.getDerivedStateFromProps;he=typeof ge=="function"||typeof v.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,he||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(I||ne!==k)&&qS(a,v,h,k),oa=!1;var se=a.memoizedState;v.state=se,Oc(a,h,v,m),Mc(),ne=a.memoizedState,I||se!==ne||oa?(typeof ge=="function"&&(tg(a,l,ge,h),ne=a.memoizedState),(G=oa||WS(a,l,G,h,se,ne,k))?(he||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=ne),v.props=h,v.state=ne,v.context=k,h=G):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,Mm(s,a),k=a.memoizedProps,he=fo(l,k),v.props=he,ge=a.pendingProps,se=v.context,ne=l.contextType,G=Zo,typeof ne=="object"&&ne!==null&&(G=hi(ne)),I=l.getDerivedStateFromProps,(ne=typeof I=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(k!==ge||se!==G)&&qS(a,v,h,G),oa=!1,se=a.memoizedState,v.state=se,Oc(a,h,v,m),Mc();var oe=a.memoizedState;k!==ge||se!==oe||oa||s!==null&&s.dependencies!==null&&Wh(s.dependencies)?(typeof I=="function"&&(tg(a,l,I,h),oe=a.memoizedState),(he=oa||WS(a,l,he,h,se,oe,G)||s!==null&&s.dependencies!==null&&Wh(s.dependencies))?(ne||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,oe,G),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,oe,G)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||k===s.memoizedProps&&se===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&se===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=oe),v.props=h,v.state=oe,v.context=G,h=he):(typeof v.componentDidUpdate!="function"||k===s.memoizedProps&&se===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&se===s.memoizedState||(a.flags|=1024),h=!1)}return v=h,cd(s,a),h=(a.flags&128)!==0,v||h?(v=a.stateNode,l=h&&typeof l.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,s!==null&&h?(a.child=uo(a,s.child,null,m),a.child=uo(a,null,l,m)):di(s,a,l,m),a.memoizedState=v.state,s=a.child):s=Er(s,a,m),s}function aw(s,a,l,h){return so(),a.flags|=256,di(s,a,l,h),a.child}var ag={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function og(s){return{baseLanes:s,cachePool:Y1()}}function lg(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=os),s}function ow(s,a,l){var h=a.pendingProps,m=!1,v=(a.flags&128)!==0,k;if((k=v)||(k=s!==null&&s.memoizedState===null?!1:(Nn.current&2)!==0),k&&(m=!0,a.flags&=-129),k=(a.flags&32)!==0,a.flags&=-33,s===null){if(At){if(m?ua(a):ha(),(s=nn)?(s=mx(s,Cs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ia!==null?{id:Js,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},l=z1(s),l.return=a,a.child=l,ui=a,nn=null)):s=null,s===null)throw ra(a);return Wg(s)?a.lanes=32:a.lanes=536870912,null}var I=h.children;return h=h.fallback,m?(ha(),m=a.mode,I=ud({mode:"hidden",children:I},m),h=io(h,m,l,null),I.return=a,h.return=a,I.sibling=h,a.child=I,h=a.child,h.memoizedState=og(l),h.childLanes=lg(s,k,l),a.memoizedState=ag,Pc(null,h)):(ua(a),cg(a,I))}var G=s.memoizedState;if(G!==null&&(I=G.dehydrated,I!==null)){if(v)a.flags&256?(ua(a),a.flags&=-257,a=ug(s,a,l)):a.memoizedState!==null?(ha(),a.child=s.child,a.flags|=128,a=null):(ha(),I=h.fallback,m=a.mode,h=ud({mode:"visible",children:h.children},m),I=io(I,m,l,null),I.flags|=2,h.return=a,I.return=a,h.sibling=I,a.child=h,uo(a,s.child,null,l),h=a.child,h.memoizedState=og(l),h.childLanes=lg(s,k,l),a.memoizedState=ag,a=Pc(null,h));else if(ua(a),Wg(I)){if(k=I.nextSibling&&I.nextSibling.dataset,k)var ne=k.dgst;k=ne,h=Error(i(419)),h.stack="",h.digest=k,Ec({value:h,source:null,stack:null}),a=ug(s,a,l)}else if(Bn||tl(s,a,l,!1),k=(l&s.childLanes)!==0,Bn||k){if(k=Qt,k!==null&&(h=Jt(k,l),h!==0&&h!==G.retryLane))throw G.retryLane=h,no(s,h),Gi(k,s,h),sg;Ug(I)||yd(),a=ug(s,a,l)}else Ug(I)?(a.flags|=192,a.child=s.child,a=null):(s=G.treeContext,nn=Es(I.nextSibling),ui=a,At=!0,sa=null,Cs=!1,s!==null&&U1(a,s),a=cg(a,h.children),a.flags|=4096);return a}return m?(ha(),I=h.fallback,m=a.mode,G=s.child,ne=G.sibling,h=br(G,{mode:"hidden",children:h.children}),h.subtreeFlags=G.subtreeFlags&65011712,ne!==null?I=br(ne,I):(I=io(I,m,l,null),I.flags|=2),I.return=a,h.return=a,h.sibling=I,a.child=h,Pc(null,h),h=a.child,I=s.child.memoizedState,I===null?I=og(l):(m=I.cachePool,m!==null?(G=jn._currentValue,m=m.parent!==G?{parent:G,pool:G}:m):m=Y1(),I={baseLanes:I.baseLanes|l,cachePool:m}),h.memoizedState=I,h.childLanes=lg(s,k,l),a.memoizedState=ag,Pc(s.child,h)):(ua(a),l=s.child,s=l.sibling,l=br(l,{mode:"visible",children:h.children}),l.return=a,l.sibling=null,s!==null&&(k=a.deletions,k===null?(a.deletions=[s],a.flags|=16):k.push(s)),a.child=l,a.memoizedState=null,l)}function cg(s,a){return a=ud({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function ud(s,a){return s=is(22,s,null,a),s.lanes=0,s}function ug(s,a,l){return uo(a,s.child,null,l),s=cg(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function lw(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),km(s.return,a,l)}function hg(s,a,l,h,m,v){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:m,treeForkCount:v}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=h,k.tail=l,k.tailMode=m,k.treeForkCount=v)}function cw(s,a,l){var h=a.pendingProps,m=h.revealOrder,v=h.tail;h=h.children;var k=Nn.current,I=(k&2)!==0;if(I?(k=k&1|2,a.flags|=128):k&=1,J(Nn,k),di(s,a,h,l),h=At?kc:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&lw(s,l,a);else if(s.tag===19)lw(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(l=a.child,m=null;l!==null;)s=l.alternate,s!==null&&Jh(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),hg(a,!1,m,l,v,h);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=a.child,a.child=null;m!==null;){if(s=m.alternate,s!==null&&Jh(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}hg(a,!0,l,null,v,h);break;case"together":hg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Er(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),pa|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(tl(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,l=br(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=br(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function dg(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Wh(s)))}function a3(s,a,l){switch(a.tag){case 3:Oe(a,a.stateNode.containerInfo),aa(a,jn,s.memoizedState.cache),so();break;case 27:case 5:ct(a);break;case 4:Oe(a,a.stateNode.containerInfo);break;case 10:aa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Bm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(ua(a),a.flags|=128,null):(l&a.child.childLanes)!==0?ow(s,a,l):(ua(a),s=Er(s,a,l),s!==null?s.sibling:null);ua(a);break;case 19:var m=(s.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(tl(s,a,l,!1),h=(l&a.childLanes)!==0),m){if(h)return cw(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),J(Nn,Nn.current),h)break;return null;case 22:return a.lanes=0,tw(s,a,l,a.pendingProps);case 24:aa(a,jn,s.memoizedState.cache)}return Er(s,a,l)}function uw(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Bn=!0;else{if(!dg(s,l)&&(a.flags&128)===0)return Bn=!1,a3(s,a,l);Bn=(s.flags&131072)!==0}else Bn=!1,At&&(a.flags&1048576)!==0&&F1(a,kc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=lo(a.elementType),a.type=s,typeof s=="function")_m(s)?(h=fo(s,h),a.tag=1,a=rw(null,a,s,h,l)):(a.tag=0,a=rg(null,a,s,h,l));else{if(s!=null){var m=s.$$typeof;if(m===T){a.tag=11,a=JS(null,a,s,h,l);break e}else if(m===H){a.tag=14,a=QS(null,a,s,h,l);break e}}throw a=R(s)||s,Error(i(306,a,""))}}return a;case 0:return rg(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,m=fo(h,a.pendingProps),rw(s,a,h,m,l);case 3:e:{if(Oe(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var v=a.memoizedState;m=v.element,Mm(s,a),Oc(a,h,null,l);var k=a.memoizedState;if(h=k.cache,aa(a,jn,h),h!==v.cache&&Em(a,[jn],l,!0),Mc(),h=k.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:k.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=aw(s,a,h,l);break e}else if(h!==m){m=Ss(Error(i(424)),a),Ec(m),a=aw(s,a,h,l);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,nn=Es(s.firstChild),ui=a,At=!0,sa=null,Cs=!0,l=tS(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(so(),h===m){a=Er(s,a,l);break e}di(s,a,h,l)}a=a.child}return a;case 26:return cd(s,a),s===null?(l=Sx(a.type,null,a.pendingProps,null))?a.memoizedState=l:At||(l=a.type,s=a.pendingProps,h=Ed(ve.current).createElement(l),h[Xe]=a,h[Ce]=s,fi(h,l,s),ot(h),a.stateNode=h):a.memoizedState=Sx(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return ct(a),s===null&&At&&(h=a.stateNode=vx(a.type,a.pendingProps,ve.current),ui=a,Cs=!0,m=nn,ya(a.type)?(qg=m,nn=Es(h.firstChild)):nn=m),di(s,a,a.pendingProps.children,l),cd(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&At&&((m=h=nn)&&(h=I3(h,a.type,a.pendingProps,Cs),h!==null?(a.stateNode=h,ui=a,nn=Es(h.firstChild),Cs=!1,m=!0):m=!1),m||ra(a)),ct(a),m=a.type,v=a.pendingProps,k=s!==null?s.memoizedProps:null,h=v.children,zg(m,v)?h=null:k!==null&&zg(m,k)&&(a.flags|=32),a.memoizedState!==null&&(m=$m(s,a,ZM,null,null,l),Qc._currentValue=m),cd(s,a),di(s,a,h,l),a.child;case 6:return s===null&&At&&((s=l=nn)&&(l=B3(l,a.pendingProps,Cs),l!==null?(a.stateNode=l,ui=a,nn=null,s=!0):s=!1),s||ra(a)),null;case 13:return ow(s,a,l);case 4:return Oe(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=uo(a,null,h,l):di(s,a,h,l),a.child;case 11:return JS(s,a,a.type,a.pendingProps,l);case 7:return di(s,a,a.pendingProps,l),a.child;case 8:return di(s,a,a.pendingProps.children,l),a.child;case 12:return di(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,aa(a,a.type,h.value),di(s,a,h.children,l),a.child;case 9:return m=a.type._context,h=a.pendingProps.children,ao(a),m=hi(m),h=h(m),a.flags|=1,di(s,a,h,l),a.child;case 14:return QS(s,a,a.type,a.pendingProps,l);case 15:return ew(s,a,a.type,a.pendingProps,l);case 19:return cw(s,a,l);case 31:return r3(s,a,l);case 22:return tw(s,a,l,a.pendingProps);case 24:return ao(a),h=hi(jn),s===null?(m=Rm(),m===null&&(m=Qt,v=Tm(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=l),m=v),a.memoizedState={parent:h,cache:m},Lm(a),aa(a,jn,m)):((s.lanes&l)!==0&&(Mm(s,a),Oc(a,null,null,l),Mc()),m=s.memoizedState,v=a.memoizedState,m.parent!==h?(m={parent:h,cache:h},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),aa(a,jn,h)):(h=v.cache,aa(a,jn,h),h!==m.cache&&Em(a,[jn],l,!0))),di(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Tr(s){s.flags|=4}function fg(s,a,l,h,m){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(Bw())s.flags|=8192;else throw co=Vh,Nm}else s.flags&=-16777217}function hw(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Ex(a))if(Bw())s.flags|=8192;else throw co=Vh,Nm}function hd(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Ke():536870912,s.lanes|=a,fl|=a)}function $c(s,a){if(!At)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function sn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,h=0;if(a)for(var m=s.child;m!==null;)l|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)l|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=l,a}function o3(s,a,l){var h=a.pendingProps;switch(Sm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(a),null;case 1:return sn(a),null;case 3:return l=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),xr(jn),Ne(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(el(a)?Tr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,xm())),sn(a),null;case 26:var m=a.type,v=a.memoizedState;return s===null?(Tr(a),v!==null?(sn(a),hw(a,v)):(sn(a),fg(a,m,null,h,l))):v?v!==s.memoizedState?(Tr(a),sn(a),hw(a,v)):(sn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Tr(a),sn(a),fg(a,m,s,h,l)),null;case 27:if(Ze(a),l=ve.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Tr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return sn(a),null}s=ce.current,el(a)?W1(a):(s=vx(m,h,l),a.stateNode=s,Tr(a))}return sn(a),null;case 5:if(Ze(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Tr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return sn(a),null}if(v=ce.current,el(a))W1(a);else{var k=Ed(ve.current);switch(v){case 1:v=k.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=k.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=k.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=k.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=k.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?k.createElement("select",{is:h.is}):k.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?k.createElement(m,{is:h.is}):k.createElement(m)}}v[Xe]=a,v[Ce]=h;e:for(k=a.child;k!==null;){if(k.tag===5||k.tag===6)v.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===a)break e;for(;k.sibling===null;){if(k.return===null||k.return===a)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}a.stateNode=v;e:switch(fi(v,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Tr(a)}}return sn(a),fg(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Tr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=ve.current,el(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,m=ui,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Xe]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||ox(s.nodeValue,l)),s||ra(a,!0)}else s=Ed(s).createTextNode(h),s[Xe]=a,a.stateNode=s}return sn(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(h=el(a),l!==null){if(s===null){if(!h)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Xe]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),s=!1}else l=xm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(rs(a),a):(rs(a),null);if((a.flags&128)!==0)throw Error(i(558))}return sn(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=el(a),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Xe]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),m=!1}else m=xm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(rs(a),a):(rs(a),null)}return rs(a),(a.flags&128)!==0?(a.lanes=l,a):(l=h!==null,s=s!==null&&s.memoizedState!==null,l&&(h=a.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==m&&(h.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),hd(a,a.updateQueue),sn(a),null);case 4:return Ne(),s===null&&jg(a.stateNode.containerInfo),sn(a),null;case 10:return xr(a.type),sn(a),null;case 19:if(V(Nn),h=a.memoizedState,h===null)return sn(a),null;if(m=(a.flags&128)!==0,v=h.rendering,v===null)if(m)$c(h,!1);else{if(Sn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=Jh(s),v!==null){for(a.flags|=128,$c(h,!1),s=v.updateQueue,a.updateQueue=s,hd(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)$1(l,s),l=l.sibling;return J(Nn,Nn.current&1|2),At&&Sr(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&ft()>gd&&(a.flags|=128,m=!0,$c(h,!1),a.lanes=4194304)}else{if(!m)if(s=Jh(v),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,hd(a,s),$c(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!At)return sn(a),null}else 2*ft()-h.renderingStartTime>gd&&l!==536870912&&(a.flags|=128,m=!0,$c(h,!1),a.lanes=4194304);h.isBackwards?(v.sibling=a.child,a.child=v):(s=h.last,s!==null?s.sibling=v:a.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=ft(),s.sibling=null,l=Nn.current,J(Nn,m?l&1|2:l&1),At&&Sr(a,h.treeForkCount),s):(sn(a),null);case 22:case 23:return rs(a),Im(),h=a.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(l&536870912)!==0&&(a.flags&128)===0&&(sn(a),a.subtreeFlags&6&&(a.flags|=8192)):sn(a),l=a.updateQueue,l!==null&&hd(a,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==l&&(a.flags|=2048),s!==null&&V(oo),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),xr(jn),sn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function l3(s,a){switch(Sm(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return xr(jn),Ne(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ze(a),null;case 31:if(a.memoizedState!==null){if(rs(a),a.alternate===null)throw Error(i(340));so()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(rs(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));so()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return V(Nn),null;case 4:return Ne(),null;case 10:return xr(a.type),null;case 22:case 23:return rs(a),Im(),s!==null&&V(oo),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return xr(jn),null;case 25:return null;default:return null}}function dw(s,a){switch(Sm(a),a.tag){case 3:xr(jn),Ne();break;case 26:case 27:case 5:Ze(a);break;case 4:Ne();break;case 31:a.memoizedState!==null&&rs(a);break;case 13:rs(a);break;case 19:V(Nn);break;case 10:xr(a.type);break;case 22:case 23:rs(a),Im(),s!==null&&V(oo);break;case 24:xr(jn)}}function zc(s,a){try{var l=a.updateQueue,h=l!==null?l.lastEffect:null;if(h!==null){var m=h.next;l=m;do{if((l.tag&s)===s){h=void 0;var v=l.create,k=l.inst;h=v(),k.destroy=h}l=l.next}while(l!==m)}}catch(I){Wt(a,a.return,I)}}function da(s,a,l){try{var h=a.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var v=m.next;h=v;do{if((h.tag&s)===s){var k=h.inst,I=k.destroy;if(I!==void 0){k.destroy=void 0,m=a;var G=l,ne=I;try{ne()}catch(he){Wt(m,G,he)}}}h=h.next}while(h!==v)}}catch(he){Wt(a,a.return,he)}}function fw(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{iS(a,l)}catch(h){Wt(s,s.return,h)}}}function pw(s,a,l){l.props=fo(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){Wt(s,a,h)}}function Hc(s,a){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof l=="function"?s.refCleanup=l(h):l.current=h}}catch(m){Wt(s,a,m)}}function er(s,a){var l=s.ref,h=s.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(m){Wt(s,a,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){Wt(s,a,m)}else l.current=null}function mw(s){var a=s.type,l=s.memoizedProps,h=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&h.focus();break e;case"img":l.src?h.src=l.src:l.srcSet&&(h.srcset=l.srcSet)}}catch(m){Wt(s,s.return,m)}}function pg(s,a,l){try{var h=s.stateNode;N3(h,s.type,l,a),h[Ce]=a}catch(m){Wt(s,s.return,m)}}function gw(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ya(s.type)||s.tag===4}function mg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||gw(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ya(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function gg(s,a,l){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(s),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Ee));else if(h!==4&&(h===27&&ya(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(gg(s,a,l),s=s.sibling;s!==null;)gg(s,a,l),s=s.sibling}function dd(s,a,l){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(h!==4&&(h===27&&ya(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(dd(s,a,l),s=s.sibling;s!==null;)dd(s,a,l),s=s.sibling}function _w(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);fi(a,h,l),a[Xe]=s,a[Ce]=l}catch(v){Wt(s,s.return,v)}}var Ar=!1,Pn=!1,_g=!1,vw=typeof WeakSet=="function"?WeakSet:Set,Zn=null;function c3(s,a){if(s=s.containerInfo,Pg=Od,s=N1(s),um(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var h=l.getSelection&&l.getSelection();if(h&&h.rangeCount!==0){l=h.anchorNode;var m=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var k=0,I=-1,G=-1,ne=0,he=0,ge=s,se=null;t:for(;;){for(var oe;ge!==l||m!==0&&ge.nodeType!==3||(I=k+m),ge!==v||h!==0&&ge.nodeType!==3||(G=k+h),ge.nodeType===3&&(k+=ge.nodeValue.length),(oe=ge.firstChild)!==null;)se=ge,ge=oe;for(;;){if(ge===s)break t;if(se===l&&++ne===m&&(I=k),se===v&&++he===h&&(G=k),(oe=ge.nextSibling)!==null)break;ge=se,se=ge.parentNode}ge=oe}l=I===-1||G===-1?null:{start:I,end:G}}else l=null}l=l||{start:0,end:0}}else l=null;for($g={focusedElem:s,selectionRange:l},Od=!1,Zn=a;Zn!==null;)if(a=Zn,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Zn=s;else for(;Zn!==null;){switch(a=Zn,v=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)m=s[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,l=a,m=v.memoizedProps,v=v.memoizedState,h=l.stateNode;try{var Pe=fo(l.type,m);s=h.getSnapshotBeforeUpdate(Pe,v),h.__reactInternalSnapshotBeforeUpdate=s}catch(Qe){Wt(l,l.return,Qe)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Fg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Fg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,Zn=s;break}Zn=a.return}}function yw(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Nr(s,l),h&4&&zc(5,l);break;case 1:if(Nr(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(k){Wt(l,l.return,k)}else{var m=fo(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(k){Wt(l,l.return,k)}}h&64&&fw(l),h&512&&Hc(l,l.return);break;case 3:if(Nr(s,l),h&64&&(s=l.updateQueue,s!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{iS(s,a)}catch(k){Wt(l,l.return,k)}}break;case 27:a===null&&h&4&&_w(l);case 26:case 5:Nr(s,l),a===null&&h&4&&mw(l),h&512&&Hc(l,l.return);break;case 12:Nr(s,l);break;case 31:Nr(s,l),h&4&&ww(s,l);break;case 13:Nr(s,l),h&4&&xw(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=v3.bind(null,l),P3(s,l))));break;case 22:if(h=l.memoizedState!==null||Ar,!h){a=a!==null&&a.memoizedState!==null||Pn,m=Ar;var v=Pn;Ar=h,(Pn=a)&&!v?Lr(s,l,(l.subtreeFlags&8772)!==0):Nr(s,l),Ar=m,Pn=v}break;case 30:break;default:Nr(s,l)}}function bw(s){var a=s.alternate;a!==null&&(s.alternate=null,bw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&He(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var fn=null,Fi=!1;function Rr(s,a,l){for(l=l.child;l!==null;)Sw(s,a,l),l=l.sibling}function Sw(s,a,l){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(Xn,l)}catch{}switch(l.tag){case 26:Pn||er(l,a),Rr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Pn||er(l,a);var h=fn,m=Fi;ya(l.type)&&(fn=l.stateNode,Fi=!1),Rr(s,a,l),Xc(l.stateNode),fn=h,Fi=m;break;case 5:Pn||er(l,a);case 6:if(h=fn,m=Fi,fn=null,Rr(s,a,l),fn=h,Fi=m,fn!==null)if(Fi)try{(fn.nodeType===9?fn.body:fn.nodeName==="HTML"?fn.ownerDocument.body:fn).removeChild(l.stateNode)}catch(v){Wt(l,a,v)}else try{fn.removeChild(l.stateNode)}catch(v){Wt(l,a,v)}break;case 18:fn!==null&&(Fi?(s=fn,fx(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Sl(s)):fx(fn,l.stateNode));break;case 4:h=fn,m=Fi,fn=l.stateNode.containerInfo,Fi=!0,Rr(s,a,l),fn=h,Fi=m;break;case 0:case 11:case 14:case 15:da(2,l,a),Pn||da(4,l,a),Rr(s,a,l);break;case 1:Pn||(er(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&pw(l,a,h)),Rr(s,a,l);break;case 21:Rr(s,a,l);break;case 22:Pn=(h=Pn)||l.memoizedState!==null,Rr(s,a,l),Pn=h;break;default:Rr(s,a,l)}}function ww(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Sl(s)}catch(l){Wt(a,a.return,l)}}}function xw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Sl(s)}catch(l){Wt(a,a.return,l)}}function u3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new vw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new vw),a;default:throw Error(i(435,s.tag))}}function fd(s,a){var l=u3(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var m=y3.bind(null,s,h);h.then(m,m)}})}function Ui(s,a){var l=a.deletions;if(l!==null)for(var h=0;h<l.length;h++){var m=l[h],v=s,k=a,I=k;e:for(;I!==null;){switch(I.tag){case 27:if(ya(I.type)){fn=I.stateNode,Fi=!1;break e}break;case 5:fn=I.stateNode,Fi=!1;break e;case 3:case 4:fn=I.stateNode.containerInfo,Fi=!0;break e}I=I.return}if(fn===null)throw Error(i(160));Sw(v,k,m),fn=null,Fi=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Cw(a,s),a=a.sibling}var Hs=null;function Cw(s,a){var l=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ui(a,s),Wi(s),h&4&&(da(3,s,s.return),zc(3,s),da(5,s,s.return));break;case 1:Ui(a,s),Wi(s),h&512&&(Pn||l===null||er(l,l.return)),h&64&&Ar&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?h:l.concat(h))));break;case 26:var m=Hs;if(Ui(a,s),Wi(s),h&512&&(Pn||l===null||er(l,l.return)),h&4){var v=l!==null?l.memoizedState:null;if(h=s.memoizedState,l===null)if(h===null)if(s.stateNode===null){e:{h=s.type,l=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":v=m.getElementsByTagName("title")[0],(!v||v[Si]||v[Xe]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(h),m.head.insertBefore(v,m.querySelector("head > title"))),fi(v,h,l),v[Xe]=s,ot(v),h=v;break e;case"link":var k=Cx("link","href",m).get(h+(l.href||""));if(k){for(var I=0;I<k.length;I++)if(v=k[I],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){k.splice(I,1);break t}}v=m.createElement(h),fi(v,h,l),m.head.appendChild(v);break;case"meta":if(k=Cx("meta","content",m).get(h+(l.content||""))){for(I=0;I<k.length;I++)if(v=k[I],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){k.splice(I,1);break t}}v=m.createElement(h),fi(v,h,l),m.head.appendChild(v);break;default:throw Error(i(468,h))}v[Xe]=s,ot(v),h=v}s.stateNode=h}else kx(m,s.type,s.stateNode);else s.stateNode=xx(m,h,s.memoizedProps);else v!==h?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,h===null?kx(m,s.type,s.stateNode):xx(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&pg(s,s.memoizedProps,l.memoizedProps)}break;case 27:Ui(a,s),Wi(s),h&512&&(Pn||l===null||er(l,l.return)),l!==null&&h&4&&pg(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Ui(a,s),Wi(s),h&512&&(Pn||l===null||er(l,l.return)),s.flags&32){m=s.stateNode;try{et(m,"")}catch(Pe){Wt(s,s.return,Pe)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,pg(s,m,l!==null?l.memoizedProps:m)),h&1024&&(_g=!0);break;case 6:if(Ui(a,s),Wi(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,l=s.stateNode;try{l.nodeValue=h}catch(Pe){Wt(s,s.return,Pe)}}break;case 3:if(Rd=null,m=Hs,Hs=Td(a.containerInfo),Ui(a,s),Hs=m,Wi(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{Sl(a.containerInfo)}catch(Pe){Wt(s,s.return,Pe)}_g&&(_g=!1,kw(s));break;case 4:h=Hs,Hs=Td(s.stateNode.containerInfo),Ui(a,s),Wi(s),Hs=h;break;case 12:Ui(a,s),Wi(s);break;case 31:Ui(a,s),Wi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,fd(s,h)));break;case 13:Ui(a,s),Wi(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(md=ft()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,fd(s,h)));break;case 22:m=s.memoizedState!==null;var G=l!==null&&l.memoizedState!==null,ne=Ar,he=Pn;if(Ar=ne||m,Pn=he||G,Ui(a,s),Pn=he,Ar=ne,Wi(s),h&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||G||Ar||Pn||po(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){G=l=a;try{if(v=G.stateNode,m)k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{I=G.stateNode;var ge=G.memoizedProps.style,se=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;I.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Pe){Wt(G,G.return,Pe)}}}else if(a.tag===6){if(l===null){G=a;try{G.stateNode.nodeValue=m?"":G.memoizedProps}catch(Pe){Wt(G,G.return,Pe)}}}else if(a.tag===18){if(l===null){G=a;try{var oe=G.stateNode;m?px(oe,!0):px(G.stateNode,!1)}catch(Pe){Wt(G,G.return,Pe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=s.updateQueue,h!==null&&(l=h.retryQueue,l!==null&&(h.retryQueue=null,fd(s,l))));break;case 19:Ui(a,s),Wi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,fd(s,h)));break;case 30:break;case 21:break;default:Ui(a,s),Wi(s)}}function Wi(s){var a=s.flags;if(a&2){try{for(var l,h=s.return;h!==null;){if(gw(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,v=mg(s);dd(s,v,m);break;case 5:var k=l.stateNode;l.flags&32&&(et(k,""),l.flags&=-33);var I=mg(s);dd(s,I,k);break;case 3:case 4:var G=l.stateNode.containerInfo,ne=mg(s);gg(s,ne,G);break;default:throw Error(i(161))}}catch(he){Wt(s,s.return,he)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function kw(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;kw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Nr(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)yw(s,a.alternate,a),a=a.sibling}function po(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:da(4,a,a.return),po(a);break;case 1:er(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&pw(a,a.return,l),po(a);break;case 27:Xc(a.stateNode);case 26:case 5:er(a,a.return),po(a);break;case 22:a.memoizedState===null&&po(a);break;case 30:po(a);break;default:po(a)}s=s.sibling}}function Lr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,m=s,v=a,k=v.flags;switch(v.tag){case 0:case 11:case 15:Lr(m,v,l),zc(4,v);break;case 1:if(Lr(m,v,l),h=v,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ne){Wt(h,h.return,ne)}if(h=v,m=h.updateQueue,m!==null){var I=h.stateNode;try{var G=m.shared.hiddenCallbacks;if(G!==null)for(m.shared.hiddenCallbacks=null,m=0;m<G.length;m++)nS(G[m],I)}catch(ne){Wt(h,h.return,ne)}}l&&k&64&&fw(v),Hc(v,v.return);break;case 27:_w(v);case 26:case 5:Lr(m,v,l),l&&h===null&&k&4&&mw(v),Hc(v,v.return);break;case 12:Lr(m,v,l);break;case 31:Lr(m,v,l),l&&k&4&&ww(m,v);break;case 13:Lr(m,v,l),l&&k&4&&xw(m,v);break;case 22:v.memoizedState===null&&Lr(m,v,l),Hc(v,v.return);break;case 30:break;default:Lr(m,v,l)}a=a.sibling}}function vg(s,a){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Tc(l))}function yg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Tc(s))}function Fs(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Ew(s,a,l,h),a=a.sibling}function Ew(s,a,l,h){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Fs(s,a,l,h),m&2048&&zc(9,a);break;case 1:Fs(s,a,l,h);break;case 3:Fs(s,a,l,h),m&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Tc(s)));break;case 12:if(m&2048){Fs(s,a,l,h),s=a.stateNode;try{var v=a.memoizedProps,k=v.id,I=v.onPostCommit;typeof I=="function"&&I(k,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(G){Wt(a,a.return,G)}}else Fs(s,a,l,h);break;case 31:Fs(s,a,l,h);break;case 13:Fs(s,a,l,h);break;case 23:break;case 22:v=a.stateNode,k=a.alternate,a.memoizedState!==null?v._visibility&2?Fs(s,a,l,h):Fc(s,a):v._visibility&2?Fs(s,a,l,h):(v._visibility|=2,ul(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),m&2048&&vg(k,a);break;case 24:Fs(s,a,l,h),m&2048&&yg(a.alternate,a);break;default:Fs(s,a,l,h)}}function ul(s,a,l,h,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=s,k=a,I=l,G=h,ne=k.flags;switch(k.tag){case 0:case 11:case 15:ul(v,k,I,G,m),zc(8,k);break;case 23:break;case 22:var he=k.stateNode;k.memoizedState!==null?he._visibility&2?ul(v,k,I,G,m):Fc(v,k):(he._visibility|=2,ul(v,k,I,G,m)),m&&ne&2048&&vg(k.alternate,k);break;case 24:ul(v,k,I,G,m),m&&ne&2048&&yg(k.alternate,k);break;default:ul(v,k,I,G,m)}a=a.sibling}}function Fc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=s,h=a,m=h.flags;switch(h.tag){case 22:Fc(l,h),m&2048&&vg(h.alternate,h);break;case 24:Fc(l,h),m&2048&&yg(h.alternate,h);break;default:Fc(l,h)}a=a.sibling}}var Uc=8192;function hl(s,a,l){if(s.subtreeFlags&Uc)for(s=s.child;s!==null;)Tw(s,a,l),s=s.sibling}function Tw(s,a,l){switch(s.tag){case 26:hl(s,a,l),s.flags&Uc&&s.memoizedState!==null&&X3(l,Hs,s.memoizedState,s.memoizedProps);break;case 5:hl(s,a,l);break;case 3:case 4:var h=Hs;Hs=Td(s.stateNode.containerInfo),hl(s,a,l),Hs=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Uc,Uc=16777216,hl(s,a,l),Uc=h):hl(s,a,l));break;default:hl(s,a,l)}}function Aw(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Wc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];Zn=h,Nw(h,s)}Aw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Rw(s),s=s.sibling}function Rw(s){switch(s.tag){case 0:case 11:case 15:Wc(s),s.flags&2048&&da(9,s,s.return);break;case 3:Wc(s);break;case 12:Wc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,pd(s)):Wc(s);break;default:Wc(s)}}function pd(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];Zn=h,Nw(h,s)}Aw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:da(8,a,a.return),pd(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,pd(a));break;default:pd(a)}s=s.sibling}}function Nw(s,a){for(;Zn!==null;){var l=Zn;switch(l.tag){case 0:case 11:case 15:da(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var h=l.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Tc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,Zn=h;else e:for(l=s;Zn!==null;){h=Zn;var m=h.sibling,v=h.return;if(bw(h),h===l){Zn=null;break e}if(m!==null){m.return=v,Zn=m;break e}Zn=v}}}var h3={getCacheForType:function(s){var a=hi(jn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return hi(jn).controller.signal}},d3=typeof WeakMap=="function"?WeakMap:Map,It=0,Qt=null,wt=null,Et=0,Ut=0,as=null,fa=!1,dl=!1,bg=!1,Mr=0,Sn=0,pa=0,mo=0,Sg=0,os=0,fl=0,qc=null,qi=null,wg=!1,md=0,Lw=0,gd=1/0,_d=null,ma=null,qn=0,ga=null,pl=null,Or=0,xg=0,Cg=null,Mw=null,Gc=0,kg=null;function ls(){return(It&2)!==0&&Et!==0?Et&-Et:E.T!==null?Lg():pe()}function Ow(){if(os===0)if((Et&536870912)===0||At){var s=vs;vs<<=1,(vs&3932160)===0&&(vs=262144),os=s}else os=536870912;return s=ss.current,s!==null&&(s.flags|=32),os}function Gi(s,a,l){(s===Qt&&(Ut===2||Ut===9)||s.cancelPendingCommit!==null)&&(ml(s,0),_a(s,Et,os,!1)),Nt(s,l),((It&2)===0||s!==Qt)&&(s===Qt&&((It&2)===0&&(mo|=l),Sn===4&&_a(s,Et,os,!1)),tr(s))}function Dw(s,a,l){if((It&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||fe(s,a),m=h?m3(s,a):Tg(s,a,!0),v=h;do{if(m===0){dl&&!h&&_a(s,a,0,!1);break}else{if(l=s.current.alternate,v&&!f3(l)){m=Tg(s,a,!1),v=!1;continue}if(m===2){if(v=a,s.errorRecoveryDisabledLanes&v)var k=0;else k=s.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){a=k;e:{var I=s;m=qc;var G=I.current.memoizedState.isDehydrated;if(G&&(ml(I,k).flags|=256),k=Tg(I,k,!1),k!==2){if(bg&&!G){I.errorRecoveryDisabledLanes|=v,mo|=v,m=4;break e}v=qi,qi=m,v!==null&&(qi===null?qi=v:qi.push.apply(qi,v))}m=k}if(v=!1,m!==2)continue}}if(m===1){ml(s,0),_a(s,a,0,!0);break}e:{switch(h=s,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:_a(h,a,os,!fa);break e;case 2:qi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=md+300-ft(),10<m)){if(_a(h,a,os,!fa),W(h,0,!0)!==0)break e;Or=a,h.timeoutHandle=hx(jw.bind(null,h,l,qi,_d,wg,a,os,mo,fl,fa,v,"Throttled",-0,0),m);break e}jw(h,l,qi,_d,wg,a,os,mo,fl,fa,v,null,-0,0)}}break}while(!0);tr(s)}function jw(s,a,l,h,m,v,k,I,G,ne,he,ge,se,oe){if(s.timeoutHandle=-1,ge=a.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ee},Tw(a,v,ge);var Pe=(v&62914560)===v?md-ft():(v&4194048)===v?Lw-ft():0;if(Pe=Z3(ge,Pe),Pe!==null){Or=v,s.cancelPendingCommit=Pe(Uw.bind(null,s,a,v,l,h,m,k,I,G,he,ge,null,se,oe)),_a(s,v,k,!ne);return}}Uw(s,a,v,l,h,m,k,I,G)}function f3(s){for(var a=s;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var h=0;h<l.length;h++){var m=l[h],v=m.getSnapshot;m=m.value;try{if(!ns(v(),m))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function _a(s,a,l,h){a&=~Sg,a&=~mo,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var m=a;0<m;){var v=31-Pt(m),k=1<<v;h[v]=-1,m&=~k}l!==0&&Me(s,l,a)}function vd(){return(It&6)===0?(Kc(0),!1):!0}function Eg(){if(wt!==null){if(Ut===0)var s=wt.return;else s=wt,wr=ro=null,Fm(s),rl=null,Rc=0,s=wt;for(;s!==null;)dw(s.alternate,s),s=s.return;wt=null}}function ml(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,O3(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Or=0,Eg(),Qt=s,wt=l=br(s.current,null),Et=a,Ut=0,as=null,fa=!1,dl=fe(s,a),bg=!1,fl=os=Sg=mo=pa=Sn=0,qi=qc=null,wg=!1,(a&8)!==0&&(a|=a&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=a;0<h;){var m=31-Pt(h),v=1<<m;a|=s[m],h&=~v}return Mr=a,$h(),l}function Iw(s,a){lt=null,E.H=Bc,a===sl||a===Kh?(a=J1(),Ut=3):a===Nm?(a=J1(),Ut=4):Ut=a===sg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,as=a,wt===null&&(Sn=1,od(s,Ss(a,s.current)))}function Bw(){var s=ss.current;return s===null?!0:(Et&4194048)===Et?ks===null:(Et&62914560)===Et||(Et&536870912)!==0?s===ks:!1}function Pw(){var s=E.H;return E.H=Bc,s===null?Bc:s}function $w(){var s=E.A;return E.A=h3,s}function yd(){Sn=4,fa||(Et&4194048)!==Et&&ss.current!==null||(dl=!0),(pa&134217727)===0&&(mo&134217727)===0||Qt===null||_a(Qt,Et,os,!1)}function Tg(s,a,l){var h=It;It|=2;var m=Pw(),v=$w();(Qt!==s||Et!==a)&&(_d=null,ml(s,a)),a=!1;var k=Sn;e:do try{if(Ut!==0&&wt!==null){var I=wt,G=as;switch(Ut){case 8:Eg(),k=6;break e;case 3:case 2:case 9:case 6:ss.current===null&&(a=!0);var ne=Ut;if(Ut=0,as=null,gl(s,I,G,ne),l&&dl){k=0;break e}break;default:ne=Ut,Ut=0,as=null,gl(s,I,G,ne)}}p3(),k=Sn;break}catch(he){Iw(s,he)}while(!0);return a&&s.shellSuspendCounter++,wr=ro=null,It=h,E.H=m,E.A=v,wt===null&&(Qt=null,Et=0,$h()),k}function p3(){for(;wt!==null;)zw(wt)}function m3(s,a){var l=It;It|=2;var h=Pw(),m=$w();Qt!==s||Et!==a?(_d=null,gd=ft()+500,ml(s,a)):dl=fe(s,a);e:do try{if(Ut!==0&&wt!==null){a=wt;var v=as;t:switch(Ut){case 1:Ut=0,as=null,gl(s,a,v,1);break;case 2:case 9:if(X1(v)){Ut=0,as=null,Hw(a);break}a=function(){Ut!==2&&Ut!==9||Qt!==s||(Ut=7),tr(s)},v.then(a,a);break e;case 3:Ut=7;break e;case 4:Ut=5;break e;case 7:X1(v)?(Ut=0,as=null,Hw(a)):(Ut=0,as=null,gl(s,a,v,7));break;case 5:var k=null;switch(wt.tag){case 26:k=wt.memoizedState;case 5:case 27:var I=wt;if(k?Ex(k):I.stateNode.complete){Ut=0,as=null;var G=I.sibling;if(G!==null)wt=G;else{var ne=I.return;ne!==null?(wt=ne,bd(ne)):wt=null}break t}}Ut=0,as=null,gl(s,a,v,5);break;case 6:Ut=0,as=null,gl(s,a,v,6);break;case 8:Eg(),Sn=6;break e;default:throw Error(i(462))}}g3();break}catch(he){Iw(s,he)}while(!0);return wr=ro=null,E.H=h,E.A=m,It=l,wt!==null?0:(Qt=null,Et=0,$h(),Sn)}function g3(){for(;wt!==null&&!we();)zw(wt)}function zw(s){var a=uw(s.alternate,s,Mr);s.memoizedProps=s.pendingProps,a===null?bd(s):wt=a}function Hw(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=sw(l,a,a.pendingProps,a.type,void 0,Et);break;case 11:a=sw(l,a,a.pendingProps,a.type.render,a.ref,Et);break;case 5:Fm(a);default:dw(l,a),a=wt=$1(a,Mr),a=uw(l,a,Mr)}s.memoizedProps=s.pendingProps,a===null?bd(s):wt=a}function gl(s,a,l,h){wr=ro=null,Fm(a),rl=null,Rc=0;var m=a.return;try{if(s3(s,m,a,l,Et)){Sn=1,od(s,Ss(l,s.current)),wt=null;return}}catch(v){if(m!==null)throw wt=m,v;Sn=1,od(s,Ss(l,s.current)),wt=null;return}a.flags&32768?(At||h===1?s=!0:dl||(Et&536870912)!==0?s=!1:(fa=s=!0,(h===2||h===9||h===3||h===6)&&(h=ss.current,h!==null&&h.tag===13&&(h.flags|=16384))),Fw(a,s)):bd(a)}function bd(s){var a=s;do{if((a.flags&32768)!==0){Fw(a,fa);return}s=a.return;var l=o3(a.alternate,a,Mr);if(l!==null){wt=l;return}if(a=a.sibling,a!==null){wt=a;return}wt=a=s}while(a!==null);Sn===0&&(Sn=5)}function Fw(s,a){do{var l=l3(s.alternate,s);if(l!==null){l.flags&=32767,wt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){wt=s;return}wt=s=l}while(s!==null);Sn=6,wt=null}function Uw(s,a,l,h,m,v,k,I,G){s.cancelPendingCommit=null;do Sd();while(qn!==0);if((It&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(v=a.lanes|a.childLanes,v|=mm,Be(s,l,v,k,I,G),s===Qt&&(wt=Qt=null,Et=0),pl=a,ga=s,Or=l,xg=v,Cg=m,Mw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,b3(de,function(){return Vw(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=E.T,E.T=null,m=L.p,L.p=2,k=It,It|=4;try{c3(s,a,l)}finally{It=k,L.p=m,E.T=h}}qn=1,Ww(),qw(),Gw()}}function Ww(){if(qn===1){qn=0;var s=ga,a=pl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var h=L.p;L.p=2;var m=It;It|=4;try{Cw(a,s);var v=$g,k=N1(s.containerInfo),I=v.focusedElem,G=v.selectionRange;if(k!==I&&I&&I.ownerDocument&&R1(I.ownerDocument.documentElement,I)){if(G!==null&&um(I)){var ne=G.start,he=G.end;if(he===void 0&&(he=ne),"selectionStart"in I)I.selectionStart=ne,I.selectionEnd=Math.min(he,I.value.length);else{var ge=I.ownerDocument||document,se=ge&&ge.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Pe=I.textContent.length,Qe=Math.min(G.start,Pe),Yt=G.end===void 0?Qe:Math.min(G.end,Pe);!oe.extend&&Qe>Yt&&(k=Yt,Yt=Qe,Qe=k);var Z=A1(I,Qe),Y=A1(I,Yt);if(Z&&Y&&(oe.rangeCount!==1||oe.anchorNode!==Z.node||oe.anchorOffset!==Z.offset||oe.focusNode!==Y.node||oe.focusOffset!==Y.offset)){var te=ge.createRange();te.setStart(Z.node,Z.offset),oe.removeAllRanges(),Qe>Yt?(oe.addRange(te),oe.extend(Y.node,Y.offset)):(te.setEnd(Y.node,Y.offset),oe.addRange(te))}}}}for(ge=[],oe=I;oe=oe.parentNode;)oe.nodeType===1&&ge.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<ge.length;I++){var me=ge[I];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}Od=!!Pg,$g=Pg=null}finally{It=m,L.p=h,E.T=l}}s.current=a,qn=2}}function qw(){if(qn===2){qn=0;var s=ga,a=pl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var h=L.p;L.p=2;var m=It;It|=4;try{yw(s,a.alternate,a)}finally{It=m,L.p=h,E.T=l}}qn=3}}function Gw(){if(qn===4||qn===3){qn=0,$e();var s=ga,a=pl,l=Or,h=Mw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?qn=5:(qn=0,pl=ga=null,Kw(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ma=null),On(l),a=a.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(Xn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=E.T,m=L.p,L.p=2,E.T=null;try{for(var v=s.onRecoverableError,k=0;k<h.length;k++){var I=h[k];v(I.value,{componentStack:I.stack})}}finally{E.T=a,L.p=m}}(Or&3)!==0&&Sd(),tr(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===kg?Gc++:(Gc=0,kg=s):Gc=0,Kc(0)}}function Kw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Tc(a)))}function Sd(){return Ww(),qw(),Gw(),Vw()}function Vw(){if(qn!==5)return!1;var s=ga,a=xg;xg=0;var l=On(Or),h=E.T,m=L.p;try{L.p=32>l?32:l,E.T=null,l=Cg,Cg=null;var v=ga,k=Or;if(qn=0,pl=ga=null,Or=0,(It&6)!==0)throw Error(i(331));var I=It;if(It|=4,Rw(v.current),Ew(v,v.current,k,l),It=I,Kc(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Xn,v)}catch{}return!0}finally{L.p=m,E.T=h,Kw(s,a)}}function Yw(s,a,l){a=Ss(l,a),a=ig(s.stateNode,a,2),s=ca(s,a,2),s!==null&&(Nt(s,2),tr(s))}function Wt(s,a,l){if(s.tag===3)Yw(s,s,l);else for(;a!==null;){if(a.tag===3){Yw(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ma===null||!ma.has(h))){s=Ss(l,s),l=XS(2),h=ca(a,l,2),h!==null&&(ZS(l,h,a,s),Nt(h,2),tr(h));break}}a=a.return}}function Ag(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new d3;var m=new Set;h.set(a,m)}else m=h.get(a),m===void 0&&(m=new Set,h.set(a,m));m.has(l)||(bg=!0,m.add(l),s=_3.bind(null,s,a,l),a.then(s,s))}function _3(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,Qt===s&&(Et&l)===l&&(Sn===4||Sn===3&&(Et&62914560)===Et&&300>ft()-md?(It&2)===0&&ml(s,0):Sg|=l,fl===Et&&(fl=0)),tr(s)}function Xw(s,a){a===0&&(a=Ke()),s=no(s,a),s!==null&&(Nt(s,a),tr(s))}function v3(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),Xw(s,l)}function y3(s,a){var l=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(l=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),Xw(s,l)}function b3(s,a){return je(s,a)}var wd=null,_l=null,Rg=!1,xd=!1,Ng=!1,va=0;function tr(s){s!==_l&&s.next===null&&(_l===null?wd=_l=s:_l=_l.next=s),xd=!0,Rg||(Rg=!0,w3())}function Kc(s,a){if(!Ng&&xd){Ng=!0;do for(var l=!1,h=wd;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var v=0;else{var k=h.suspendedLanes,I=h.pingedLanes;v=(1<<31-Pt(42|s)+1)-1,v&=m&~(k&~I),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,ex(h,v))}else v=Et,v=W(h,h===Qt?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||fe(h,v)||(l=!0,ex(h,v));h=h.next}while(l);Ng=!1}}function S3(){Zw()}function Zw(){xd=Rg=!1;var s=0;va!==0&&M3()&&(s=va);for(var a=ft(),l=null,h=wd;h!==null;){var m=h.next,v=Jw(h,a);v===0?(h.next=null,l===null?wd=m:l.next=m,m===null&&(_l=l)):(l=h,(s!==0||(v&3)!==0)&&(xd=!0)),h=m}qn!==0&&qn!==5||Kc(s),va!==0&&(va=0)}function Jw(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var k=31-Pt(v),I=1<<k,G=m[k];G===-1?((I&l)===0||(I&h)!==0)&&(m[k]=be(I,a)):G<=a&&(s.expiredLanes|=I),v&=~I}if(a=Qt,l=Et,l=W(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(Ut===2||Ut===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&dt(h),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||fe(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(h!==null&&dt(h),On(l)){case 2:case 8:l=re;break;case 32:l=de;break;case 268435456:l=Te;break;default:l=de}return h=Qw.bind(null,s),l=je(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&dt(h),s.callbackPriority=2,s.callbackNode=null,2}function Qw(s,a){if(qn!==0&&qn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(Sd()&&s.callbackNode!==l)return null;var h=Et;return h=W(s,s===Qt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(Dw(s,h,a),Jw(s,ft()),s.callbackNode!=null&&s.callbackNode===l?Qw.bind(null,s):null)}function ex(s,a){if(Sd())return null;Dw(s,a,!0)}function w3(){D3(function(){(It&6)!==0?je(An,S3):Zw()})}function Lg(){if(va===0){var s=nl;s===0&&(s=Rn,Rn<<=1,(Rn&261888)===0&&(Rn=256)),va=s}return va}function tx(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:ta(""+s)}function nx(s,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,s.id&&l.setAttribute("form",s.id),a.parentNode.insertBefore(l,a),s=new FormData(s),l.parentNode.removeChild(l),s}function x3(s,a,l,h,m){if(a==="submit"&&l&&l.stateNode===m){var v=tx((m[Ce]||null).action),k=h.submitter;k&&(a=(a=k[Ce]||null)?tx(a.formAction):k.getAttribute("formAction"),a!==null&&(v=a,k=null));var I=new jh("action","action",null,h,m);s.push({event:I,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(va!==0){var G=k?nx(m,k):new FormData(m);Zm(l,{pending:!0,data:G,method:m.method,action:v},null,G)}}else typeof v=="function"&&(I.preventDefault(),G=k?nx(m,k):new FormData(m),Zm(l,{pending:!0,data:G,method:m.method,action:v},v,G))},currentTarget:m}]})}}for(var Mg=0;Mg<pm.length;Mg++){var Og=pm[Mg],C3=Og.toLowerCase(),k3=Og[0].toUpperCase()+Og.slice(1);zs(C3,"on"+k3)}zs(O1,"onAnimationEnd"),zs(D1,"onAnimationIteration"),zs(j1,"onAnimationStart"),zs("dblclick","onDoubleClick"),zs("focusin","onFocus"),zs("focusout","onBlur"),zs(HM,"onTransitionRun"),zs(FM,"onTransitionStart"),zs(UM,"onTransitionCancel"),zs(I1,"onTransitionEnd"),ye("onMouseEnter",["mouseout","mouseover"]),ye("onMouseLeave",["mouseout","mouseover"]),ye("onPointerEnter",["pointerout","pointerover"]),ye("onPointerLeave",["pointerout","pointerover"]),hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vc="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(" "),E3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vc));function ix(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var h=s[l],m=h.event;h=h.listeners;e:{var v=void 0;if(a)for(var k=h.length-1;0<=k;k--){var I=h[k],G=I.instance,ne=I.currentTarget;if(I=I.listener,G!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(he){Ph(he)}m.currentTarget=null,v=G}else for(k=0;k<h.length;k++){if(I=h[k],G=I.instance,ne=I.currentTarget,I=I.listener,G!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(he){Ph(he)}m.currentTarget=null,v=G}}}}function xt(s,a){var l=a[Gt];l===void 0&&(l=a[Gt]=new Set);var h=s+"__bubble";l.has(h)||(sx(a,s,2,!1),l.add(h))}function Dg(s,a,l){var h=0;a&&(h|=4),sx(l,s,h,a)}var Cd="_reactListening"+Math.random().toString(36).slice(2);function jg(s){if(!s[Cd]){s[Cd]=!0,Ht.forEach(function(l){l!=="selectionchange"&&(E3.has(l)||Dg(l,!1,s),Dg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Cd]||(a[Cd]=!0,Dg("selectionchange",!1,a))}}function sx(s,a,l,h){switch(Ox(a)){case 2:var m=e6;break;case 8:m=t6;break;default:m=Xg}l=m.bind(null,a,l,s),m=void 0,!tm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(a,l,{capture:!0,passive:m}):s.addEventListener(a,l,!0):m!==void 0?s.addEventListener(a,l,{passive:m}):s.addEventListener(a,l,!1)}function Ig(s,a,l,h,m){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var k=h.tag;if(k===3||k===4){var I=h.stateNode.containerInfo;if(I===m)break;if(k===4)for(k=h.return;k!==null;){var G=k.tag;if((G===3||G===4)&&k.stateNode.containerInfo===m)return;k=k.return}for(;I!==null;){if(k=U(I),k===null)return;if(G=k.tag,G===5||G===6||G===26||G===27){h=v=k;continue e}I=I.parentNode}}h=h.return}Lh(function(){var ne=v,he=at(l),ge=[];e:{var se=B1.get(s);if(se!==void 0){var oe=jh,Pe=s;switch(s){case"keypress":if(Oh(l)===0)break e;case"keydown":case"keyup":oe=yM;break;case"focusin":Pe="focus",oe=rm;break;case"focusout":Pe="blur",oe=rm;break;case"beforeblur":case"afterblur":oe=rm;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=d1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=oM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=wM;break;case O1:case D1:case j1:oe=uM;break;case I1:oe=CM;break;case"scroll":case"scrollend":oe=rM;break;case"wheel":oe=EM;break;case"copy":case"cut":case"paste":oe=dM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=p1;break;case"toggle":case"beforetoggle":oe=AM}var Qe=(a&4)!==0,Yt=!Qe&&(s==="scroll"||s==="scrollend"),Z=Qe?se!==null?se+"Capture":null:se;Qe=[];for(var Y=ne,te;Y!==null;){var me=Y;if(te=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||te===null||Z===null||(me=gc(Y,Z),me!=null&&Qe.push(Yc(Y,me,te))),Yt)break;Y=Y.return}0<Qe.length&&(se=new oe(se,Pe,null,l,he),ge.push({event:se,listeners:Qe}))}}if((a&7)===0){e:{if(se=s==="mouseover"||s==="pointerover",oe=s==="mouseout"||s==="pointerout",se&&l!==Fe&&(Pe=l.relatedTarget||l.fromElement)&&(U(Pe)||Pe[zt]))break e;if((oe||se)&&(se=he.window===he?he:(se=he.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Pe=l.relatedTarget||l.toElement,oe=ne,Pe=Pe?U(Pe):null,Pe!==null&&(Yt=o(Pe),Qe=Pe.tag,Pe!==Yt||Qe!==5&&Qe!==27&&Qe!==6)&&(Pe=null)):(oe=null,Pe=ne),oe!==Pe)){if(Qe=d1,me="onMouseLeave",Z="onMouseEnter",Y="mouse",(s==="pointerout"||s==="pointerover")&&(Qe=p1,me="onPointerLeave",Z="onPointerEnter",Y="pointer"),Yt=oe==null?se:Ae(oe),te=Pe==null?se:Ae(Pe),se=new Qe(me,Y+"leave",oe,l,he),se.target=Yt,se.relatedTarget=te,me=null,U(he)===ne&&(Qe=new Qe(Z,Y+"enter",Pe,l,he),Qe.target=te,Qe.relatedTarget=Yt,me=Qe),Yt=me,oe&&Pe)t:{for(Qe=T3,Z=oe,Y=Pe,te=0,me=Z;me;me=Qe(me))te++;me=0;for(var Ve=Y;Ve;Ve=Qe(Ve))me++;for(;0<te-me;)Z=Qe(Z),te--;for(;0<me-te;)Y=Qe(Y),me--;for(;te--;){if(Z===Y||Y!==null&&Z===Y.alternate){Qe=Z;break t}Z=Qe(Z),Y=Qe(Y)}Qe=null}else Qe=null;oe!==null&&rx(ge,se,oe,Qe,!1),Pe!==null&&Yt!==null&&rx(ge,Yt,Pe,Qe,!0)}}e:{if(se=ne?Ae(ne):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var Ot=w1;else if(b1(se))if(x1)Ot=PM;else{Ot=IM;var Ue=jM}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&ea(ne.elementType)&&(Ot=w1):Ot=BM;if(Ot&&(Ot=Ot(s,ne))){S1(ge,Ot,l,he);break e}Ue&&Ue(s,se,ne),s==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&qo(se,"number",se.value)}switch(Ue=ne?Ae(ne):window,s){case"focusin":(b1(Ue)||Ue.contentEditable==="true")&&(Vo=Ue,hm=ne,Cc=null);break;case"focusout":Cc=hm=Vo=null;break;case"mousedown":dm=!0;break;case"contextmenu":case"mouseup":case"dragend":dm=!1,L1(ge,l,he);break;case"selectionchange":if(zM)break;case"keydown":case"keyup":L1(ge,l,he)}var ut;if(om)e:{switch(s){case"compositionstart":var Tt="onCompositionStart";break e;case"compositionend":Tt="onCompositionEnd";break e;case"compositionupdate":Tt="onCompositionUpdate";break e}Tt=void 0}else Ko?v1(s,l)&&(Tt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Tt="onCompositionStart");Tt&&(m1&&l.locale!=="ko"&&(Ko||Tt!=="onCompositionStart"?Tt==="onCompositionEnd"&&Ko&&(ut=u1()):(na=he,nm="value"in na?na.value:na.textContent,Ko=!0)),Ue=kd(ne,Tt),0<Ue.length&&(Tt=new f1(Tt,s,null,l,he),ge.push({event:Tt,listeners:Ue}),ut?Tt.data=ut:(ut=y1(l),ut!==null&&(Tt.data=ut)))),(ut=NM?LM(s,l):MM(s,l))&&(Tt=kd(ne,"onBeforeInput"),0<Tt.length&&(Ue=new f1("onBeforeInput","beforeinput",null,l,he),ge.push({event:Ue,listeners:Tt}),Ue.data=ut)),x3(ge,s,ne,l,he)}ix(ge,a)})}function Yc(s,a,l){return{instance:s,listener:a,currentTarget:l}}function kd(s,a){for(var l=a+"Capture",h=[];s!==null;){var m=s,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=gc(s,l),m!=null&&h.unshift(Yc(s,m,v)),m=gc(s,a),m!=null&&h.push(Yc(s,m,v))),s.tag===3)return h;s=s.return}return[]}function T3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function rx(s,a,l,h,m){for(var v=a._reactName,k=[];l!==null&&l!==h;){var I=l,G=I.alternate,ne=I.stateNode;if(I=I.tag,G!==null&&G===h)break;I!==5&&I!==26&&I!==27||ne===null||(G=ne,m?(ne=gc(l,v),ne!=null&&k.unshift(Yc(l,ne,G))):m||(ne=gc(l,v),ne!=null&&k.push(Yc(l,ne,G)))),l=l.return}k.length!==0&&s.push({event:a,listeners:k})}var A3=/\r\n?/g,R3=/\u0000|\uFFFD/g;function ax(s){return(typeof s=="string"?s:""+s).replace(A3,`
|
|
9
|
-
`).replace(R3,"")}function ox(s,a){return a=ax(a),ax(s)===a}function Vt(s,a,l,h,m,v){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||et(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&et(s,""+h);break;case"className":es(s,"class",h);break;case"tabIndex":es(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":es(s,l,h);break;case"style":Ft(s,h,v);break;case"data":if(a!=="object"){es(s,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||l!=="href")){s.removeAttribute(l);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=ta(""+h),s.setAttribute(l,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(a!=="input"&&Vt(s,a,"name",m.name,m,null),Vt(s,a,"formEncType",m.formEncType,m,null),Vt(s,a,"formMethod",m.formMethod,m,null),Vt(s,a,"formTarget",m.formTarget,m,null)):(Vt(s,a,"encType",m.encType,m,null),Vt(s,a,"method",m.method,m,null),Vt(s,a,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=ta(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=Ee);break;case"onScroll":h!=null&&xt("scroll",s);break;case"onScrollEnd":h!=null&&xt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}l=ta(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,""+h):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":h===!0?s.setAttribute(l,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,h):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(l,h):s.removeAttribute(l);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(l):s.setAttribute(l,h);break;case"popover":xt("beforetoggle",s),xt("toggle",s),wi(s,"popover",h);break;case"xlinkActuate":$i(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":$i(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":$i(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":$i(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":$i(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":$i(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":$i(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":$i(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":$i(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":wi(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=vr.get(l)||l,wi(s,l,h))}}function Bg(s,a,l,h,m,v){switch(l){case"style":Ft(s,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof h=="string"?et(s,h):(typeof h=="number"||typeof h=="bigint")&&et(s,""+h);break;case"onScroll":h!=null&&xt("scroll",s);break;case"onScrollEnd":h!=null&&xt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Ee);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!un.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),a=l.slice(2,m?l.length-7:void 0),v=s[Ce]||null,v=v!=null?v[l]:null,typeof v=="function"&&s.removeEventListener(a,v,m),typeof h=="function")){typeof v!="function"&&v!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(a,h,m);break e}l in s?s[l]=h:h===!0?s.setAttribute(l,""):wi(s,l,h)}}}function fi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xt("error",s),xt("load",s);var h=!1,m=!1,v;for(v in l)if(l.hasOwnProperty(v)){var k=l[v];if(k!=null)switch(v){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Vt(s,a,v,k,l,null)}}m&&Vt(s,a,"srcSet",l.srcSet,l,null),h&&Vt(s,a,"src",l.src,l,null);return;case"input":xt("invalid",s);var I=v=k=m=null,G=null,ne=null;for(h in l)if(l.hasOwnProperty(h)){var he=l[h];if(he!=null)switch(h){case"name":m=he;break;case"type":k=he;break;case"checked":G=he;break;case"defaultChecked":ne=he;break;case"value":v=he;break;case"defaultValue":I=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,a));break;default:Vt(s,a,h,he,l,null)}}Ja(s,v,I,G,ne,k,m,!1);return;case"select":xt("invalid",s),h=k=v=null;for(m in l)if(l.hasOwnProperty(m)&&(I=l[m],I!=null))switch(m){case"value":v=I;break;case"defaultValue":k=I;break;case"multiple":h=I;default:Vt(s,a,m,I,l,null)}a=v,l=k,s.multiple=!!h,a!=null?ci(s,!!h,a,!1):l!=null&&ci(s,!!h,l,!0);return;case"textarea":xt("invalid",s),v=m=h=null;for(k in l)if(l.hasOwnProperty(k)&&(I=l[k],I!=null))switch(k){case"value":h=I;break;case"defaultValue":m=I;break;case"children":v=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(i(91));break;default:Vt(s,a,k,I,l,null)}Go(s,h,m,v);return;case"option":for(G in l)l.hasOwnProperty(G)&&(h=l[G],h!=null)&&(G==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":Vt(s,a,G,h,l,null));return;case"dialog":xt("beforetoggle",s),xt("toggle",s),xt("cancel",s),xt("close",s);break;case"iframe":case"object":xt("load",s);break;case"video":case"audio":for(h=0;h<Vc.length;h++)xt(Vc[h],s);break;case"image":xt("error",s),xt("load",s);break;case"details":xt("toggle",s);break;case"embed":case"source":case"link":xt("error",s),xt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in l)if(l.hasOwnProperty(ne)&&(h=l[ne],h!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Vt(s,a,ne,h,l,null)}return;default:if(ea(a)){for(he in l)l.hasOwnProperty(he)&&(h=l[he],h!==void 0&&Bg(s,a,he,h,l,void 0));return}}for(I in l)l.hasOwnProperty(I)&&(h=l[I],h!=null&&Vt(s,a,I,h,l,null))}function N3(s,a,l,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,v=null,k=null,I=null,G=null,ne=null,he=null;for(oe in l){var ge=l[oe];if(l.hasOwnProperty(oe)&&ge!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":G=ge;default:h.hasOwnProperty(oe)||Vt(s,a,oe,null,h,ge)}}for(var se in h){var oe=h[se];if(ge=l[se],h.hasOwnProperty(se)&&(oe!=null||ge!=null))switch(se){case"type":v=oe;break;case"name":m=oe;break;case"checked":ne=oe;break;case"defaultChecked":he=oe;break;case"value":k=oe;break;case"defaultValue":I=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,a));break;default:oe!==ge&&Vt(s,a,se,oe,h,ge)}}fc(s,k,I,G,ne,he,v,m);return;case"select":oe=k=I=se=null;for(v in l)if(G=l[v],l.hasOwnProperty(v)&&G!=null)switch(v){case"value":break;case"multiple":oe=G;default:h.hasOwnProperty(v)||Vt(s,a,v,null,h,G)}for(m in h)if(v=h[m],G=l[m],h.hasOwnProperty(m)&&(v!=null||G!=null))switch(m){case"value":se=v;break;case"defaultValue":I=v;break;case"multiple":k=v;default:v!==G&&Vt(s,a,m,v,h,G)}a=I,l=k,h=oe,se!=null?ci(s,!!l,se,!1):!!h!=!!l&&(a!=null?ci(s,!!l,a,!0):ci(s,!!l,l?[]:"",!1));return;case"textarea":oe=se=null;for(I in l)if(m=l[I],l.hasOwnProperty(I)&&m!=null&&!h.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Vt(s,a,I,null,h,m)}for(k in h)if(m=h[k],v=l[k],h.hasOwnProperty(k)&&(m!=null||v!=null))switch(k){case"value":se=m;break;case"defaultValue":oe=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&Vt(s,a,k,m,h,v)}Rh(s,se,oe);return;case"option":for(var Pe in l)se=l[Pe],l.hasOwnProperty(Pe)&&se!=null&&!h.hasOwnProperty(Pe)&&(Pe==="selected"?s.selected=!1:Vt(s,a,Pe,null,h,se));for(G in h)se=h[G],oe=l[G],h.hasOwnProperty(G)&&se!==oe&&(se!=null||oe!=null)&&(G==="selected"?s.selected=se&&typeof se!="function"&&typeof se!="symbol":Vt(s,a,G,se,h,oe));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 Qe in l)se=l[Qe],l.hasOwnProperty(Qe)&&se!=null&&!h.hasOwnProperty(Qe)&&Vt(s,a,Qe,null,h,se);for(ne in h)if(se=h[ne],oe=l[ne],h.hasOwnProperty(ne)&&se!==oe&&(se!=null||oe!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,a));break;default:Vt(s,a,ne,se,h,oe)}return;default:if(ea(a)){for(var Yt in l)se=l[Yt],l.hasOwnProperty(Yt)&&se!==void 0&&!h.hasOwnProperty(Yt)&&Bg(s,a,Yt,void 0,h,se);for(he in h)se=h[he],oe=l[he],!h.hasOwnProperty(he)||se===oe||se===void 0&&oe===void 0||Bg(s,a,he,se,h,oe);return}}for(var Z in l)se=l[Z],l.hasOwnProperty(Z)&&se!=null&&!h.hasOwnProperty(Z)&&Vt(s,a,Z,null,h,se);for(ge in h)se=h[ge],oe=l[ge],!h.hasOwnProperty(ge)||se===oe||se==null&&oe==null||Vt(s,a,ge,se,h,oe)}function lx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function L3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,l=performance.getEntriesByType("resource"),h=0;h<l.length;h++){var m=l[h],v=m.transferSize,k=m.initiatorType,I=m.duration;if(v&&I&&lx(k)){for(k=0,I=m.responseEnd,h+=1;h<l.length;h++){var G=l[h],ne=G.startTime;if(ne>I)break;var he=G.transferSize,ge=G.initiatorType;he&&lx(ge)&&(G=G.responseEnd,k+=he*(G<I?1:(I-ne)/(G-ne)))}if(--h,a+=8*(v+k)/(m.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Pg=null,$g=null;function Ed(s){return s.nodeType===9?s:s.ownerDocument}function cx(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ux(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function zg(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Hg=null;function M3(){var s=window.event;return s&&s.type==="popstate"?s===Hg?!1:(Hg=s,!0):(Hg=null,!1)}var hx=typeof setTimeout=="function"?setTimeout:void 0,O3=typeof clearTimeout=="function"?clearTimeout:void 0,dx=typeof Promise=="function"?Promise:void 0,D3=typeof queueMicrotask=="function"?queueMicrotask:typeof dx<"u"?function(s){return dx.resolve(null).then(s).catch(j3)}:hx;function j3(s){setTimeout(function(){throw s})}function ya(s){return s==="head"}function fx(s,a){var l=a,h=0;do{var m=l.nextSibling;if(s.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(h===0){s.removeChild(m),Sl(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")Xc(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Xc(l);for(var v=l.firstChild;v;){var k=v.nextSibling,I=v.nodeName;v[Si]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=k}}else l==="body"&&Xc(s.ownerDocument.body);l=m}while(l);Sl(a)}function px(s,a){var l=s;s=0;do{var h=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),h&&h.nodeType===8)if(l=h.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=h}while(l)}function Fg(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Fg(l),He(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function I3(s,a,l,h){for(;s.nodeType===1;){var m=l;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[Si])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Es(s.nextSibling),s===null)break}return null}function B3(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Es(s.nextSibling),s===null))return null;return s}function mx(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Es(s.nextSibling),s===null))return null;return s}function Ug(s){return s.data==="$?"||s.data==="$~"}function Wg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function P3(s,a){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||l.readyState!=="loading")a();else{var h=function(){a(),l.removeEventListener("DOMContentLoaded",h)};l.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function Es(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var qg=null;function gx(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return Es(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function _x(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return s;a--}else l!=="/$"&&l!=="/&"||a++}s=s.previousSibling}return null}function vx(s,a,l){switch(a=Ed(l),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Xc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);He(s)}var Ts=new Map,yx=new Set;function Td(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Dr=L.d;L.d={f:$3,r:z3,D:H3,C:F3,L:U3,m:W3,X:G3,S:q3,M:K3};function $3(){var s=Dr.f(),a=vd();return s||a}function z3(s){var a=ue(s);a!==null&&a.tag===5&&a.type==="form"?IS(a):Dr.r(s)}var vl=typeof document>"u"?null:document;function bx(s,a,l){var h=vl;if(h&&typeof a=="string"&&a){var m=zi(a);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),yx.has(m)||(yx.add(m),s={rel:s,crossOrigin:l,href:a},h.querySelector(m)===null&&(a=h.createElement("link"),fi(a,"link",s),ot(a),h.head.appendChild(a)))}}function H3(s){Dr.D(s),bx("dns-prefetch",s,null)}function F3(s,a){Dr.C(s,a),bx("preconnect",s,a)}function U3(s,a,l){Dr.L(s,a,l);var h=vl;if(h&&s&&a){var m='link[rel="preload"][as="'+zi(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+zi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+zi(l.imageSizes)+'"]')):m+='[href="'+zi(s)+'"]';var v=m;switch(a){case"style":v=yl(s);break;case"script":v=bl(s)}Ts.has(v)||(s=_({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Ts.set(v,s),h.querySelector(m)!==null||a==="style"&&h.querySelector(Zc(v))||a==="script"&&h.querySelector(Jc(v))||(a=h.createElement("link"),fi(a,"link",s),ot(a),h.head.appendChild(a)))}}function W3(s,a){Dr.m(s,a);var l=vl;if(l&&s){var h=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+zi(h)+'"][href="'+zi(s)+'"]',v=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=bl(s)}if(!Ts.has(v)&&(s=_({rel:"modulepreload",href:s},a),Ts.set(v,s),l.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Jc(v)))return}h=l.createElement("link"),fi(h,"link",s),ot(h),l.head.appendChild(h)}}}function q3(s,a,l){Dr.S(s,a,l);var h=vl;if(h&&s){var m=rt(h).hoistableStyles,v=yl(s);a=a||"default";var k=m.get(v);if(!k){var I={loading:0,preload:null};if(k=h.querySelector(Zc(v)))I.loading=5;else{s=_({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Ts.get(v))&&Gg(s,l);var G=k=h.createElement("link");ot(G),fi(G,"link",s),G._p=new Promise(function(ne,he){G.onload=ne,G.onerror=he}),G.addEventListener("load",function(){I.loading|=1}),G.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Ad(k,a,h)}k={type:"stylesheet",instance:k,count:1,state:I},m.set(v,k)}}}function G3(s,a){Dr.X(s,a);var l=vl;if(l&&s){var h=rt(l).hoistableScripts,m=bl(s),v=h.get(m);v||(v=l.querySelector(Jc(m)),v||(s=_({src:s,async:!0},a),(a=Ts.get(m))&&Kg(s,a),v=l.createElement("script"),ot(v),fi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function K3(s,a){Dr.M(s,a);var l=vl;if(l&&s){var h=rt(l).hoistableScripts,m=bl(s),v=h.get(m);v||(v=l.querySelector(Jc(m)),v||(s=_({src:s,async:!0,type:"module"},a),(a=Ts.get(m))&&Kg(s,a),v=l.createElement("script"),ot(v),fi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function Sx(s,a,l,h){var m=(m=ve.current)?Td(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=yl(l.href),l=rt(m).hoistableStyles,h=l.get(a),h||(h={type:"style",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=yl(l.href);var v=rt(m).hoistableStyles,k=v.get(s);if(k||(m=m.ownerDocument||m,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,k),(v=m.querySelector(Zc(s)))&&!v._p&&(k.instance=v,k.state.loading=5),Ts.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ts.set(s,l),v||V3(m,s,l,k.state))),a&&h===null)throw Error(i(528,""));return k}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=bl(l),l=rt(m).hoistableScripts,h=l.get(a),h||(h={type:"script",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function yl(s){return'href="'+zi(s)+'"'}function Zc(s){return'link[rel="stylesheet"]['+s+"]"}function wx(s){return _({},s,{"data-precedence":s.precedence,precedence:null})}function V3(s,a,l,h){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=s.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),fi(a,"link",l),ot(a),s.head.appendChild(a))}function bl(s){return'[src="'+zi(s)+'"]'}function Jc(s){return"script[async]"+s}function xx(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+zi(l.href)+'"]');if(h)return a.instance=h,ot(h),h;var m=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),ot(h),fi(h,"style",m),Ad(h,l.precedence,s),a.instance=h;case"stylesheet":m=yl(l.href);var v=s.querySelector(Zc(m));if(v)return a.state.loading|=4,a.instance=v,ot(v),v;h=wx(l),(m=Ts.get(m))&&Gg(h,m),v=(s.ownerDocument||s).createElement("link"),ot(v);var k=v;return k._p=new Promise(function(I,G){k.onload=I,k.onerror=G}),fi(v,"link",h),a.state.loading|=4,Ad(v,l.precedence,s),a.instance=v;case"script":return v=bl(l.src),(m=s.querySelector(Jc(v)))?(a.instance=m,ot(m),m):(h=l,(m=Ts.get(v))&&(h=_({},l),Kg(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),ot(m),fi(m,"link",h),s.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Ad(h,l.precedence,s));return a.instance}function Ad(s,a,l){for(var h=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,v=m,k=0;k<h.length;k++){var I=h[k];if(I.dataset.precedence===a)v=I;else if(v!==m)break}v?v.parentNode.insertBefore(s,v.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function Gg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Kg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Rd=null;function Cx(s,a,l){if(Rd===null){var h=new Map,m=Rd=new Map;m.set(l,h)}else m=Rd,h=m.get(l),h||(h=new Map,m.set(l,h));if(h.has(s))return h;for(h.set(s,null),l=l.getElementsByTagName(s),m=0;m<l.length;m++){var v=l[m];if(!(v[Si]||v[Xe]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var k=v.getAttribute(a)||"";k=s+k;var I=h.get(k);I?I.push(v):h.set(k,[v])}}return h}function kx(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function Y3(s,a,l){if(l===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Ex(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function X3(s,a,l,h){if(l.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=yl(h.href),v=a.querySelector(Zc(m));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Nd.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=v,ot(v);return}v=a.ownerDocument||a,h=wx(h),(m=Ts.get(m))&&Gg(h,m),v=v.createElement("link"),ot(v);var k=v;k._p=new Promise(function(I,G){k.onload=I,k.onerror=G}),fi(v,"link",h),l.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Nd.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var Vg=0;function Z3(s,a){return s.stylesheets&&s.count===0&&Md(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&Md(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&Vg===0&&(Vg=62500*L3());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Md(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>Vg?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Nd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Md(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Ld=null;function Md(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Ld=new Map,a.forEach(J3,s),Ld=null,Nd.call(s))}function J3(s,a){if(!(a.state.loading&4)){var l=Ld.get(s);if(l)var h=l.get(null);else{l=new Map,Ld.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var k=m[v];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(l.set(k.dataset.precedence,k),h=k)}h&&l.set(null,h)}m=a.instance,k=m.getAttribute("data-precedence"),v=l.get(k)||h,v===h&&l.set(null,m),l.set(k,m),this.count++,h=Nd.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),v?v.parentNode.insertBefore(m,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),a.state.loading|=4}}var Qc={$$typeof:z,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function Q3(s,a,l,h,m,v,k,I,G){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$t(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$t(0),this.hiddenUpdates=$t(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function Tx(s,a,l,h,m,v,k,I,G,ne,he,ge){return s=new Q3(s,a,l,k,G,ne,he,ge,I),a=1,v===!0&&(a|=24),v=is(3,null,null,a),s.current=v,v.stateNode=s,a=Tm(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:l,cache:a},Lm(v),s}function Ax(s){return s?(s=Zo,s):Zo}function Rx(s,a,l,h,m,v){m=Ax(m),h.context===null?h.context=m:h.pendingContext=m,h=la(a),h.payload={element:l},v=v===void 0?null:v,v!==null&&(h.callback=v),l=ca(s,h,a),l!==null&&(Gi(l,s,a),Lc(l,s,a))}function Nx(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Yg(s,a){Nx(s,a),(s=s.alternate)&&Nx(s,a)}function Lx(s){if(s.tag===13||s.tag===31){var a=no(s,67108864);a!==null&&Gi(a,s,67108864),Yg(s,67108864)}}function Mx(s){if(s.tag===13||s.tag===31){var a=ls();a=pt(a);var l=no(s,a);l!==null&&Gi(l,s,a),Yg(s,a)}}var Od=!0;function e6(s,a,l,h){var m=E.T;E.T=null;var v=L.p;try{L.p=2,Xg(s,a,l,h)}finally{L.p=v,E.T=m}}function t6(s,a,l,h){var m=E.T;E.T=null;var v=L.p;try{L.p=8,Xg(s,a,l,h)}finally{L.p=v,E.T=m}}function Xg(s,a,l,h){if(Od){var m=Zg(h);if(m===null)Ig(s,a,h,Dd,l),Dx(s,h);else if(i6(m,s,a,l,h))h.stopPropagation();else if(Dx(s,h),a&4&&-1<n6.indexOf(s)){for(;m!==null;){var v=ue(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var k=qt(v.pendingLanes);if(k!==0){var I=v;for(I.pendingLanes|=2,I.entangledLanes|=2;k;){var G=1<<31-Pt(k);I.entanglements[1]|=G,k&=~G}tr(v),(It&6)===0&&(gd=ft()+500,Kc(0))}}break;case 31:case 13:I=no(v,2),I!==null&&Gi(I,v,2),vd(),Yg(v,2)}if(v=Zg(h),v===null&&Ig(s,a,h,Dd,l),v===m)break;m=v}m!==null&&h.stopPropagation()}else Ig(s,a,h,null,l)}}function Zg(s){return s=at(s),Jg(s)}var Dd=null;function Jg(s){if(Dd=null,s=U(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=c(a),s!==null)return s;s=null}else if(l===31){if(s=d(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Dd=s,null}function Ox(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ti()){case An:return 2;case re:return 8;case de:case Ie:return 32;case Te:return 268435456;default:return 32}default:return 32}}var Qg=!1,ba=null,Sa=null,wa=null,eu=new Map,tu=new Map,xa=[],n6="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 Dx(s,a){switch(s){case"focusin":case"focusout":ba=null;break;case"dragenter":case"dragleave":Sa=null;break;case"mouseover":case"mouseout":wa=null;break;case"pointerover":case"pointerout":eu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":tu.delete(a.pointerId)}}function nu(s,a,l,h,m,v){return s===null||s.nativeEvent!==v?(s={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:v,targetContainers:[m]},a!==null&&(a=ue(a),a!==null&&Lx(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function i6(s,a,l,h,m){switch(a){case"focusin":return ba=nu(ba,s,a,l,h,m),!0;case"dragenter":return Sa=nu(Sa,s,a,l,h,m),!0;case"mouseover":return wa=nu(wa,s,a,l,h,m),!0;case"pointerover":var v=m.pointerId;return eu.set(v,nu(eu.get(v)||null,s,a,l,h,m)),!0;case"gotpointercapture":return v=m.pointerId,tu.set(v,nu(tu.get(v)||null,s,a,l,h,m)),!0}return!1}function jx(s){var a=U(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=c(l),a!==null){s.blockedOn=a,Ct(s.priority,function(){Mx(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,Ct(s.priority,function(){Mx(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function jd(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=Zg(s.nativeEvent);if(l===null){l=s.nativeEvent;var h=new l.constructor(l.type,l);Fe=h,l.target.dispatchEvent(h),Fe=null}else return a=ue(l),a!==null&&Lx(a),s.blockedOn=l,!1;a.shift()}return!0}function Ix(s,a,l){jd(s)&&l.delete(a)}function s6(){Qg=!1,ba!==null&&jd(ba)&&(ba=null),Sa!==null&&jd(Sa)&&(Sa=null),wa!==null&&jd(wa)&&(wa=null),eu.forEach(Ix),tu.forEach(Ix)}function Id(s,a){s.blockedOn===a&&(s.blockedOn=null,Qg||(Qg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,s6)))}var Bd=null;function Bx(s){Bd!==s&&(Bd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Bd===s&&(Bd=null);for(var a=0;a<s.length;a+=3){var l=s[a],h=s[a+1],m=s[a+2];if(typeof h!="function"){if(Jg(h||l)===null)continue;break}var v=ue(l);v!==null&&(s.splice(a,3),a-=3,Zm(v,{pending:!0,data:m,method:l.method,action:h},h,m))}}))}function Sl(s){function a(G){return Id(G,s)}ba!==null&&Id(ba,s),Sa!==null&&Id(Sa,s),wa!==null&&Id(wa,s),eu.forEach(a),tu.forEach(a);for(var l=0;l<xa.length;l++){var h=xa[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<xa.length&&(l=xa[0],l.blockedOn===null);)jx(l),l.blockedOn===null&&xa.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(h=0;h<l.length;h+=3){var m=l[h],v=l[h+1],k=m[Ce]||null;if(typeof v=="function")k||Bx(l);else if(k){var I=null;if(v&&v.hasAttribute("formAction")){if(m=v,k=v[Ce]||null)I=k.formAction;else if(Jg(m)!==null)continue}else I=k.action;typeof I=="function"?l[h+1]=I:(l.splice(h,3),h-=3),Bx(l)}}}function Px(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(k){return m=k})},focusReset:"manual",scroll:"manual"})}function a(){m!==null&&(m(),m=null),h||setTimeout(l,20)}function l(){if(!h&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function e_(s){this._internalRoot=s}Pd.prototype.render=e_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=ls();Rx(l,h,s,a,null,null)},Pd.prototype.unmount=e_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Rx(s.current,2,null,s,null,null),vd(),a[zt]=null}};function Pd(s){this._internalRoot=s}Pd.prototype.unstable_scheduleHydration=function(s){if(s){var a=pe();s={blockedOn:null,target:s,priority:a};for(var l=0;l<xa.length&&a!==0&&a<xa[l].priority;l++);xa.splice(l,0,s),l===0&&jx(s)}};var $x=t.version;if($x!=="19.2.7")throw Error(i(527,$x,"19.2.7"));L.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=f(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var r6={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$d.isDisabled&&$d.supportsFiber)try{Xn=$d.inject(r6),yt=$d}catch{}}return su.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,h="",m=GS,v=KS,k=VS;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=Tx(s,1,!1,null,null,l,h,null,m,v,k,Px),s[zt]=a.current,jg(s),new e_(a)},su.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var h=!1,m="",v=GS,k=KS,I=VS,G=null;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(I=l.onRecoverableError),l.formState!==void 0&&(G=l.formState)),a=Tx(s,1,!0,a,l??null,h,m,G,v,k,I,Px),a.context=Ax(null),l=a.current,h=ls(),h=pt(h),m=la(h),m.callback=null,ca(l,m,h),l=h,a.current.lanes=l,Nt(a,l),tr(a),s[zt]=a.current,jg(s),new Pd(a)},su.version="19.2.7",su}var Xx;function G6(){if(Xx)return s_.exports;Xx=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(),s_.exports=q6(),s_.exports}var K6=G6();var Zx="popstate";function Jx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function V6(e={}){function t(i,r){let o=r.state?.masked,{pathname:c,search:d,hash:p}=o||i.location;return Pv("",{pathname:c,search:d,hash:p},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:Qu(r)}return X6(t,n,null,e)}function pn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Y6(){return Math.random().toString(36).substring(2,10)}function Qx(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 Pv(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?sc(t):t,state:n,key:t&&t.key||i||Y6(),mask:r}}function Qu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function sc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function X6(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,c=r.history,d="POP",p=null,f=g();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function g(){return(c.state||{idx:null}).idx}function _(){d="POP";let C=g(),O=C==null?null:C-f;f=C,p&&p({action:d,location:x.location,delta:O})}function b(C,O){d="PUSH";let P=Jx(C)?C:Pv(x.location,C,O);f=g()+1;let z=Qx(P,f),T=x.createHref(P.mask||P);try{c.pushState(z,"",T)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;r.location.assign(T)}o&&p&&p({action:d,location:x.location,delta:1})}function S(C,O){d="REPLACE";let P=Jx(C)?C:Pv(x.location,C,O);f=g();let z=Qx(P,f),T=x.createHref(P.mask||P);c.replaceState(z,"",T),o&&p&&p({action:d,location:x.location,delta:0})}function w(C){return Z6(r,C)}let x={get action(){return d},get location(){return e(r,c)},listen(C){if(p)throw new Error("A history only accepts one active listener");return r.addEventListener(Zx,_),p=C,()=>{r.removeEventListener(Zx,_),p=null}},createHref(C){return t(r,C)},createURL:w,encodeLocation(C){let O=w(C);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:b,replace:S,go(C){return c.go(C)}};return x}function Z6(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),pn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Qu(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function i5(e,t,n="/"){return J6(e,t,n,!1)}function J6(e,t,n,i,r){let o=typeof t=="string"?sc(t):t,c=Kr(o.pathname||"/",n);if(c==null)return null;let d=Q6(e),p=null,f=h4(c);for(let g=0;p==null&&g<d.length;++g)p=c4(d[g],f,i);return p}function Q6(e){let t=s5(e);return e4(t),t}function s5(e,t=[],n=[],i="",r=!1){let o=(c,d,p=r,f)=>{let g={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&p)return;pn(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let _=Gs([i,g.relativePath]),b=n.concat(g);c.children&&c.children.length>0&&(pn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),s5(c.children,t,b,_,p)),!(c.path==null&&!c.index)&&t.push({path:_,score:o4(_,c.index),routesMeta:b})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))o(c,d);else for(let p of r5(c.path))o(c,d,!0,p)}),t}function r5(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return r?[o,""]:[o];let c=r5(i.join("/")),d=[];return d.push(...c.map(p=>p===""?o:[o,p].join("/"))),r&&d.push(...c),d.map(p=>e.startsWith("/")&&p===""?"/":p)}function e4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:l4(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var t4=/^:[\w-]+$/,n4=3,i4=2,s4=1,r4=10,a4=-2,eC=e=>e==="*";function o4(e,t){let n=e.split("/"),i=n.length;return n.some(eC)&&(i+=a4),t&&(i+=i4),n.filter(r=>!eC(r)).reduce((r,o)=>r+(t4.test(o)?n4:o===""?s4:r4),i)}function l4(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function c4(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",c=[];for(let d=0;d<i.length;++d){let p=i[d],f=d===i.length-1,g=o==="/"?t:t.slice(o.length)||"/",_=Wf({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},g),b=p.route;if(!_&&f&&n&&!i[i.length-1].route.index&&(_=Wf({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!_)return null;Object.assign(r,_.params),c.push({params:r,pathname:Gs([o,_.pathname]),pathnameBase:m4(Gs([o,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(o=Gs([o,_.pathnameBase]))}return c}function Wf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=u4(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],c=o.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:i.reduce((f,{paramName:g,isOptional:_},b)=>{if(g==="*"){let w=d[b]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[b];return _&&!S?f[g]=void 0:f[g]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:c,pattern:e}}function u4(e,t=!1,n=!0){Vs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,p,f,g)=>{if(i.push({paramName:d,isOptional:p!=null}),p){let _=g.charAt(f+c.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function h4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vs(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Kr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var d4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function f4(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?sc(e):e,o;return n?(n=a5(n),n.startsWith("/")?o=tC(n.substring(1),"/"):o=tC(n,t)):o=t,{pathname:o,search:g4(i),hash:_4(r)}}function tC(e,t){let n=qf(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function l_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function p4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Fb(e){let t=p4(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Tp(e,t,n,i=!1){let r;typeof e=="string"?r=sc(e):(r={...e},pn(!r.pathname||!r.pathname.includes("?"),l_("?","pathname","search",r)),pn(!r.pathname||!r.pathname.includes("#"),l_("#","pathname","hash",r)),pn(!r.search||!r.search.includes("#"),l_("#","search","hash",r)));let o=e===""||r.pathname==="",c=o?"/":r.pathname,d;if(c==null)d=n;else{let _=t.length-1;if(!i&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),_-=1;r.pathname=b.join("/")}d=_>=0?t[_]:"/"}let p=f4(r,d),f=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(f||g)&&(p.pathname+="/"),p}var a5=e=>e.replace(/\/\/+/g,"/"),Gs=e=>a5(e.join("/")),qf=e=>e.replace(/\/+$/,""),m4=e=>qf(e).replace(/^\/*/,"/"),g4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,v4=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function y4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function b4(e){let t=e.map(n=>n.route.path).filter(Boolean);return Gs(t)||"/"}var o5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function l5(e,t){let n=e;if(typeof n!="string"||!d4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(o5)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Kr(c.pathname,t);c.origin===o.origin&&d!=null?n=d+c.search+c.hash:r=!0}catch{Vs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var c5=["POST","PUT","PATCH","DELETE"];new Set(c5);var S4=["GET",...c5];new Set(S4);var rc=y.createContext(null);rc.displayName="DataRouter";var Ap=y.createContext(null);Ap.displayName="DataRouterState";var u5=y.createContext(!1);function w4(){return y.useContext(u5)}var h5=y.createContext({isTransitioning:!1});h5.displayName="ViewTransition";var x4=y.createContext(new Map);x4.displayName="Fetchers";var C4=y.createContext(null);C4.displayName="Await";var gs=y.createContext(null);gs.displayName="Navigation";var bh=y.createContext(null);bh.displayName="Location";var gr=y.createContext({outlet:null,matches:[],isDataRoute:!1});gr.displayName="Route";var Ub=y.createContext(null);Ub.displayName="RouteError";var d5="REACT_ROUTER_ERROR",k4="REDIRECT",E4="ROUTE_ERROR_RESPONSE";function T4(e){if(e.startsWith(`${d5}:${k4}:{`))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 A4(e){if(e.startsWith(`${d5}:${E4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new v4(t.status,t.statusText,t.data)}catch{}}function R4(e,{relative:t}={}){pn(ac(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=y.useContext(gs),{hash:r,pathname:o,search:c}=Sh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Gs([n,o])),i.createHref({pathname:d,search:c,hash:r})}function ac(){return y.useContext(bh)!=null}function Ps(){return pn(ac(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(bh).location}var f5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function p5(e){y.useContext(gs).static||y.useLayoutEffect(e)}function oc(){let{isDataRoute:e}=y.useContext(gr);return e?F4():N4()}function N4(){pn(ac(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(rc),{basename:t,navigator:n}=y.useContext(gs),{matches:i}=y.useContext(gr),{pathname:r}=Ps(),o=JSON.stringify(Fb(i)),c=y.useRef(!1);return p5(()=>{c.current=!0}),y.useCallback((p,f={})=>{if(Vs(c.current,f5),!c.current)return;if(typeof p=="number"){n.go(p);return}let g=Tp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Gs([t,g.pathname])),(f.replace?n.replace:n.push)(g,f.state,f)},[t,n,o,r,e])}y.createContext(null);function Sh(e,{relative:t}={}){let{matches:n}=y.useContext(gr),{pathname:i}=Ps(),r=JSON.stringify(Fb(n));return y.useMemo(()=>Tp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function L4(e,t){return m5(e,t)}function m5(e,t,n){pn(ac(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(gs),{matches:r}=y.useContext(gr),o=r[r.length-1],c=o?o.params:{},d=o?o.pathname:"/",p=o?o.pathnameBase:"/",f=o&&o.route;{let C=f&&f.path||"";_5(d,!f||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${C}">) 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="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let g=Ps(),_;if(t){let C=typeof t=="string"?sc(t):t;pn(p==="/"||C.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${C.pathname}" was given in the \`location\` prop.`),_=C}else _=g;let b=_.pathname||"/",S=b;if(p!=="/"){let C=p.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(C=>Object.assign(C,{route:n.manifest[C.route.id]||C.route})):i5(e,{pathname:S});Vs(f||w!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Vs(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=I4(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Gs([p,i.encodeLocation?i.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?p:Gs([p,i.encodeLocation?i.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,n);return t&&x?y.createElement(bh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,..._},navigationType:"POP"}},x):x}function M4(){let e=H4(),t=y4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:o},"ErrorBoundary")," or"," ",y.createElement("code",{style:o},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:r},n):null,c)}var O4=y.createElement(M4,null),g5=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=A4(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(gr.Provider,{value:this.props.routeContext},y.createElement(Ub.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(D4,{error:e},t):t}};g5.contextType=u5;var c_=new WeakMap;function D4({children:e,error:t}){let{basename:n}=y.useContext(gs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=T4(t.digest);if(i){let r=c_.get(t);if(r)throw r;let o=l5(i.location,n);if(o5&&!c_.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw c_.set(t,c),c}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function j4({routeContext:e,match:t,children:n}){let i=y.useContext(rc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(gr.Provider,{value:e},n)}function I4(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,o=i?.errors;if(o!=null){let g=r.findIndex(_=>_.route.id&&o?.[_.route.id]!==void 0);pn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,g+1))}let c=!1,d=-1;if(n&&i){c=i.renderFallback;for(let g=0;g<r.length;g++){let _=r[g];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(d=g),_.route.id){let{loaderData:b,errors:S}=i,w=_.route.loader&&!b.hasOwnProperty(_.route.id)&&(!S||S[_.route.id]===void 0);if(_.route.lazy||w){n.isStatic&&(c=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let p=n?.onError,f=i&&p?(g,_)=>{p(g,{location:i.location,params:i.matches?.[0]?.params??{},pattern:b4(i.matches),errorInfo:_})}:void 0;return r.reduceRight((g,_,b)=>{let S,w=!1,x=null,C=null;i&&(S=o&&_.route.id?o[_.route.id]:void 0,x=_.route.errorElement||O4,c&&(d<0&&b===0?(_5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):d===b&&(w=!0,C=_.route.hydrateFallbackElement||null)));let O=t.concat(r.slice(0,b+1)),P=()=>{let z;return S?z=x:w?z=C:_.route.Component?z=y.createElement(_.route.Component,null):_.route.element?z=_.route.element:z=g,y.createElement(j4,{match:_,routeContext:{outlet:g,matches:O,isDataRoute:i!=null},children:z})};return i&&(_.route.ErrorBoundary||_.route.errorElement||b===0)?y.createElement(g5,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:P(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:f}):P()},null)}function Wb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B4(e){let t=y.useContext(rc);return pn(t,Wb(e)),t}function P4(e){let t=y.useContext(Ap);return pn(t,Wb(e)),t}function $4(e){let t=y.useContext(gr);return pn(t,Wb(e)),t}function qb(e){let t=$4(e),n=t.matches[t.matches.length-1];return pn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function z4(){return qb("useRouteId")}function H4(){let e=y.useContext(Ub),t=P4("useRouteError"),n=qb("useRouteError");return e!==void 0?e:t.errors?.[n]}function F4(){let{router:e}=B4("useNavigate"),t=qb("useNavigate"),n=y.useRef(!1);return p5(()=>{n.current=!0}),y.useCallback(async(r,o={})=>{Vs(n.current,f5),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var nC={};function _5(e,t,n){!t&&!nC[e]&&(nC[e]=!0,Vs(!1,n))}y.memo(U4);function U4({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return m5(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function u_({to:e,replace:t,state:n,relative:i}){pn(ac(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=y.useContext(gs);Vs(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=y.useContext(gr),{pathname:c}=Ps(),d=oc(),p=Tp(e,Fb(o),c,i==="path"),f=JSON.stringify(p);return y.useEffect(()=>{d(JSON.parse(f),{replace:t,state:n,relative:i})},[d,f,i,t,n]),null}function Nl(e){pn(!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 W4({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:c}){pn(!ac(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),p=y.useMemo(()=>({basename:d,navigator:r,static:o,useTransitions:c,future:{}}),[d,r,o,c]);typeof n=="string"&&(n=sc(n));let{pathname:f="/",search:g="",hash:_="",state:b=null,key:S="default",mask:w}=n,x=y.useMemo(()=>{let C=Kr(f,d);return C==null?null:{location:{pathname:C,search:g,hash:_,state:b,key:S,mask:w},navigationType:i}},[d,f,g,_,b,S,i,w]);return Vs(x!=null,`<Router basename="${d}"> is not able to match the URL "${f}${g}${_}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:y.createElement(gs.Provider,{value:p},y.createElement(bh.Provider,{children:t,value:x}))}function q4({children:e,location:t}){return L4($v(e),t)}function $v(e,t=[]){let n=[];return y.Children.forEach(e,(i,r)=>{if(!y.isValidElement(i))return;let o=[...t,r];if(i.type===y.Fragment){n.push.apply(n,$v(i.props.children,o));return}pn(i.type===Nl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),pn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let c={id:i.props.id||o.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=$v(i.props.children,o)),n.push(c)}),n}var vf="get",yf="application/x-www-form-urlencoded";function Rp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function G4(e){return Rp(e)&&e.tagName.toLowerCase()==="button"}function K4(e){return Rp(e)&&e.tagName.toLowerCase()==="form"}function V4(e){return Rp(e)&&e.tagName.toLowerCase()==="input"}function Y4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function X4(e,t){return e.button===0&&(!t||t==="_self")&&!Y4(e)}var zd=null;function Z4(){if(zd===null)try{new FormData(document.createElement("form"),0),zd=!1}catch{zd=!0}return zd}var J4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function h_(e){return e!=null&&!J4.has(e)?(Vs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yf}"`),null):e}function Q4(e,t){let n,i,r,o,c;if(K4(e)){let d=e.getAttribute("action");i=d?Kr(d,t):null,n=e.getAttribute("method")||vf,r=h_(e.getAttribute("enctype"))||yf,o=new FormData(e)}else if(G4(e)||V4(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||d.getAttribute("action");if(i=p?Kr(p,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||vf,r=h_(e.getAttribute("formenctype"))||h_(d.getAttribute("enctype"))||yf,o=new FormData(d,e),!Z4()){let{name:f,type:g,value:_}=e;if(g==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,_)}}else{if(Rp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=vf,i=null,r=yf,c=e}return o&&r==="text/plain"&&(c=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Gb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function v5(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&Kr(r.pathname,t)==="/"?r.pathname=`${qf(t)}/_root.${i}`:r.pathname=`${qf(r.pathname)}.${i}`,r}async function eO(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function tO(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 nO(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let c=await eO(o,n);return c.links?c.links():[]}return[]}));return aO(i.flat(1).filter(tO).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function iC(e,t,n,i,r,o){let c=(p,f)=>n[f]?p.route.id!==n[f].route.id:!0,d=(p,f)=>n[f].pathname!==p.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==p.params["*"];return o==="assets"?t.filter((p,f)=>c(p,f)||d(p,f)):o==="data"?t.filter((p,f)=>{let g=i.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(c(p,f)||d(p,f))return!0;if(p.route.shouldRevalidate){let _=p.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function iO(e,t,{includeHydrateFallback:n}={}){return sO(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function sO(e){return[...new Set(e)]}function rO(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function aO(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(rO(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function Kb(){let e=y.useContext(rc);return Gb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function oO(){let e=y.useContext(Ap);return Gb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Vb=y.createContext(void 0);Vb.displayName="FrameworkContext";function Yb(){let e=y.useContext(Vb);return Gb(e,"You must render this element inside a <HydratedRouter> element"),e}function lO(e,t){let n=y.useContext(Vb),[i,r]=y.useState(!1),[o,c]=y.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:f,onMouseLeave:g,onTouchStart:_}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=O=>{O.forEach(P=>{c(P.isIntersecting)})},C=new IntersectionObserver(x,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[e]),y.useEffect(()=>{if(i){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:ru(d,S),onBlur:ru(p,w),onMouseEnter:ru(f,S),onMouseLeave:ru(g,w),onTouchStart:ru(_,S)}]:[!1,b,{}]}function ru(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function cO({page:e,...t}){let n=w4(),{router:i}=Kb(),r=y.useMemo(()=>i5(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?y.createElement(hO,{page:e,matches:r,...t}):y.createElement(dO,{page:e,matches:r,...t}):null}function uO(e){let{manifest:t,routeModules:n}=Yb(),[i,r]=y.useState([]);return y.useEffect(()=>{let o=!1;return nO(e,t,n).then(c=>{o||r(c)}),()=>{o=!0}},[e,t,n]),i}function hO({page:e,matches:t,...n}){let i=Ps(),{future:r}=Yb(),{basename:o}=Kb(),c=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=v5(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?p=!0:f.push(g.route.id);return p&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return y.createElement(y.Fragment,null,c.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function dO({page:e,matches:t,...n}){let i=Ps(),{future:r,manifest:o,routeModules:c}=Yb(),{basename:d}=Kb(),{loaderData:p,matches:f}=oO(),g=y.useMemo(()=>iC(e,t,f,o,i,"data"),[e,t,f,o,i]),_=y.useMemo(()=>iC(e,t,f,o,i,"assets"),[e,t,f,o,i]),b=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,C=!1;if(t.forEach(P=>{let z=o.routes[P.route.id];!z||!z.hasLoader||(!g.some(T=>T.route.id===P.route.id)&&P.route.id in p&&c[P.route.id]?.shouldRevalidate||z.hasClientLoader?C=!0:x.add(P.route.id))}),x.size===0)return[];let O=v5(e,d,r.v8_trailingSlashAwareDataRequests,"data");return C&&x.size>0&&O.searchParams.set("_routes",t.filter(P=>x.has(P.route.id)).map(P=>P.route.id).join(",")),[O.pathname+O.search]},[d,r.v8_trailingSlashAwareDataRequests,p,i,o,g,t,e,c]),S=y.useMemo(()=>iO(_,o),[_,o]),w=uO(_);return y.createElement(y.Fragment,null,b.map(x=>y.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),S.map(x=>y.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),w.map(({key:x,link:C})=>y.createElement("link",{key:x,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function fO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var pO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{pO&&(window.__reactRouterVersion="7.17.0")}catch{}function mO({basename:e,children:t,useTransitions:n,window:i}){let r=y.useRef();r.current==null&&(r.current=V6({window:i,v5Compat:!0}));let o=r.current,[c,d]=y.useState({action:o.action,location:o.location}),p=y.useCallback(f=>{n===!1?d(f):y.startTransition(()=>d(f))},[n]);return y.useLayoutEffect(()=>o.listen(p),[o,p]),y.createElement(W4,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:n})}var y5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eh=y.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:c,mask:d,state:p,target:f,to:g,preventScrollReset:_,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:C,navigator:O,useTransitions:P}=y.useContext(gs),z=typeof g=="string"&&y5.test(g),T=l5(g,C);g=T.to;let j=R4(g,{relative:r}),M=Ps(),H=null;if(d){let A=Tp(d,[],M.mask?M.mask.pathname:"/",!0);C!=="/"&&(A.pathname=A.pathname==="/"?C:Gs([C,A.pathname])),H=O.createHref(A)}let[F,ee,ae]=lO(i,w),K=yO(g,{replace:c,mask:d,state:p,target:f,preventScrollReset:_,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:P});function B(A){t&&t(A),A.defaultPrevented||K(A)}let N=!(T.isExternal||o),R=y.createElement("a",{...w,...ae,href:(N?H:void 0)||T.absoluteURL||j,onClick:N?B:t,ref:fO(x,ee),target:f,"data-discover":!z&&n==="render"?"true":void 0});return F&&!z?y.createElement(y.Fragment,null,R,y.createElement(cO,{page:j})):R});eh.displayName="Link";var gO=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:c,viewTransition:d,children:p,...f},g){let _=Sh(c,{relative:f.relative}),b=Ps(),S=y.useContext(Ap),{navigator:w,basename:x}=y.useContext(gs),C=S!=null&&CO(_)&&d===!0,O=w.encodeLocation?w.encodeLocation(_).pathname:_.pathname,P=b.pathname,z=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(P=P.toLowerCase(),z=z?z.toLowerCase():null,O=O.toLowerCase()),z&&x&&(z=Kr(z,x)||z);const T=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let j=P===O||!r&&P.startsWith(O)&&P.charAt(T)==="/",M=z!=null&&(z===O||!r&&z.startsWith(O)&&z.charAt(O.length)==="/"),H={isActive:j,isPending:M,isTransitioning:C},F=j?t:void 0,ee;typeof i=="function"?ee=i(H):ee=[i,j?"active":null,M?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ae=typeof o=="function"?o(H):o;return y.createElement(eh,{...f,"aria-current":F,className:ee,ref:g,style:ae,to:c,viewTransition:d},typeof p=="function"?p(H):p)});gO.displayName="NavLink";var _O=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:c=vf,action:d,onSubmit:p,relative:f,preventScrollReset:g,viewTransition:_,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=y.useContext(gs),C=wO(),O=xO(d,{relative:f}),P=c.toLowerCase()==="get"?"get":"post",z=typeof d=="string"&&y5.test(d),T=j=>{if(p&&p(j),j.defaultPrevented)return;j.preventDefault();let M=j.nativeEvent.submitter,H=M?.getAttribute("formmethod")||c,F=()=>C(M||j.currentTarget,{fetcherKey:t,method:H,navigate:n,replace:r,state:o,relative:f,preventScrollReset:g,viewTransition:_,defaultShouldRevalidate:b});x&&n!==!1?y.startTransition(()=>F()):F()};return y.createElement("form",{ref:w,method:P,action:O,onSubmit:i?p:T,...S,"data-discover":!z&&e==="render"?"true":void 0})});_O.displayName="Form";function vO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function b5(e){let t=y.useContext(rc);return pn(t,vO(e)),t}function yO(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p,useTransitions:f}={}){let g=oc(),_=Ps(),b=Sh(e,{relative:c});return y.useCallback(S=>{if(X4(S,t)){S.preventDefault();let w=n!==void 0?n:Qu(_)===Qu(b),x=()=>g(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p});f?y.startTransition(()=>x()):x()}},[_,g,b,n,i,r,t,e,o,c,d,p,f])}var bO=0,SO=()=>`__${String(++bO)}__`;function wO(){let{router:e}=b5("useSubmit"),{basename:t}=y.useContext(gs),n=z4(),i=e.fetch,r=e.navigate;return y.useCallback(async(o,c={})=>{let{action:d,method:p,encType:f,formData:g,body:_}=Q4(o,t);if(c.navigate===!1){let b=c.fetcherKey||SO();await i(b,n,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:_,formMethod:c.method||p,formEncType:c.encType||f,flushSync:c.flushSync})}else await r(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:_,formMethod:c.method||p,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[i,r,t,n])}function xO(e,{relative:t}={}){let{basename:n}=y.useContext(gs),i=y.useContext(gr);pn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...Sh(e||".",{relative:t})},c=Ps();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),p=d.getAll("index");if(p.some(g=>g==="")){d.delete("index"),p.filter(_=>_).forEach(_=>d.append("index",_));let g=d.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Gs([n,o.pathname])),Qu(o)}function CO(e,{relative:t}={}){let n=y.useContext(h5);pn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=b5("useViewTransitionState"),r=Sh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Kr(n.currentLocation.pathname,i)||n.currentLocation.pathname,c=Kr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Wf(r.pathname,c)!=null||Wf(r.pathname,o)!=null}var Va=n5();const kO=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let tn=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function EO(e){const t=await fetch("/api/v1/theaters",{signal:e});await vi(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new tn(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>k5(i,t.status))}}async function TO(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await vi(i),BO(await i.json(),i.status)}async function AO(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await vi(t),PO(await t.json(),t.status)}async function RO(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const n=t.size>0?`?${t}`:"",i=await fetch(`/api/v1/updates/release-notes${n}`,{signal:e.signal});return await vi(i),zO(await i.json(),i.status)}async function NO(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await vi(t),$O(await t.json(),t.status)}async function S5(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await vi(n);const i=await n.json();return k5(i,n.status)}async function LO(e,t){const n=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await vi(n),qO(await n.json(),n.status)}async function w5(e,t){const n=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await vi(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new tn(n.status,"Invalid folder grant response");return i.folderGrantId}async function MO(e,t){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e}),signal:t});return await vi(n),await n.json()}async function OO(e,t,n){const i=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,name:t}),signal:n});return await vi(i),await i.json()}async function DO(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await vi(n)}async function Xi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await vi(i);const r=await i.json();if(!Array.isArray(r.operations))throw new tn(i.status,"Invalid operations response");return r.operations.map(o=>C5(o,i.status))}async function bo(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await vi(i);const r=await i.json();if(!Array.isArray(r.groups))throw new tn(i.status,"Invalid groups response");return r.groups.map(o=>Xb(o,i.status))}async function jO(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await vi(n);const i=await n.json();return Xb(i.group,n.status)}async function d_(e,t,n){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await vi(i);const r=await i.json();return Xb(r.group,i.status)}async function IO(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await vi(n)}async function x5(e,t,n){return bf(e,{title:t},n)}async function bf(e,t,n){const i=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await vi(i);const r=await i.json();return C5(r.operation,i.status)}function C5(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||th(n)||th(n.payload))throw new tn(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,accent:typeof n.accent=="string"?n.accent:null,groupId:n.groupId===null?null:typeof n.groupId=="string"?n.groupId:void 0,ts:n.ts}}function Xb(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.name!="string"||typeof n.color!="string"||typeof n.order!="number"||typeof n.createdAt!="number")throw new tn(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function k5(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string"||typeof n.createdAt!="string"||typeof n.lastOpenedAt!="string"||typeof n.hasWiki!="boolean"||typeof n.activeAdmiralCount!="number"||th(n))throw new tn(t,"Invalid Theater response");return n}function BO(e,t){const n=e;if(!n||typeof n.workspaces!="number"||typeof n.version!="string"||n.channel!=="stable"&&n.channel!=="local"&&n.channel!=="unknown"||typeof n.updateAvailable!="boolean"||typeof n.port!="number"||n.portMode!=="dynamic"&&n.portMode!=="static"||n.requestedPort!==null&&typeof n.requestedPort!="number"||typeof n.effectivePort!="number"||typeof n.portHonored!="boolean"||n.wikiServerStatus!=="available"&&n.wikiServerStatus!=="unavailable"&&n.wikiServerStatus!=="unknown")throw new tn(t,"Invalid status response");return{workspaces:n.workspaces,version:n.version,channel:n.channel,updateAvailable:n.updateAvailable,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:void 0,port:n.port,portMode:n.portMode,requestedPort:n.requestedPort,effectivePort:n.effectivePort,portHonored:n.portHonored,wikiServerStatus:n.wikiServerStatus}}function PO(e,t){const n=e;if(!n||n.channel!=="local"||typeof n.version!="string"||typeof n.effectivePort!="number"||typeof n.dataDir!="string"||typeof n.lockFile!="string"||Object.keys(n).length!==5)throw new tn(t,"Invalid environment response");return n}function $O(e,t){const n=e;if(!n||n.status!=="accepted")throw new tn(t,"Invalid update response");return{status:"accepted"}}function zO(e,t){const n=e;if(!n||!Array.isArray(n.notes)||n.sourceRef!=="main"||typeof n.fetchedAt!="number"||typeof n.stale!="boolean"||"url"in n||"token"in n||"path"in n)throw new tn(t,"Invalid release notes response");return{notes:n.notes.map(i=>HO(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function HO(e,t){const n=e;if(!n||typeof n.version!="string"||n.date!==null&&typeof n.date!="string"||!Array.isArray(n.sections)||typeof n.localizationFallback!="boolean")throw new tn(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>FO(i,t)),localizationFallback:n.localizationFallback}}function FO(e,t){const n=e;if(!n||n.heading!=="Added"&&n.heading!=="Changed"&&n.heading!=="Fixed"&&n.heading!=="Removed"&&n.heading!=="Breaking Changes"||!Array.isArray(n.items))throw new tn(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>UO(i,t))}}function UO(e,t){const n=e;if(!n||!Array.isArray(n.packageTags)||!n.packageTags.every(i=>typeof i=="string")||typeof n.text!="string"||"product"in n&&!WO(n.product))throw new tn(t,"Invalid release notes response");return"product"in n?{packageTags:n.packageTags,text:n.text,product:n.product}:{packageTags:n.packageTags,text:n.text}}function WO(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function qO(e,t){const n=e;if(!n||typeof n.path!="string"||n.parentPath!==null&&typeof n.parentPath!="string"||!Array.isArray(n.roots)||!Array.isArray(n.entries)||th(n))throw new tn(t,"Invalid folder list response");return{path:n.path,parentPath:n.parentPath??null,roots:n.roots.filter(i=>typeof i=="string"),entries:n.entries.map(i=>GO(i,t)),truncated:n.truncated===!0?!0:void 0}}function GO(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||th(n))throw new tn(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function th(e){if(!e||typeof e!="object")return!1;const t=e;return kO.some(n=>n in t)}async function vi(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const n=await e.json();typeof n.error=="string"?t=n.error:typeof n.message=="string"&&(t=n.message)}catch{}throw new tn(e.status,t)}function sC(e,t){return e!==null&&e===t?e:null}function KO(e,t){return e&&t}function VO(e,t){return e?!1:t}const YO="__unassigned__";function XO(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(QO(i,t.get(i.theaterId)));return n}function ZO(e,t){const n=E5(t);return n.length===0?e:e.filter(i=>{const r=eD(i);return n.every(o=>r.includes(o))})}function JO(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??YO,o=n.get(r);if(o!==void 0){const c=t[o];c&&(t[o]={...c,entries:[...c.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function E5(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function QO(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function eD(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const tD=200,nD=.5,iD="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",sD=["monospace","serif","sans-serif"],Nu=new Map;function rD(e,t={}){const n=Np(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=Nu.get(i);if(r!==void 0)return r;const o=t.document??globalThis.document;if(!o)return!1;const c=o.createElement("canvas").getContext("2d");if(!c)return!1;const d=sD.some(p=>{const f=rC(c,`${T5(n)}, ${p}`),g=rC(c,p);return Math.abs(f-g)>nD});return aD(i,d,t.maxEntries??tD),d}function T5(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Gf(e,t){const n=Np(e);return n?`${T5(n)}, ${t}`:t}function Np(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function rC(e,t){return e.font=`28px ${t}`,e.measureText(iD).width}function aD(e,t,n){if(Nu.size>=Math.max(1,n)){const i=Nu.keys().next().value;i&&Nu.delete(i)}Nu.set(e,t)}const Ul={min:12,max:18,step:1,defaultValue:14},Wu={source:"builtin",id:"manrope",size:Ul.defaultValue},Kf=[{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 oD(e){if(!e||typeof e!="object")return Wu;const t=e,n=lD(t.size);if(t.source==="builtin"&&uD(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Np(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Wu}function lD(e){return typeof e!="number"||!Number.isInteger(e)||e<Ul.min||e>Ul.max?Ul.defaultValue:e}function A5(e){return e.source==="system"?Gf(e.familyName,Kf[0].family):cD(e.id).family}function cD(e){return Kf.find(t=>t.id===e)??Kf[0]}function uD(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const zv="fleet-console.activeTheaterId",R5="fleet-console.commissioningSeen",N5="fleet-console.whatsNewSeenVersion",L5="fleet-console.notificationPreferences",M5=1,hD="instrument",Hd={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Hv=new Set;let aC=0,Fv=null,Je={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:hD,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:HD(),codexReader:null,codexReaderExpanded:!1};function nh(){return Je}function O5(e){return Hv.add(e),()=>{Hv.delete(e)}}function vt(e){Je={...Je,...e},BD()}function dD(e){Je.operationsViewActive!==e&&vt({operationsViewActive:e})}function Vf(e){_D(e),vt({activeTheme:e})}function Uv(e){yD(e)}function fD(e){vt({channel:e.channel,version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...H5({...Je,version:e.version})})}function pD(){vt({releaseNotesLoading:!0,releaseNotesError:null})}function mD(e){const t={...Je,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Je.selectedReleaseNoteKey&&U5(e.notes,Je.selectedReleaseNoteKey)?Je.selectedReleaseNoteKey:F5(e.notes)};vt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...H5(t)})}function gD(e){vt({releaseNotesLoading:!1,releaseNotesError:e})}function _D(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function vD(){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 yD(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",A5(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function bD(e){const t=z5(e,Je.activeTheaterId);vt({theaters:e,activeTheaterId:t})}function SD(e){bD(e.theaters)}function fs(e){vt({operations:e,operationsHydrated:!0})}function wD(e){const t=new Set(e.map(i=>i.id)),n=Je.operations.filter(i=>!t.has(i.id));vt({operations:[...e,...n],operationsHydrated:!0})}function xD(e){const t=Je.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Je.operations];n[t]=e,vt({operations:n})}function So(e){vt({groups:e})}function CD(e){Lp(e),vt({activeTheaterId:e})}function Mi(e){Je.activeOperationId!==e&&vt({activeOperationId:e})}function kD(e,t){if(t==="idle"){D5(e);return}Je.operationStatus[e]!==t&&vt({operationStatus:{...Je.operationStatus,[e]:t}})}function D5(e){if(!(e in Je.operationStatus))return;const t={...Je.operationStatus};delete t[e],vt({operationStatus:t})}function ED(e){if(!e.operationId)return;const t=Je.operations.find(c=>c.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Je.theaters.find(c=>c.id===n)?.label??n??"Unknown",r=t.title,o=$D(e.kind);aC+=1,vt({operationNotifications:{...Je.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:aC}}})}function j5(){vt({addingTheater:!0,theaterError:null})}function I5(e){const t=[e,...Je.theaters.filter(n=>n.id!==e.id)];Lp(e.id),vt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function TD(){vt({addingTheater:!1,theaterError:null})}function Wv(e){vt({addingTheater:!1,theaterError:e})}function ih(e){const t=Je.operations.find(n=>n.id===e);t&&(Lp(t.theaterId),vt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:$5(Je.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function f_(){Je.pendingOperationFocus!==null&&vt({pendingOperationFocus:null})}function AD(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,r=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[r]??null}function Zb(e,t){if(t.length===0)return[...e].sort(qv);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),c=n.get(r.id);return o!==void 0&&c!==void 0?o-c:o!==void 0?-1:c!==void 0?1:qv(i,r)})}function B5(e,t,n,i=[]){const r=Zb(e,n),o=new Set(i),c=[...t].sort((p,f)=>p.order-f.order||p.createdAt-f.createdAt),d=new Map;for(const p of c)d.set(p.id,[]);d.set(null,[]);for(const p of r){const f=p.groupId??null;f!==null&&d.has(f)?d.get(f).push(p):d.get(null).push(p)}return[...c.filter(p=>!o.has(p.id)).flatMap(p=>d.get(p.id)??[]),...d.get(null)??[]]}function RD(e,t,n,i,r){const o=new Set(r),c=B5(e,t,n,i),d=c.filter(p=>!o.has(p.id));return(d.length>0?d:c).map(p=>p.id)}function qv(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function p_(){vt({operationSearchOpen:!1})}function P5(){vt({operationSearchOpen:!Je.operationSearchOpen})}function ND(){Je.releaseNotes.length===0||Je.whatsNewOpen||vt({whatsNewOpen:!0,selectedReleaseNoteKey:Je.selectedReleaseNoteKey??F5(Je.releaseNotes)})}function Fd(){Je.whatsNewOpen&&(Je.automaticWhatsNewVersion&&qD(Je.automaticWhatsNewVersion),vt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function oC(e){U5(Je.releaseNotes,e)&&vt({selectedReleaseNoteKey:e})}function au(){UD(!0),Je.onboardingOpen&&vt({onboardingOpen:!1})}function or(e){vt({codexReader:e,codexReaderExpanded:!1})}function Sf(){Je.codexReader!==null&&vt({codexReaderExpanded:!0})}function LD(){vt({codexReaderExpanded:!1})}function m_(){vt({codexReader:null,codexReaderExpanded:!1})}function lC(){if(Je.bootstrapped)return;const e=Je.theaters.length===0&&!FD();vt({bootstrapped:!0,onboardingOpen:e?!0:Je.onboardingOpen})}function cC(e){const t=Je.theaters.filter(c=>c.id!==e),n=z5(t,Je.activeTheaterId===e?null:Je.activeTheaterId),i=PD(Je.operationNotifications,e),r=new Set(Je.operations.filter(c=>c.theaterId===e).map(c=>c.id)),o=Je.activeOperationId&&r.has(Je.activeOperationId)?null:Je.activeOperationId;Lp(n),vt({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function MD(e){const t=$5(Je.operationNotifications,e);t!==Je.operationNotifications&&vt({operationNotifications:t})}function OD(e){const t={...Je.notificationPreferences,globalMute:e};Qb(t),vt({notificationPreferences:t})}function DD(e){const t={...Je.notificationPreferences,dnd:e};Qb(t),vt({notificationPreferences:t})}function jD(e){const t={...Je.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Je.notificationPreferences,mutedTheaterIds:t};Qb(n),vt({notificationPreferences:n})}function ID(e){return XO(e)}function BD(){for(const e of Hv)e()}function $5(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function PD(e,t){let n=!1;const i={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[r]=o}return n?i:e}function z5(e,t){const n=new Set(e.map(r=>r.id)),i=zD();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function $D(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function H5(e){const t=e.releaseNotes.findIndex(i=>i.version!=="Unreleased"),n=t>=0?e.releaseNotes[t]:void 0;return!n||!e.version||n.version!==e.version||WD()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:Jb(n.version,t)}}function F5(e){return e[0]?Jb(e[0].version,0):null}function U5(e,t){return e.some((n,i)=>Jb(n.version,i)===t)}function Jb(e,t){return`${e}:${t}`}function zD(){if(typeof window>"u")return null;try{return window.localStorage.getItem(zv)}catch{return null}}function Lp(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(zv,e):window.localStorage.removeItem(zv)}catch{}}function HD(){if(typeof window>"u")return Hd;try{const e=window.localStorage.getItem(L5);if(!e)return Hd;const t=JSON.parse(e);return GD(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Hd}catch{return Hd}}function FD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(R5)==="1"}catch{return!1}}function UD(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(R5,"1")}catch{}}function WD(){if(Fv!==null)return Fv;if(typeof window>"u")return null;try{return window.localStorage.getItem(N5)}catch{return null}}function qD(e){if(Fv=e,!(typeof window>"u"))try{window.localStorage.setItem(N5,e)}catch{}}function Qb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(L5,JSON.stringify({version:M5,preferences:e}))}catch{}}function GD(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==M5||!t.preferences||typeof t.preferences!="object")return!1;const n=t.preferences;return typeof n.globalMute=="boolean"&&typeof n.dnd=="boolean"&&!!n.mutedTheaterIds&&typeof n.mutedTheaterIds=="object"}function Xs(){return y.useSyncExternalStore(O5,nh,nh)}const KD=[{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"}]}],Lu="data-keyboard-shortcuts-open",VD='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function W5(){return document.body.getAttribute(Lu)==="true"}function YD(){return!W5()}function XD({onClose:e}){const t=y.useRef(null);y.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Lu);return document.body.setAttribute(Lu,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Lu):document.body.setAttribute(Lu,o),r&&(r.inert=!1)}},[e]);const n=i=>{if(i.key==="Escape"){i.preventDefault(),e();return}if(i.key!=="Tab")return;const r=[...t.current?.querySelectorAll(VD)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],c=r[r.length-1],d=document.activeElement;(d===t.current||!t.current?.contains(d)||(i.shiftKey?d===o:d===c))&&(i.preventDefault(),(i.shiftKey?c:o)?.focus())};return Va.createPortal(u.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:u.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:n,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[u.jsx("strong",{children:"Keyboard Shortcuts"}),u.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),KD.map(i=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:i.title}),u.jsx("dl",{children:i.entries.map(r=>u.jsxs("div",{children:[u.jsx("dt",{children:r.combos.map((o,c)=>u.jsxs("span",{children:[c>0?" or ":null,o.map(d=>u.jsx("kbd",{children:d==="Mod"?"⌘/Ctrl":d},d))]},o.join("+")))}),u.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const ZD=1400,JD="https://github.com/sbluemin/fleet-harness",QD="https://github.com/sbluemin/fleet-harness/stargazers",ej="https://api.github.com/repos/sbluemin/fleet-harness",e0="fleet-console.github-stars",tj=360*60*1e3,uC='[role="menuitem"]:not([disabled])';function nj(){const e=Xs();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(sj,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(rj,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function ij({className:e="brand-foot-home"}){return u.jsxs(eh,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(gj,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function sj({latestVersion:e,updateAvailable:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),d=oc();q5(n,i,r,o,c);const p=f=>{c(!1),d(f),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>c(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[u.jsx(hC,{}),u.jsx("span",{children:"System Menu"})]}),o?u.jsxs("div",{ref:r,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/settings"),children:[u.jsx(hC,{}),u.jsx("span",{children:"Settings"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(aj,{latestVersion:e})]}):null]}):null]})}function rj({releaseDisabled:e,version:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),[d,p]=y.useState(!1);return q5(n,i,r,o,c),u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>c(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:u.jsx(_j,{})}),o?u.jsxs("div",{ref:r,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[u.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{c(!1),ND()},children:[u.jsx(vj,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),p(!0)},children:[u.jsx(yj,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(oj,{menuItem:!0,version:t})]}):null,d?u.jsx(XD,{onClose:()=>{p(!1),i.current?.focus()}}):null]})}function q5(e,t,n,i,r){y.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(uC)?.focus()}),c=p=>{p.target instanceof Node&&e.current?.contains(p.target)||r(!1)},d=p=>{if(p.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(p.key))return;const f=[...n.current?.querySelectorAll(uC)??[]];if(f.length===0)return;p.preventDefault();const g=f.findIndex(b=>b===document.activeElement),_=p.key==="Home"||p.key==="ArrowDown"&&g===f.length-1?0:p.key==="End"||p.key==="ArrowUp"&&g<=0?f.length-1:p.key==="ArrowDown"?g+1:g-1;f[_]?.focus()};return window.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",d,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",d,!0)}},[n,i,e,r,t])}function aj({latestVersion:e}){const[t,n]=y.useState("idle"),[i,r]=y.useState(null),o=y.useRef(null),c=lj(t,i,e);y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const d=async()=>{if(!c.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await NO()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},ZD)}catch(p){const f=p instanceof tn?p.message:"network_error";r(f),n(uj(f)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${c.tone}`,onClick:d,disabled:c.disabled,title:c.title,"aria-live":"polite",children:c.label})}function oj({menuItem:e=!1,version:t}){const n=hj(),i=n.count!==null;return u.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"brand-foot-github-link",href:JD,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(bj,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:QD,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":i?`GitHub stars ${n.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(Sj,{}),i?u.jsx("span",{className:"brand-foot-github-stars-count",children:mj(n.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function lj(e,t,n){const i=n?`Latest version ${n}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?cj(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:i,tone:"warn",disabled:!1}}function cj(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 uj(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function hj(){const[e,t]=y.useState(()=>{const n=dj();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return y.useEffect(()=>{if(fj())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(ej,{headers:{Accept:"application/vnd.github+json"}}).then(i=>i.ok?i.json():Promise.reject(new Error(`status ${i.status}`))).then(i=>{if(n)return;const r=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}pj(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function dj(){try{const e=window.localStorage.getItem(e0);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function fj(){try{const e=window.localStorage.getItem(e0);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<tj}catch{return!1}}function pj(e){try{window.localStorage.setItem(e0,JSON.stringify({count:e,at:Date.now()}))}catch{}}function mj(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function gj(){return u.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),u.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),u.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),u.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),u.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),u.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function hC(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function _j(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.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"}),u.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function vj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function yj(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function bj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function Sj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}const wj=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class Ks extends Error{status;constructor(t,n){super(n),this.status=t}}async function xj(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await Op(n),K5(await n.json(),n.status)}async function G5(e,t,n){t!==null&&V5(t);const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:n});return await Op(i),K5(await i.json(),i.status)}async function Cj(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await Op(n),Ej(await n.json(),n.status)}async function kj(e,t,n){t!==null&&V5(t);const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:n});return await Op(i),Tj(await i.json(),i.status)}function K5(e,t=200){sh(e,t);const n=e;if(n.kind!=="root"&&n.kind!=="worktree"&&n.kind!=="directory"||!Y5(n.label))throw new Ks(t,"Invalid path context response");if(n.relPath!==null&&(typeof n.relPath!="string"||!Mp(n.relPath)))throw new Ks(t,"Invalid path context response");if(n.kind==="root"!=(n.relPath===null))throw new Ks(t,"Invalid path context response");return{kind:n.kind,relPath:n.relPath,label:n.label}}function Ej(e,t=200){sh(e,t);const n=e;if(typeof n.isGitRepo!="boolean"||!Array.isArray(n.worktrees))throw new Ks(t,"Invalid worktrees response");return{isGitRepo:n.isGitRepo,worktrees:n.worktrees.map(i=>{sh(i,t);const r=i;if(typeof r.relPath!="string"||!Mp(r.relPath)||r.branch!==null&&typeof r.branch!="string"||typeof r.isCurrent!="boolean")throw new Ks(t,"Invalid worktrees response");return{relPath:r.relPath,branch:r.branch,isCurrent:r.isCurrent}})}}function Tj(e,t=200){sh(e,t);const n=e;if(!Array.isArray(n.directories))throw new Ks(t,"Invalid directories response");return n.directories.map(i=>{sh(i,t);const r=i;if(typeof r.relPath!="string"||!Mp(r.relPath)||!Y5(r.label))throw new Ks(t,"Invalid directories response");return{relPath:r.relPath,label:r.label}})}function V5(e){if(!Mp(e))throw new Ks(400,"Invalid relative path")}function Mp(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 Y5(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function sh(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Ks(t,"Invalid path context response");for(const n of Object.keys(e))if(wj.has(n.toLowerCase()))throw new Ks(t,"Unsafe path context response")}async function Op(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Ks(e.status,t)}function Aj({theaterId:e,parentPath:t,selectedRelPath:n,isDisabled:i,loadDirectories:r,onSelect:o}){const[c,d]=y.useState(null),[p,f]=y.useState(null);return y.useEffect(()=>{const g=new AbortController;return d(null),f(null),r(t,g.signal).then(d).catch(_=>{g.signal.aborted||f(_ instanceof Error?_.message:"Unable to load directories")}),()=>g.abort()},[e,t,r]),p?y.createElement("div",{className:"rail-context-tree-status"},p):c?y.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},c.map(g=>y.createElement(X5,{key:g.relPath,directory:g,theaterId:e,depth:0,selectedRelPath:n,isDisabled:i,loadDirectories:r,onSelect:o}))):y.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function X5({directory:e,theaterId:t,depth:n,selectedRelPath:i,isDisabled:r,loadDirectories:o,onSelect:c}){const[d,p]=y.useState(!1),[f,g]=y.useState(null),[_,b]=y.useState(!1),S=y.useCallback(()=>{if(d){p(!1);return}if(p(!0),f)return;const C=new AbortController;b(!0),o(e.relPath,C.signal).then(g).catch(()=>g([])).finally(()=>b(!1))},[f,e.relPath,d,o]),w=y.createElement("div",{className:`rail-context-tree-row${n>0?" is-nested":""}`,style:{paddingLeft:`${n*16}px`}},y.createElement("button",{className:`rail-context-expand${d?" is-expanded":""}`,type:"button",disabled:r,"aria-label":`${d?"Collapse":"Expand"} ${e.label}`,onClick:S},"▸"),y.createElement("button",{className:`rail-context-select${i===e.relPath?" is-selected":""}`,type:"button",disabled:r,onClick:()=>c(e.relPath)},y.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),y.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),y.createElement("span",{className:"rail-context-row-label"},e.label))),x=d&&f?.map(C=>y.createElement(X5,{key:C.relPath,directory:C,theaterId:t,depth:n+1,selectedRelPath:i,isDisabled:r,loadDirectories:o,onSelect:c}));return y.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":d},w,d&&_?y.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,x)}const Z5=y.forwardRef(function({className:t,theaterId:n,theaterLabel:i,context:r,isMutating:o,onSelect:c,onClose:d},p){const[f,g]=y.useState(null);y.useEffect(()=>{const S=new AbortController;return Cj(n,S.signal).then(g).catch(()=>g({isGitRepo:!1,worktrees:[]})),()=>S.abort()},[n]),y.useEffect(()=>{const S=w=>{w.key==="Escape"&&d()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[d]);const _=y.useCallback((S,w)=>kj(n,S,w),[n]),b=y.useCallback(S=>{o||c(S)},[o,c]);return u.jsxs("div",{ref:p,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[u.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),u.jsxs("button",{className:`rail-context-row${r.relPath===null?" is-selected":""}`,type:"button",disabled:o,onClick:()=>b(null),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),u.jsx("span",{className:"rail-context-row-label",children:i}),u.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),u.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[u.jsx("h3",{children:"DIRECTORIES"}),u.jsx(Aj,{theaterId:n,parentPath:null,selectedRelPath:r.relPath,isDisabled:o,loadDirectories:_,onSelect:b},`${n}:${r.relPath??"root"}`)]}),f?.isGitRepo?u.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[u.jsx("h3",{children:"WORKTREES"}),f.worktrees.map(S=>u.jsxs("button",{className:`rail-context-row${r.relPath===S.relPath?" is-selected":""}`,type:"button",title:S.relPath,disabled:o,onClick:()=>b(S.relPath),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),u.jsx("span",{className:"rail-context-row-label",children:S.relPath.split("/").at(-1)}),S.branch?u.jsx("span",{className:"rail-context-row-secondary",children:S.branch}):null]},S.relPath))]}):null,u.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),Yf="fleet-console.rail.activePanelId",J5="fleet-console.rail.chromeExpanded",Rj="fleet-console.repository.source",Gv=new Set,Ao=new Map,Kv=new Map,Wl=new Map,qu=new Map;let Xf=null,Mu=0,Bt={activeRailPanelId:Bj(),railChromeExpanded:Pj(),panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function Nj(e,t,n){return!e||t===null||n}function Dp(e){return Gv.add(e),()=>{Gv.delete(e)}}function jp(){return Bt}function Lj(e){const t=Bt.activeRailPanelId===e?null:e;ms({...Bt,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),rT(t)}function Mj(){Bt.activeRailPanelId!==null&&(ms({...Bt,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),rT(null))}function Oj(e){Bt.railChromeExpanded!==e&&(ms({...Bt,railChromeExpanded:e,isPathContextDeckOpen:!1}),$j(e))}function Q5(){Oj(!Bt.railChromeExpanded)}function Dj(e,t){if(e!==Bt.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),r=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;r!==Bt.panelExtraWidth&&ms({...Bt,panelExtraWidth:r})}function eT(e){Xf?.abort(),Xf=null,Mu+=1;const t=e?Ao.get(e):void 0;ms({...Bt,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&aT(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function jj(e,t){Bt.pathContextTheaterId!==e&&eT(e),Xf?.abort();const n=new AbortController;Xf=n;const i=++Mu,r=qu.get(e)??0;Ao.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),Bt.pathContextTheaterId===e&&ms({...Bt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(Kv.get(e)??Promise.resolve()),n.signal.aborted||i!==Mu)return;const o=await t(n.signal);if(n.signal.aborted||i!==Mu||r!==(qu.get(e)??0))return;const c={context:o,isHydrated:!0,isLoading:!1,error:null};Ao.set(e,c),Bt.pathContextTheaterId===e&&ms({...Bt,pathContext:o,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(o){if(n.signal.aborted||i!==Mu||r!==(qu.get(e)??0))return;const c=o instanceof Error?o.message:"Unable to load path context";Ao.set(e,{context:null,isHydrated:!1,isLoading:!1,error:c}),Bt.pathContextTheaterId===e&&ms({...Bt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:c})}}async function tT(e,t){if(Bt.pathContextTheaterId!==e)return null;qu.set(e,(qu.get(e)??0)+1),Hj(e);const i=(Kv.get(e)??Promise.resolve()).then(()=>zj(e,t));return Kv.set(e,i.then(()=>{})),i}function wf(e){e!==Bt.isPathContextDeckOpen&&ms({...Bt,isPathContextDeckOpen:e})}function nT(){return y.useSyncExternalStore(Dp,jp).activeRailPanelId}function iT(){return y.useSyncExternalStore(Dp,jp).railChromeExpanded}function Ij(){return y.useSyncExternalStore(Dp,jp).panelExtraWidth}function sT(){return y.useSyncExternalStore(Dp,jp)}function Bj(){try{const e=localStorage.getItem(Yf);if(e==="diff"||e==="history"){try{localStorage.setItem(Yf,"repository"),e==="history"&&localStorage.setItem(Rj,"history")}catch{}return"repository"}return e}catch{return null}}function Pj(){try{return localStorage.getItem(J5)!=="0"}catch{return!0}}function rT(e){try{e===null?localStorage.removeItem(Yf):localStorage.setItem(Yf,e)}catch{}}function $j(e){try{localStorage.setItem(J5,e?"1":"0")}catch{}}async function zj(e,t){try{const n=await t(new AbortController().signal),i={context:n,isHydrated:!0,isLoading:!1,error:null};return Ao.set(e,i),Bt.pathContextTheaterId===e&&ms({...Bt,pathContext:n,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),n}catch(n){const i=n instanceof Error?n.message:"Unable to save path context",r=Ao.get(e);return Ao.set(e,{context:r?.context??null,isHydrated:r?.isHydrated??!1,isLoading:!1,error:i}),Bt.pathContextTheaterId===e&&ms({...Bt,pathContextError:i}),null}finally{Fj(e)}}function aT(e){return(Wl.get(e)??0)>0}function Hj(e){Wl.set(e,(Wl.get(e)??0)+1),Bt.pathContextTheaterId===e&&ms({...Bt,pathContextMutationInProgress:!0,pathContextError:null})}function Fj(e){const t=(Wl.get(e)??1)-1;t>0?Wl.set(e,t):Wl.delete(e),Bt.pathContextTheaterId===e&&ms({...Bt,pathContextMutationInProgress:aT(e)})}function ms(e){Bt=e;for(const t of Gv)t()}function oT(e){const{sizeRange:t}=e,[n,i]=y.useState(""),[r,o]=y.useState(e.size),c=y.useRef(Promise.resolve()),d=y.useId(),p=y.useMemo(()=>Uj(e),[e]),f=y.useMemo(()=>Wj(p,n),[p,n]),g=y.useMemo(()=>f.map((M,H)=>({row:M,index:H})),[f]),[_,b]=y.useState(()=>qj(p,e.selected)),S=p.find(M=>Zf(M.selection,e.selected))??null,w=g[Math.min(_,Math.max(0,g.length-1))]?.row??null,x=`${d}-built-ins`,C=`${d}-installed`;y.useEffect(()=>{o(e.size)},[e.size]),y.useEffect(()=>{_>=g.length&&b(Math.max(0,g.length-1))},[_,g.length]);const O=y.useCallback(M=>{const H=fC(M,t);o(H),c.current=c.current.catch(()=>{}).then(()=>e.onSizeCommit(H))},[e.onSizeCommit,t]),P=y.useCallback(M=>{f.length&&b(H=>(H+M+f.length)%f.length)},[f.length]),z=y.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),T=y.useCallback((M,H)=>{b(M),e.onSelectionChange(H)},[e]),j=M=>{M.key==="ArrowDown"?(M.preventDefault(),P(1)):M.key==="ArrowUp"?(M.preventDefault(),P(-1)):M.key==="Home"?(M.preventDefault(),b(0)):M.key==="End"?(M.preventDefault(),b(Math.max(0,f.length-1))):(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),z())};return u.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:u.jsxs("div",{className:"fc-font-browser__panes",children:[u.jsxs("div",{className:"fc-font-browser__chooser",children:[u.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${d}-search`,children:"Search fonts"}),u.jsx("input",{id:`${d}-search`,className:"fc-font-browser__search",type:"search",value:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:M=>{i(M.currentTarget.value),b(0)}}),e.loading?u.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?u.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,u.jsxs("div",{id:d,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?lT(d,_):void 0,"aria-busy":e.loading||void 0,onKeyDown:j,children:[u.jsx(dC,{groupId:x,label:"Built-in",rows:g.filter(({row:M})=>M.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(dC,{groupId:C,label:"Installed on this machine",rows:g.filter(({row:M})=>M.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),!e.loading&&!g.length?u.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),u.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[u.jsxs("div",{className:"fc-font-browser__preview-head",children:[u.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),u.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),u.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),u.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>O(r-t.step),"aria-label":"Decrease font size",children:"−"}),u.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>O(r+t.step),"aria-label":"Increase font size",children:"+"})]}),u.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:M=>o(fC(Number(M.currentTarget.value),t)),onPointerUp:M=>O(Number(M.currentTarget.value)),onKeyUp:M=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(M.key)&&O(Number(M.currentTarget.value))}})]})]})})}function dC({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:c,onSelect:d}){return u.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[u.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:p,index:f})=>u.jsxs("button",{id:lT(o,f),type:"button",className:`fc-font-browser__row${Zf(p.selection,i?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Zf(p.selection,r),disabled:c||p.unavailable,onClick:()=>d(f,p.selection),children:[u.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:p.previewFamily},children:p.label}),p.description?u.jsx("span",{className:"fc-font-browser__row-meta",children:p.description}):null,p.unavailable?u.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},p.id))]})}function Uj(e){const t=new Set,n=e.builtIns.flatMap(o=>{const c=[o.id,o.label,...o.aliases??[]].map(Gu);return c.some(d=>t.has(d))?[]:(c.forEach(d=>t.add(d)),[{id:`builtin-${o.id}`,label:o.label,family:o.family,previewFamily:o.family,source:"builtin",selection:{source:"builtin",id:o.id},description:o.description,unavailable:!1}])}),i=e.installedFonts.map(o=>({id:`system-${Gu(o.family)}`,label:o.family,family:o.family,previewFamily:Gf(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!rD(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${Gu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:Gf(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function Wj(e,t){const n=Gu(t);return n?e.filter(i=>Gu(`${i.label} ${i.description??""}`).includes(n)):e}function Gu(e){return e.trim().toLocaleLowerCase()}function lT(e,t){return`${e}-option-${t}`}function qj(e,t){const n=e.findIndex(i=>Zf(i.selection,t));return n>=0?n:0}function Zf(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function fC(e,t){if(!Number.isFinite(e))return t.defaultValue;const n=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,n))}const Gj="/api/v1/settings/fonts/system";class Il extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function Kj(e){if(!uT(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new Il("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(Vj)}}async function cT(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new Il("System font fetching is unavailable in this environment.");let n;try{n=await t(Gj,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new Il("System fonts could not be loaded.")}if(!n.ok)throw new Il("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new Il("System font response is not valid JSON.",n.status)}return Kj(i)}function Vj(e){if(!uT(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new Il("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function Yj(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function uT(e,t){return Yj(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const pC=250,Xj=5e3,mC=1,Zj=1013,Jj=4e3,Qj=4001;function eI(e){const t=new AbortController,n=new TextEncoder;let i=pC,r=null,o=null,c=null,d=!1;const p=()=>{o?.dispose(),o=null},f=(b,S)=>{c={cols:b,rows:S},r?.readyState===mC&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await nI(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await _(tI(b,e.location,e.wsPath),e),i=pC}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await sI(i,t.signal),i=Math.min(i*2,Xj)}},_=async(b,S)=>{await new Promise((w,x)=>{const C=(S.webSocketFactory??iI)(b);r=C,C.binaryType="arraybuffer",C.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(O=>{C.readyState===mC&&C.send(n.encode(O))}),c&&f(c.cols,c.rows)},C.onmessage=O=>{O.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(O.data))},C.onerror=()=>{x(new Error("Terminal WebSocket error"))},C.onclose=O=>{p(),r===C&&(r=null);const P=O?.code;P===Jj?(t.abort(),S.onStatus?.("closed","terminal_replaced")):P===Qj?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):P===Zj&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{d||(d=!0,g())},resize:f,dispose:()=>{t.abort(),p(),e.onStatus?.("closed"),r?.close(),r=null}}}function tI(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function nI(e,t,n){const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:n});if(!i.ok)throw new Error(`Terminal ticket request failed: ${i.status}`);const r=await i.json();if(typeof r.ticket!="string"||typeof r.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:r.ticket,ttlMs:r.ttlMs}}function iI(e){return new WebSocket(e)}async function sI(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var rI=2,aI=1,oI=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=c.top+c.bottom,p=c.right+c.left,f=i-d,g=r-p-t;return{cols:Math.max(rI,Math.floor(g/e.css.cell.width)),rows:Math.max(aI,Math.floor(f/e.css.cell.height))}}};var 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]],lI=[[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]],Gn;function cI(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var uI=class{constructor(){if(this.version="6",!Gn){Gn=new Uint8Array(65536),Gn.fill(1),Gn[0]=0,Gn.fill(0,1,32),Gn.fill(0,127,160),Gn.fill(2,4352,4448),Gn[9001]=2,Gn[9002]=2,Gn.fill(2,11904,42192),Gn[12351]=1,Gn.fill(2,44032,55204),Gn.fill(2,63744,64256),Gn.fill(2,65040,65050),Gn.fill(2,65072,65136),Gn.fill(2,65280,65377),Gn.fill(2,65504,65511);for(let t=0;t<g_.length;++t)Gn.fill(0,g_[t][0],g_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Gn[t]:cI(t,lI)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=Qf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Qf.createPropertyValue(0,i,r)}},hI=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?gC.isErrorNoTelemetry(t)?new gC(t.message+`
|
|
12
|
-
|
|
13
|
-
`+t.stack):new Error(t.message+`
|
|
14
|
-
|
|
15
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(n=>{n(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},dI=new hI;function __(e){fI(e)||dI.onUnexpectedError(e)}var Vv="Canceled";function fI(e){return e instanceof pI?!0:e instanceof Error&&e.name===Vv&&e.message===Vv}var pI=class extends Error{constructor(){super(Vv),this.name=this.message}},gC=class Yv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Yv)return t;let n=new Yv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function mI(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var gI;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(gI||={});var hT;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let j=T.length-1;j>=0;j--)yield T[j]}e.reverse=d;function p(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(T){return T[Symbol.iterator]().next().value}e.first=f;function g(T,j){let M=0;for(let H of T)if(j(H,M++))return!0;return!1}e.some=g;function _(T,j){for(let M of T)if(j(M))return M}e.find=_;function*b(T,j){for(let M of T)j(M)&&(yield M)}e.filter=b;function*S(T,j){let M=0;for(let H of T)yield j(H,M++)}e.map=S;function*w(T,j){let M=0;for(let H of T)yield*j(H,M++)}e.flatMap=w;function*x(...T){for(let j of T)yield*j}e.concat=x;function C(T,j,M){let H=M;for(let F of T)H=j(H,F);return H}e.reduce=C;function*O(T,j,M=T.length){for(j<0&&(j+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);j<M;j++)yield T[j]}e.slice=O;function P(T,j=Number.POSITIVE_INFINITY){let M=[];if(j===0)return[M,T];let H=T[Symbol.iterator]();for(let F=0;F<j;F++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=P;async function z(T){let j=[];for await(let M of T)j.push(M);return Promise.resolve(j)}e.asyncToArray=z})(hT||={});function dT(e){if(hT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function _I(...e){return fT(()=>dT(e))}function fT(e){return{dispose:mI(()=>{e()})}}var pT=class mT{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{dT(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?mT.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)}};pT.DISABLE_DISPOSED_WARNING=!1;var t0=pT,Jf=class{constructor(){this._store=new t0,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)}};Jf.None=Object.freeze({dispose(){}});var vI=globalThis.performance&&typeof globalThis.performance.now=="function",yI=class gT{static create(t){return new gT(t)}constructor(t){this._now=vI&&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}},bI;(e=>{e.None=()=>Jf.None;function t(B,N){return _(B,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(B){return(N,R=null,A)=>{let E=!1,L;return L=B($=>{if(!E)return L?L.dispose():E=!0,N.call(R,$)},null,A),E&&L.dispose(),L}}e.once=n;function i(B,N,R){return f((A,E=null,L)=>B($=>A.call(E,N($)),null,L),R)}e.map=i;function r(B,N,R){return f((A,E=null,L)=>B($=>{N($),A.call(E,$)},null,L),R)}e.forEach=r;function o(B,N,R){return f((A,E=null,L)=>B($=>N($)&&A.call(E,$),null,L),R)}e.filter=o;function c(B){return B}e.signal=c;function d(...B){return(N,R=null,A)=>{let E=_I(...B.map(L=>L($=>N.call(R,$))));return g(E,A)}}e.any=d;function p(B,N,R,A){let E=R;return i(B,L=>(E=N(E,L),E),A)}e.reduce=p;function f(B,N){let R,A={onWillAddFirstListener(){R=B(E.fire,E)},onDidRemoveLastListener(){R?.dispose()}},E=new Na(A);return N?.add(E),E.event}function g(B,N){return N instanceof Array?N.push(B):N&&N.add(B),B}function _(B,N,R=100,A=!1,E=!1,L,$){let q,X,D,V=0,J,ce={leakWarningThreshold:L,onWillAddFirstListener(){q=B(ve=>{V++,X=N(X,ve),A&&!D&&(ie.fire(X),X=void 0),J=()=>{let Se=X;X=void 0,D=void 0,(!A||V>1)&&ie.fire(Se),V=0},typeof R=="number"?(clearTimeout(D),D=setTimeout(J,R)):D===void 0&&(D=0,queueMicrotask(J))})},onWillRemoveListener(){E&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},ie=new Na(ce);return $?.add(ie),ie.event}e.debounce=_;function b(B,N=0,R){return e.debounce(B,(A,E)=>A?(A.push(E),A):[E],N,void 0,!0,void 0,R)}e.accumulate=b;function S(B,N=(A,E)=>A===E,R){let A=!0,E;return o(B,L=>{let $=A||!N(L,E);return A=!1,E=L,$},R)}e.latch=S;function w(B,N,R){return[e.filter(B,N,R),e.filter(B,A=>!N(A),R)]}e.split=w;function x(B,N=!1,R=[],A){let E=R.slice(),L=B(X=>{E?E.push(X):q.fire(X)});A&&A.add(L);let $=()=>{E?.forEach(X=>q.fire(X)),E=null},q=new Na({onWillAddFirstListener(){L||(L=B(X=>q.fire(X)),A&&A.add(L))},onDidAddFirstListener(){E&&(N?setTimeout($):$())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return A&&A.add(q),q.event}e.buffer=x;function C(B,N){return(R,A,E)=>{let L=N(new P);return B(function($){let q=L.evaluate($);q!==O&&R.call(A,q)},void 0,E)}}e.chain=C;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(R=>(N(R),R)),this}filter(N){return this.steps.push(R=>N(R)?R:O),this}reduce(N,R){let A=R;return this.steps.push(E=>(A=N(A,E),A)),this}latch(N=(R,A)=>R===A){let R=!0,A;return this.steps.push(E=>{let L=R||!N(E,A);return R=!1,A=E,L?E:O}),this}evaluate(N){for(let R of this.steps)if(N=R(N),N===O)break;return N}}function z(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.on(N,A),L=()=>B.removeListener(N,A),$=new Na({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromNodeEventEmitter=z;function T(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.addEventListener(N,A),L=()=>B.removeEventListener(N,A),$=new Na({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromDOMEventEmitter=T;function j(B){return new Promise(N=>n(B)(N))}e.toPromise=j;function M(B){let N=new Na;return B.then(R=>{N.fire(R)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=M;function H(B,N){return B(R=>N.fire(R))}e.forward=H;function F(B,N,R){return N(R),B(A=>N(A))}e.runAndSubscribe=F;class ee{constructor(N,R){this._observable=N,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Na(A),R&&R.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,R){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(B,N){return new ee(B,N).emitter.event}e.fromObservable=ae;function K(B){return(N,R,A)=>{let E=0,L=!1,$={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),L&&(L=!1,N.call(R)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver($),B.reportChanges();let q={dispose(){B.removeObserver($)}};return A instanceof t0?A.add(q):Array.isArray(A)&&A.push(q),q}}e.fromObservableLight=K})(bI||={});var Xv=class Zv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Zv._idPool++}`,Zv.all.add(this)}start(t){this._stopWatch=new yI,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}}};Xv.all=new Set,Xv._idPool=0;var SI=Xv,wI=-1,_T=class vT{constructor(t,n,i=(vT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new kI(d,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};_T._idPool=1;var xI=_T,CI=class yT{constructor(t){this.value=t}static create(){let t=new Error;return new yT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
-
`).slice(2).join(`
|
|
17
|
-
`))}},kI=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},EI=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},TI=0,v_=class{constructor(t){this.value=t,this.id=TI++}},AI=2,RI,Na=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new xI(t?.onListenerError??__,this._options?.leakWarningThreshold??wI):void 0,this._perfMon=this._options?._profName?new SI(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new EI(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||__)(f),Jf.None}if(this._disposed)return Jf.None;n&&(t=t.bind(n));let r=new v_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=CI.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof v_?(this._deliveryQueue??=new NI,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=fT(()=>{o?.(),this._removeListener(r)});return i instanceof t0?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*AI<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||__;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof v_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},NI=class{constructor(){this.i=-1,this.end=0}enqueue(t,n,i){this.i=0,this.end=i,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Qf=class xf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Na,this.onChange=this._onChange.event;let t=new uI;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let d=this.charProperties(c,i),p=xf.extractWidth(d);xf.extractShouldJoin(d)&&(p-=xf.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},y_=[[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]],LI=[[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]],b_=[[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]],MI=[[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]],jr;function _C(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var OI=class{constructor(){if(this.version="11",!jr){jr=new Uint8Array(65536),jr.fill(1),jr[0]=0,jr.fill(0,1,32),jr.fill(0,127,160);for(let t=0;t<y_.length;++t)jr.fill(0,y_[t][0],y_[t][1]+1);for(let t=0;t<b_.length;++t)jr.fill(2,b_[t][0],b_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?jr[t]:_C(t,LI)?0:_C(t,MI)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=Qf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Qf.createPropertyValue(0,i,r)}},DI=class{activate(t){t.unicode.register(new OI)}dispose(){}};var jI=(e,t,n,i)=>{for(var r=t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},II=(e,t)=>(n,i)=>t(n,i,e),BI=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?vC.isErrorNoTelemetry(e)?new vC(e.message+`
|
|
18
|
-
|
|
19
|
-
`+e.stack):new Error(e.message+`
|
|
20
|
-
|
|
21
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},PI=new BI;function S_(e){$I(e)||PI.onUnexpectedError(e)}var Jv="Canceled";function $I(e){return e instanceof zI?!0:e instanceof Error&&e.name===Jv&&e.message===Jv}var zI=class extends Error{constructor(){super(Jv),this.name=this.message}},vC=class Qv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Qv)return t;let n=new Qv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},HI;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(HI||={});function FI(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var bT;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let j=T.length-1;j>=0;j--)yield T[j]}e.reverse=d;function p(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(T){return T[Symbol.iterator]().next().value}e.first=f;function g(T,j){let M=0;for(let H of T)if(j(H,M++))return!0;return!1}e.some=g;function _(T,j){for(let M of T)if(j(M))return M}e.find=_;function*b(T,j){for(let M of T)j(M)&&(yield M)}e.filter=b;function*S(T,j){let M=0;for(let H of T)yield j(H,M++)}e.map=S;function*w(T,j){let M=0;for(let H of T)yield*j(H,M++)}e.flatMap=w;function*x(...T){for(let j of T)yield*j}e.concat=x;function C(T,j,M){let H=M;for(let F of T)H=j(H,F);return H}e.reduce=C;function*O(T,j,M=T.length){for(j<0&&(j+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);j<M;j++)yield T[j]}e.slice=O;function P(T,j=Number.POSITIVE_INFINITY){let M=[];if(j===0)return[M,T];let H=T[Symbol.iterator]();for(let F=0;F<j;F++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=P;async function z(T){let j=[];for await(let M of T)j.push(M);return Promise.resolve(j)}e.asyncToArray=z})(bT||={});function ST(e){if(bT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function wT(...e){return Ei(()=>ST(e))}function Ei(e){return{dispose:FI(()=>{e()})}}var xT=class CT{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{ST(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?CT.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)}};xT.DISABLE_DISPOSED_WARNING=!1;var ql=xT,Ys=class{constructor(){this._store=new ql,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)}};Ys.None=Object.freeze({dispose(){}});var ou=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}},n0=typeof process<"u"&&"title"in process,Ip=n0?"node":navigator.userAgent,UI=n0?"node":navigator.platform,WI=Ip.includes("Firefox"),qI=Ip.includes("Edge"),kT=/^((?!chrome|android).)*safari/i.test(Ip);function GI(){if(!kT)return 0;let e=Ip.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}UI.indexOf("Linux")>=0;var KI="",ei=0,ti=0,ni=0,kn=0,Ns={css:"#00000000",rgba:0},Oi;(e=>{function t(r,o,c,d){return d!==void 0?`#${go(r)}${go(o)}${go(c)}${go(d)}`:`#${go(r)}${go(o)}${go(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(Oi||={});var Ou;(e=>{function t(p,f){if(kn=(f.rgba&255)/255,kn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;ei=S+Math.round((g-S)*kn),ti=w+Math.round((_-w)*kn),ni=x+Math.round((b-x)*kn);let C=Oi.toCss(ei,ti,ni),O=Oi.toRgba(ei,ti,ni);return{css:C,rgba:O}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let _=Ro.ensureContrastRatio(p.rgba,f.rgba,g);if(_)return Oi.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[ei,ti,ni]=Ro.toChannels(f),{css:Oi.toCss(ei,ti,ni),rgba:f}}e.opaque=r;function o(p,f){return kn=Math.round(f*255),[ei,ti,ni]=Ro.toChannels(p.rgba),{css:Oi.toCss(ei,ti,ni,kn),rgba:Oi.toRgba(ei,ti,ni,kn)}}e.opacity=o;function c(p,f){return kn=p.rgba&255,o(p,kn*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(Ou||={});var VI;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ei=parseInt(r.slice(1,2).repeat(2),16),ti=parseInt(r.slice(2,3).repeat(2),16),ni=parseInt(r.slice(3,4).repeat(2),16),Oi.toColor(ei,ti,ni);case 5:return ei=parseInt(r.slice(1,2).repeat(2),16),ti=parseInt(r.slice(2,3).repeat(2),16),ni=parseInt(r.slice(3,4).repeat(2),16),kn=parseInt(r.slice(4,5).repeat(2),16),Oi.toColor(ei,ti,ni,kn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return ei=parseInt(o[1]),ti=parseInt(o[2]),ni=parseInt(o[3]),kn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Oi.toColor(ei,ti,ni,kn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ei,ti,ni,kn]=t.getImageData(0,0,1,1).data,kn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Oi.toRgba(ei,ti,ni,kn),css:r}}e.toColor=i})(VI||={});var Ri;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(Ri||={});var Ro;(e=>{function t(c,d){if(kn=(d&255)/255,kn===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,_=c>>24&255,b=c>>16&255,S=c>>8&255;return ei=_+Math.round((p-_)*kn),ti=b+Math.round((f-b)*kn),ni=S+Math.round((g-S)*kn),Oi.toRgba(ei,ti,ni)}e.blend=t;function n(c,d,p){let f=Ri.relativeLuminance(c>>8),g=Ri.relativeLuminance(d>>8);if(Ir(f,g)<p){if(g<f){let S=i(c,d,p),w=Ir(f,Ri.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),C=Ir(f,Ri.relativeLuminance(x>>8));return w>C?S:x}return S}let _=r(c,d,p),b=Ir(f,Ri.relativeLuminance(_>>8));if(b<p){let S=i(c,d,p),w=Ir(f,Ri.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Ir(Ri.relativeLuminance2(b,S,w),Ri.relativeLuminance2(f,g,_));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Ir(Ri.relativeLuminance2(b,S,w),Ri.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Ir(Ri.relativeLuminance2(b,S,w),Ri.relativeLuminance2(f,g,_));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Ir(Ri.relativeLuminance2(b,S,w),Ri.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Ro||={});function go(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ir(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function zn(e){if(!e)throw new Error("value must not be falsy");return e}function i0(e){return 57508<=e&&e<=57558}function YI(e){return 57520<=e&&e<=57527}function XI(e){return 57344<=e&&e<=63743}function ZI(e){return 9472<=e&&e<=9631}function JI(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 QI(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!JI(e)&&!i0(e)&&!XI(e)}function ET(e){return i0(e)||ZI(e)}function e8(){return{css:{canvas:Ud(),cell:Ud()},device:{canvas:Ud(),cell:Ud(),char:{width:0,height:0,left:0,top:0}}}}function Ud(){return{width:0,height:0}}function t8(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var pi=0,Jn=0,nr=!1,Br=!1,Wd=!1,Ki,w_=0,n8=class{constructor(e,t,n,i,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Jn=0,pi=0,Br=!1,nr=!1,Wd=!1,Ki=this._themeService.colors,w_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));w_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(Jn=r.backgroundColorRGB.rgba>>8&16777215,Br=!0),r.foregroundColorRGB&&(pi=r.foregroundColorRGB.rgba>>8&16777215,nr=!0)}),Wd=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Wd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Jn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Jn=(this.result.fg&16777215)<<8|255;break;default:Jn=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Jn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Jn=(this.result.bg&16777215)<<8|255;break}Jn=Ro.blend(Jn,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Jn=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Br=!0,Ki.selectionForeground&&(pi=Ki.selectionForeground.rgba>>8&16777215,nr=!0),ET(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)pi=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:pi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:pi=(this.result.fg&16777215)<<8|255;break;default:pi=this._themeService.colors.foreground.rgba}pi=Ro.blend(pi,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}nr=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(Jn=r.backgroundColorRGB.rgba>>8&16777215,Br=!0),r.foregroundColorRGB&&(pi=r.foregroundColorRGB.rgba>>8&16777215,nr=!0)}),Br&&(Wd?Jn=e.bg&-16777216&-134217729|Jn|50331648:Jn=e.bg&-16777216|Jn|50331648),nr&&(pi=e.fg&-16777216&-67108865|pi|50331648),this.result.fg&67108864&&(Br&&!nr&&((this.result.bg&50331648)===0?pi=this.result.fg&-134217728|Ki.background.rgba>>8&16777215&16777215|50331648:pi=this.result.fg&-134217728|this.result.bg&67108863,nr=!0),!Br&&nr&&((this.result.fg&50331648)===0?Jn=this.result.bg&-67108864|Ki.foreground.rgba>>8&16777215&16777215|50331648:Jn=this.result.bg&-67108864|this.result.fg&67108863,Br=!0)),Ki=void 0,this.result.bg=Br?Jn:this.result.bg,this.result.fg=nr?pi:this.result.fg,this.result.ext&=536870911,this.result.ext|=w_<<29&3758096384}},i8=.5,TT=WI||qI?"bottom":"ideographic",s8={"▀":[{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}]},r8={"░":[[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]]},a8={"─":{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`}},rh={"":{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}};rh[""]=rh[""];rh[""]=rh[""];function o8(e,t,n,i,r,o,c,d){let p=s8[t];if(p)return l8(e,p,n,i,r,o),!0;let f=r8[t];if(f)return c8(e,f,n,i,r,o),!0;let g=a8[t];if(g)return u8(e,g,n,i,r,o,d),!0;let _=rh[t];return _?(h8(e,_,n,i,r,o,c,d),!0):!1}function l8(e,t,n,i,r,o){for(let c=0;c<t.length;c++){let d=t[c],p=r/8,f=o/8;e.fillRect(n+d.x*p,i+d.y*f,d.w*p,d.h*f)}}var yC=new Map;function c8(e,t,n,i,r,o){let c=yC.get(t);c||(c=new Map,yC.set(t,c));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let p=c.get(d);if(!p){let f=t[0].length,g=t.length,_=e.canvas.ownerDocument.createElement("canvas");_.width=f,_.height=g;let b=zn(_.getContext("2d")),S=new ImageData(f,g),w,x,C,O;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),C=parseInt(d.slice(5,7),16),O=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,C,O]=d.substring(5,d.length-1).split(",").map(P=>parseFloat(P));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let P=0;P<g;P++)for(let z=0;z<f;z++)S.data[(P*f+z)*4]=w,S.data[(P*f+z)*4+1]=x,S.data[(P*f+z)*4+2]=C,S.data[(P*f+z)*4+3]=t[P][z]*(O*255);b.putImageData(S,0,0),p=zn(e.createPattern(_,null)),c.set(d,p)}e.fillStyle=p,e.fillRect(n,i,r,o)}function u8(e,t,n,i,r,o,c){e.strokeStyle=e.fillStyle;for(let[d,p]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let f;if(typeof p=="function"){let g=.15/o*r;f=p(.15,g)}else f=p;for(let g of f.split(" ")){let _=g[0],b=AT[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,RT(S,r,o,n,i,!0,c))}e.stroke(),e.closePath()}}function h8(e,t,n,i,r,o,c,d){let p=new Path2D;p.rect(n,i,r,o),e.clip(p),e.beginPath();let f=c/12;e.lineWidth=d*f;for(let g of t.d.split(" ")){let _=g[0],b=AT[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,RT(S,r,o,n,i,!1,d,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function bC(e,t,n=0){return Math.max(Math.min(e,t),n)}var AT={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 RT(e,t,n,i,r,o,c,d=0,p=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-d*c-p*c,o&&f[g]!==0&&(f[g]=bC(Math.round(f[g]+.5)-.5,t,0)),f[g]+=i+d*c;for(let g=1;g<f.length;g+=2)f[g]*=n,o&&f[g]!==0&&(f[g]=bC(Math.round(f[g]+.5)-.5,n,0)),f[g]+=r;return f}var SC=class{constructor(){this._data={}}set(t,n,i){this._data[t]||(this._data[t]={}),this._data[t][n]=i}get(t,n){return this._data[t]?this._data[t][n]:void 0}clear(){this._data={}}},wC=class{constructor(){this._data=new SC}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new SC),this._data.get(e,t).set(n,i,r)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},NT=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},d8=class extends NT{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},f8=class extends NT{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},p8=!n0&&"requestIdleCallback"in window?f8:d8,Bl=class LT{constructor(){this.fg=0,this.bg=0,this.extended=new MT}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 LT;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}},MT=class OT{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new OT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},m8=globalThis.performance&&typeof globalThis.performance.now=="function",g8=class DT{static create(t){return new DT(t)}constructor(t){this._now=m8&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ur;(e=>{e.None=()=>Ys.None;function t(B,N){return _(B,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(B){return(N,R=null,A)=>{let E=!1,L;return L=B($=>{if(!E)return L?L.dispose():E=!0,N.call(R,$)},null,A),E&&L.dispose(),L}}e.once=n;function i(B,N,R){return f((A,E=null,L)=>B($=>A.call(E,N($)),null,L),R)}e.map=i;function r(B,N,R){return f((A,E=null,L)=>B($=>{N($),A.call(E,$)},null,L),R)}e.forEach=r;function o(B,N,R){return f((A,E=null,L)=>B($=>N($)&&A.call(E,$),null,L),R)}e.filter=o;function c(B){return B}e.signal=c;function d(...B){return(N,R=null,A)=>{let E=wT(...B.map(L=>L($=>N.call(R,$))));return g(E,A)}}e.any=d;function p(B,N,R,A){let E=R;return i(B,L=>(E=N(E,L),E),A)}e.reduce=p;function f(B,N){let R,A={onWillAddFirstListener(){R=B(E.fire,E)},onDidRemoveLastListener(){R?.dispose()}},E=new on(A);return N?.add(E),E.event}function g(B,N){return N instanceof Array?N.push(B):N&&N.add(B),B}function _(B,N,R=100,A=!1,E=!1,L,$){let q,X,D,V=0,J,ce={leakWarningThreshold:L,onWillAddFirstListener(){q=B(ve=>{V++,X=N(X,ve),A&&!D&&(ie.fire(X),X=void 0),J=()=>{let Se=X;X=void 0,D=void 0,(!A||V>1)&&ie.fire(Se),V=0},typeof R=="number"?(clearTimeout(D),D=setTimeout(J,R)):D===void 0&&(D=0,queueMicrotask(J))})},onWillRemoveListener(){E&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},ie=new on(ce);return $?.add(ie),ie.event}e.debounce=_;function b(B,N=0,R){return e.debounce(B,(A,E)=>A?(A.push(E),A):[E],N,void 0,!0,void 0,R)}e.accumulate=b;function S(B,N=(A,E)=>A===E,R){let A=!0,E;return o(B,L=>{let $=A||!N(L,E);return A=!1,E=L,$},R)}e.latch=S;function w(B,N,R){return[e.filter(B,N,R),e.filter(B,A=>!N(A),R)]}e.split=w;function x(B,N=!1,R=[],A){let E=R.slice(),L=B(X=>{E?E.push(X):q.fire(X)});A&&A.add(L);let $=()=>{E?.forEach(X=>q.fire(X)),E=null},q=new on({onWillAddFirstListener(){L||(L=B(X=>q.fire(X)),A&&A.add(L))},onDidAddFirstListener(){E&&(N?setTimeout($):$())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return A&&A.add(q),q.event}e.buffer=x;function C(B,N){return(R,A,E)=>{let L=N(new P);return B(function($){let q=L.evaluate($);q!==O&&R.call(A,q)},void 0,E)}}e.chain=C;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(R=>(N(R),R)),this}filter(N){return this.steps.push(R=>N(R)?R:O),this}reduce(N,R){let A=R;return this.steps.push(E=>(A=N(A,E),A)),this}latch(N=(R,A)=>R===A){let R=!0,A;return this.steps.push(E=>{let L=R||!N(E,A);return R=!1,A=E,L?E:O}),this}evaluate(N){for(let R of this.steps)if(N=R(N),N===O)break;return N}}function z(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.on(N,A),L=()=>B.removeListener(N,A),$=new on({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromNodeEventEmitter=z;function T(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.addEventListener(N,A),L=()=>B.removeEventListener(N,A),$=new on({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromDOMEventEmitter=T;function j(B){return new Promise(N=>n(B)(N))}e.toPromise=j;function M(B){let N=new on;return B.then(R=>{N.fire(R)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=M;function H(B,N){return B(R=>N.fire(R))}e.forward=H;function F(B,N,R){return N(R),B(A=>N(A))}e.runAndSubscribe=F;class ee{constructor(N,R){this._observable=N,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new on(A),R&&R.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,R){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(B,N){return new ee(B,N).emitter.event}e.fromObservable=ae;function K(B){return(N,R,A)=>{let E=0,L=!1,$={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),L&&(L=!1,N.call(R)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver($),B.reportChanges();let q={dispose(){B.removeObserver($)}};return A instanceof ql?A.add(q):Array.isArray(A)&&A.push(q),q}}e.fromObservableLight=K})(Ur||={});var ey=class ty{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ty._idPool++}`,ty.all.add(this)}start(t){this._stopWatch=new g8,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}}};ey.all=new Set,ey._idPool=0;var _8=ey,v8=-1,jT=class IT{constructor(t,n,i=(IT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new S8(d,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};jT._idPool=1;var y8=jT,b8=class BT{constructor(t){this.value=t}static create(){let t=new Error;return new BT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},S8=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},w8=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},x8=0,x_=class{constructor(t){this.value=t,this.id=x8++}},C8=2,k8,on=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new y8(t?.onListenerError??S_,this._options?.leakWarningThreshold??v8):void 0,this._perfMon=this._options?._profName?new _8(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new w8(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||S_)(f),Ys.None}if(this._disposed)return Ys.None;n&&(t=t.bind(n));let r=new x_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=b8.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof x_?(this._deliveryQueue??=new E8,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Ei(()=>{o?.(),this._removeListener(r)});return i instanceof ql?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*C8<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||S_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof x_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},E8=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},xC={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}},lu=2,cu,La=class Ll{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new wC,this._cacheMapCombined=new wC,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Bl,this._textureSize=512,this._onAddTextureAtlasCanvas=new on,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new on,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=PT(t,this._config.deviceCellWidth*4+lu*2,this._config.deviceCellHeight+lu*2),this._tmpCtx=zn(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 p8;for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let i=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ll.maxAtlasPages&&this._pages.length>=Math.max(4,Ll.maxAtlasPages)){let n=this._pages.filter(f=>f.canvas.width*2<=(Ll.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),i=-1,r=0;for(let f=0;f<n.length;f++)if(n[f].canvas.width!==r)i=f,r=n[f].canvas.width;else if(f-i===3)break;let o=n.slice(i,i+4),c=o.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),d=this.pages.length-o.length,p=this._mergePages(o,d);p.version++;for(let f=c.length-1;f>=0;f--)this._deletePage(c[f]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new C_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let i=t[0].canvas.width*2,r=new C_(this._document,i,t);for(let[o,c]of t.entries()){let d=o*c.canvas.width%i,p=Math.floor(o/2)*c.canvas.height;r.ctx.drawImage(c.canvas,d,p);for(let g of c.glyphs)g.texturePage=n,g.sizeClipSpace.x=g.size.x/i,g.sizeClipSpace.y=g.size.y/i,g.texturePosition.x+=d,g.texturePosition.y+=p,g.texturePositionClipSpace.x=g.texturePosition.x/i,g.texturePositionClipSpace.y=g.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let f=this._activePages.indexOf(c);f!==-1&&this._activePages.splice(f,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let r of i.glyphs)r.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,c)}getRasterizedGlyph(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,c)}_getFromCacheMap(t,n,i,r,o,c,d){return cu=t.get(n,i,r,o),cu||(cu=this._drawToCache(n,i,r,o,c,d),t.set(n,i,r,o,cu)),cu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Ns;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let c=Bl.toColorRGB(n);o=Oi.toColor(c[0],c[1],c[2]);break;default:i?o=Ou.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Ou.opaque(o)),o}_getForegroundColor(t,n,i,r,o,c,d,p,f,g){let _=this._getMinimumContrastColor(t,n,i,r,o,c,d,f,p,g);if(_)return _;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&c<8&&(c+=8),b=this._getColorFromAnsiIndex(c);break;case 50331648:let S=Bl.toColorRGB(c);b=Oi.toColor(S[0],S[1],S[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=Ou.opaque(b)),p&&(b=Ou.multiplyOpacity(b,i8)),b}_resolveBackgroundRgba(t,n,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,i,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,i,r,o,c,d,p,f,g){if(this._config.minimumContrastRatio===1||g)return;let _=this._getContrastCache(f),b=_.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,d),w=this._resolveForegroundRgba(o,c,d,p),x=Ro.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!x){_.setColor(t,r,null);return}let C=Oi.toColor(x>>24&255,x>>16&255,x>>8&255);return _.setColor(t,r,C),C}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,c){let d=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+lu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+lu*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return xC;let g=!!this._workAttributeData.isBold(),_=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),C=!!this._workAttributeData.isOverline(),O=this._workAttributeData.getFgColor(),P=this._workAttributeData.getFgColorMode(),z=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(_){let X=O;O=z,z=X;let D=P;P=T,T=D}let j=this._getBackgroundColor(T,z,_,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=j.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let M=g?this._config.fontWeightBold:this._config.fontWeight,H=S?"italic":"";this._tmpCtx.font=`${H} ${M} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=TT;let F=d.length===1&&i0(d.charCodeAt(0)),ee=d.length===1&&YI(d.charCodeAt(0)),ae=this._getForegroundColor(n,T,z,i,P,O,_,b,g,ET(d.charCodeAt(0)));this._tmpCtx.fillStyle=ae.css;let K=ee?0:lu*2,B=!1;this._config.customGlyphs!==!1&&(B=o8(this._tmpCtx,d,K,K,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N=!F,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=X%2===1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())N=!1,this._tmpCtx.strokeStyle=`rgb(${Bl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{N=!1;let Se=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Se<8&&(Se+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Se).css}this._tmpCtx.beginPath();let V=K,J=Math.ceil(K+this._config.deviceCharHeight)-D-(o?X*2:0),ce=J+X,ie=J+X*2,ve=this._workAttributeData.getUnderlineVariantOffset();for(let Se=0;Se<R;Se++){this._tmpCtx.save();let Oe=V+Se*this._config.deviceCellWidth,Ne=V+(Se+1)*this._config.deviceCellWidth,ct=Oe+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Oe,J),this._tmpCtx.lineTo(Ne,J),this._tmpCtx.moveTo(Oe,ie),this._tmpCtx.lineTo(Ne,ie);break;case 3:let Ze=X<=1?ie:Math.ceil(K+this._config.deviceCharHeight-X/2)-D,Re=X<=1?J:Math.ceil(K+this._config.deviceCharHeight+X/2)-D,xe=new Path2D;xe.rect(Oe,J,this._config.deviceCellWidth,ie-J),this._tmpCtx.clip(xe),this._tmpCtx.moveTo(Oe-this._config.deviceCellWidth/2,ce),this._tmpCtx.bezierCurveTo(Oe-this._config.deviceCellWidth/2,Re,Oe,Re,Oe,ce),this._tmpCtx.bezierCurveTo(Oe,Ze,ct,Ze,ct,ce),this._tmpCtx.bezierCurveTo(ct,Re,Ne,Re,Ne,ce),this._tmpCtx.bezierCurveTo(Ne,Ze,Ne+this._config.deviceCellWidth/2,Ze,Ne+this._config.deviceCellWidth/2,ce);break;case 4:let ze=ve===0?0:ve>=X?X*2-ve:X-ve;ve>=X||ze===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(Oe+ze,J),this._tmpCtx.lineTo(Ne,J)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(Oe,J),this._tmpCtx.lineTo(Oe+ze,J),this._tmpCtx.moveTo(Oe+ze+X,J),this._tmpCtx.lineTo(Ne,J)),ve=t8(Ne-Oe,X,ve);break;case 5:let le=.6,We=.3,Le=Ne-Oe,it=Math.floor(le*Le),bt=Math.floor(We*Le),je=Le-it-bt;this._tmpCtx.setLineDash([it,bt,je]),this._tmpCtx.moveTo(Oe,J),this._tmpCtx.lineTo(Ne,J);break;default:this._tmpCtx.moveTo(Oe,J),this._tmpCtx.lineTo(Ne,J);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!B&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Se=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Se&&Se.actualBoundingBoxDescent>0){this._tmpCtx.save();let Oe=new Path2D;Oe.rect(V,J-Math.ceil(X/2),this._config.deviceCellWidth*R,ie-J+Math.ceil(X/2)),this._tmpCtx.clip(Oe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=j.css,this._tmpCtx.strokeText(d,K,K+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(C){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=X%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+D),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*R,K+D),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,K,K+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let X=k_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),j,ae,N);if(X)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=j.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,K,K+this._config.deviceCharHeight-D),X=k_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),j,ae,N),!!X);D++);}if(x){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*R,K+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),E;if(this._config.allowTransparency?E=T8(A):E=k_(A,j,ae,N),E)return xC;let L=this._findGlyphBoundingBox(A,this._workBoundingBox,p,ee,B,K),$,q;for(;;){if(this._activePages.length===0){let X=this._createNewPage();$=X,q=X.currentRow,q.height=L.size.y;break}$=this._activePages[this._activePages.length-1],q=$.currentRow;for(let X of this._activePages)L.size.y<=X.currentRow.height&&($=X,q=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(let D of this._activePages[X].fixedRows)D.height<=q.height&&L.size.y<=D.height&&($=this._activePages[X],q=D);if(L.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new C_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),$=this._overflowSizePage,q=this._overflowSizePage.currentRow,q.x+L.size.x>=$.canvas.width&&(q.x=0,q.y+=q.height,q.height=0);break}if(q.y+L.size.y>=$.canvas.height||q.height>L.size.y+2){let X=!1;if($.currentRow.y+$.currentRow.height+L.size.y>=$.canvas.height){let D;for(let V of this._activePages)if(V.currentRow.y+V.currentRow.height+L.size.y<V.canvas.height){D=V;break}if(D)$=D;else if(Ll.maxAtlasPages&&this._pages.length>=Ll.maxAtlasPages&&q.y+L.size.y<=$.canvas.height&&q.height>=L.size.y&&q.x+L.size.x<=$.canvas.width)X=!0;else{let V=this._createNewPage();$=V,q=V.currentRow,q.height=L.size.y,X=!0}}X||($.currentRow.height>0&&$.fixedRows.push($.currentRow),q={x:0,y:$.currentRow.y+$.currentRow.height,height:L.size.y},$.fixedRows.push(q),$.currentRow={x:0,y:q.y+q.height,height:0})}if(q.x+L.size.x<=$.canvas.width)break;q===$.currentRow?(q.x=0,q.y+=q.height,q.height=0):$.fixedRows.splice($.fixedRows.indexOf(q),1)}return L.texturePage=this._pages.indexOf($),L.texturePosition.x=q.x,L.texturePosition.y=q.y,L.texturePositionClipSpace.x=q.x/$.canvas.width,L.texturePositionClipSpace.y=q.y/$.canvas.height,L.sizeClipSpace.x/=$.canvas.width,L.sizeClipSpace.y/=$.canvas.height,q.height=Math.max(q.height,L.size.y),q.x+=L.size.x,$.ctx.putImageData(A,L.texturePosition.x-this._workBoundingBox.left,L.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,L.size.x,L.size.y),$.addGlyph(L),$.version++,L}_findGlyphBoundingBox(t,n,i,r,o,c){n.top=0;let d=r?this._config.deviceCellHeight:this._tmpCanvas.height,p=r?this._config.deviceCellWidth:i,f=!1;for(let g=0;g<d;g++){for(let _=0;_<p;_++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.top=g,f=!0;break}}if(f)break}n.left=0,f=!1;for(let g=0;g<c+p;g++){for(let _=0;_<d;_++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.left=g,f=!0;break}}if(f)break}n.right=p,f=!1;for(let g=c+p-1;g>=c;g--){for(let _=0;_<d;_++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.right=g,f=!0;break}}if(f)break}n.bottom=d,f=!1;for(let g=d-1;g>=0;g--){for(let _=0;_<p;_++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.bottom=g,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+c+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+c+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},C_=class{constructor(t,n,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=PT(t,n,n),this.ctx=zn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function k_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,c=t.rgba>>>8&255,d=n.rgba>>>24,p=n.rgba>>>16&255,f=n.rgba>>>8&255,g=Math.floor((Math.abs(r-d)+Math.abs(o-p)+Math.abs(c-f))/12),_=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===c||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-c)<g?e.data[b+3]=0:_=!1;return _}function T8(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function PT(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function A8(e,t,n,i,r,o,c,d){let p={foreground:o.foreground,background:o.background,cursor:Ns,cursorAccent:Ns,selectionForeground:Ns,selectionBackgroundTransparent:Ns,selectionBackgroundOpaque:Ns,selectionInactiveBackgroundTransparent:Ns,selectionInactiveBackgroundOpaque:Ns,overviewRulerBorder:Ns,scrollbarSliderBackground:Ns,scrollbarSliderHoverBackground:Ns,scrollbarSliderActiveBackground:Ns,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:c,deviceMaxTextureSize:d,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:p}}function CC(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function R8(e){return(e&50331648)===16777216||(e&50331648)===33554432}var js=[];function $T(e,t,n,i,r,o,c,d,p){let f=A8(i,r,o,c,t,n,d,p);for(let b=0;b<js.length;b++){let S=js[b],w=S.ownedBy.indexOf(e);if(w>=0){if(CC(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),js.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<js.length;b++){let S=js[b];if(CC(S.config,f))return S.ownedBy.push(e),S.atlas}let g=e._core,_={atlas:new La(document,f,g.unicodeService),config:f,ownedBy:[e]};return js.push(_),_.atlas}function kC(e){for(let t=0;t<js.length;t++){let n=js[t].ownedBy.indexOf(e);if(n!==-1){js[t].ownedBy.length===1?(js[t].atlas.dispose(),js.splice(t,1)):js[t].ownedBy.splice(n,1);break}}}var qd=600,N8=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=qd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=qd-(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=qd-(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})},qd)},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 EC(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(p=>p.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let c=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&n(c,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ei(()=>i?.disconnect())}function L8(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var TC=class zT extends Bl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new MT,this.combinedData=""}static fromCharData(t){let n=new zT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?L8(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},HT=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function FT(e,t,n){let i=zn(e.createProgram());if(e.attachShader(i,zn(AC(e,e.VERTEX_SHADER,t))),e.attachShader(i,zn(AC(e,e.FRAGMENT_SHADER,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function AC(e,t,n){let i=zn(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function M8(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let r=0;r<e.length;r++)i[r]=e[r];return i}var O8=class{constructor(t){this.texture=t,this.version=-1}},D8=`#version 300 es
|
|
24
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
25
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
26
|
-
layout (location = 2) in vec2 a_offset;
|
|
27
|
-
layout (location = 3) in vec2 a_size;
|
|
28
|
-
layout (location = 4) in float a_texpage;
|
|
29
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
30
|
-
layout (location = 6) in vec2 a_texsize;
|
|
31
|
-
|
|
32
|
-
uniform mat4 u_projection;
|
|
33
|
-
uniform vec2 u_resolution;
|
|
34
|
-
|
|
35
|
-
out vec2 v_texcoord;
|
|
36
|
-
flat out int v_texpage;
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
40
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
41
|
-
v_texpage = int(a_texpage);
|
|
42
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
43
|
-
}`;function j8(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
44
|
-
precision lowp float;
|
|
45
|
-
|
|
46
|
-
in vec2 v_texcoord;
|
|
47
|
-
flat in int v_texpage;
|
|
48
|
-
|
|
49
|
-
uniform sampler2D u_texture[${e}];
|
|
50
|
-
|
|
51
|
-
out vec4 outColor;
|
|
52
|
-
|
|
53
|
-
void main() {
|
|
54
|
-
if (v_texpage == 0) {
|
|
55
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
56
|
-
} ${t}
|
|
57
|
-
}`}var Ma=11,wl=Ma*Float32Array.BYTES_PER_ELEMENT,I8=2,wn=0,rn,E_=0,uu=0,B8=class extends Ys{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;La.maxAtlasPages===void 0&&(La.maxAtlasPages=Math.min(32,zn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),La.maxTextureSize=zn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=zn(FT(o,D8,j8(La.maxAtlasPages))),this._register(Ei(()=>o.deleteProgram(this._program))),this._projectionLocation=zn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=zn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=zn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(Ei(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,c,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let p=new Uint8Array([0,1,2,3]),f=o.createBuffer();this._register(Ei(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=zn(o.createBuffer()),this._register(Ei(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,wl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,wl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,wl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,wl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,wl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,wl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let g=new Int32Array(La.maxAtlasPages);for(let _=0;_<La.maxAtlasPages;_++)g[_]=_;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,HT),this._atlasTextures=[];for(let _=0;_<La.maxAtlasPages;_++){let b=new O8(zn(o.createTexture()));this._register(Ei(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+_),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,c,d,p,f){this._updateCell(this._vertices.attributes,t,n,i,r,o,c,d,p,f)}_updateCell(t,n,i,r,o,c,d,p,f,g){if(wn=(i*this._terminal.cols+n)*Ma,r===0||r===void 0){t.fill(0,wn,wn+Ma-1-I8);return}this._atlas&&(p&&p.length>1?rn=this._atlas.getRasterizedGlyphCombinedChar(p,o,c,d,!1,this._terminal.element):rn=this._atlas.getRasterizedGlyph(r,o,c,d,!1,this._terminal.element),E_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&rn.offset.x>E_?(uu=rn.offset.x-E_,t[wn]=-(rn.offset.x-uu)+this._dimensions.device.char.left,t[wn+1]=-rn.offset.y+this._dimensions.device.char.top,t[wn+2]=(rn.size.x-uu)/this._dimensions.device.canvas.width,t[wn+3]=rn.size.y/this._dimensions.device.canvas.height,t[wn+4]=rn.texturePage,t[wn+5]=rn.texturePositionClipSpace.x+uu/this._atlas.pages[rn.texturePage].canvas.width,t[wn+6]=rn.texturePositionClipSpace.y,t[wn+7]=rn.sizeClipSpace.x-uu/this._atlas.pages[rn.texturePage].canvas.width,t[wn+8]=rn.sizeClipSpace.y):(t[wn]=-rn.offset.x+this._dimensions.device.char.left,t[wn+1]=-rn.offset.y+this._dimensions.device.char.top,t[wn+2]=rn.size.x/this._dimensions.device.canvas.width,t[wn+3]=rn.size.y/this._dimensions.device.canvas.height,t[wn+4]=rn.texturePage,t[wn+5]=rn.texturePositionClipSpace.x,t[wn+6]=rn.texturePositionClipSpace.y,t[wn+7]=rn.sizeClipSpace.x,t[wn+8]=rn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&QI(r,f,rn.size.x,this._dimensions.device.cell.width)&&(t[wn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*Ma;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==n?this._vertices.attributesBuffers[i]=new Float32Array(n):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=n,i=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=Ma}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let c=o*this._terminal.cols*Ma,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*Ma);i.set(d,r),r+=d.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,r),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,r/Ma)}setAtlas(t){this._atlas=t;for(let n of this._atlasTextures)n.version=-1}_bindAtlasPageTexture(t,n,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=n.pages[i].version}setDimensions(t){this._dimensions=t}},P8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,n,i,r=!1){if(this.selectionStart=n,this.selectionEnd=i,!n||!i||n[0]===i[0]&&n[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,c=n[1]-o,d=i[1]-o,p=Math.max(c,0),f=Math.min(d,t.rows-1);if(p>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=f,this.startCol=n[0],this.endCol=i[0]}isCellSelected(t,n,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&i>=this.viewportCappedStartRow&&n<this.endCol&&i<=this.viewportCappedEndRow:n<this.startCol&&i>=this.viewportCappedStartRow&&n>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol):!1}};function $8(){return new P8}var ep=4,Cf=1,kf=2,T_=3,z8=2147483648,H8=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=$8()}resize(t,n){let i=t*n*ep;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},F8=`#version 300 es
|
|
58
|
-
layout (location = 0) in vec2 a_position;
|
|
59
|
-
layout (location = 1) in vec2 a_size;
|
|
60
|
-
layout (location = 2) in vec4 a_color;
|
|
61
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
62
|
-
|
|
63
|
-
uniform mat4 u_projection;
|
|
64
|
-
|
|
65
|
-
out vec4 v_color;
|
|
66
|
-
|
|
67
|
-
void main() {
|
|
68
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
69
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
70
|
-
v_color = a_color;
|
|
71
|
-
}`,U8=`#version 300 es
|
|
72
|
-
precision lowp float;
|
|
73
|
-
|
|
74
|
-
in vec4 v_color;
|
|
75
|
-
|
|
76
|
-
out vec4 outColor;
|
|
77
|
-
|
|
78
|
-
void main() {
|
|
79
|
-
outColor = v_color;
|
|
80
|
-
}`,Fr=8,A_=Fr*Float32Array.BYTES_PER_ELEMENT,W8=20*Fr,RC=class{constructor(){this.attributes=new Float32Array(W8),this.count=0}},Pr=0,NC=0,LC=0,MC=0,OC=0,DC=0,jC=0,q8=class extends Ys{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new RC,this._verticesCursor=new RC;let r=this._gl;this._program=zn(FT(r,F8,U8)),this._register(Ei(()=>r.deleteProgram(this._program))),this._projectionLocation=zn(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),c=r.createBuffer();this._register(Ei(()=>r.deleteBuffer(c))),r.bindBuffer(r.ARRAY_BUFFER,c),r.bufferData(r.ARRAY_BUFFER,o,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),p=r.createBuffer();this._register(Ei(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=zn(r.createBuffer()),this._register(Ei(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,A_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,A_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,A_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,HT),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,i=1,r,o,c,d,p,f,g,_,b,S,w;for(r=0;r<t.rows;r++){for(c=-1,d=0,p=0,f=!1,o=0;o<t.cols;o++)g=(r*t.cols+o)*ep,_=e.cells[g+Cf],b=e.cells[g+kf],S=!!(b&67108864),(_!==d||b!==p&&(f||S))&&((d!==0||f&&p!==0)&&(w=i++*Fr,this._updateRectangle(n,w,p,d,c,o,r)),c=o,d=_,p=b,f=S);(d!==0||f&&p!==0)&&(w=i++*Fr,this._updateRectangle(n,w,p,d,c,t.cols,r))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,r=0;(n.style==="bar"||n.style==="outline")&&(i=r++*Fr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=r++*Fr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=r++*Fr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=r++*Fr,this._addRectangleFloat(t.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,n,i,r,o,c){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Pr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Pr=(n&16777215)<<8;break;default:Pr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Pr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Pr=(i&16777215)<<8;break;default:Pr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=M8(e.attributes,this._terminal.rows*this._terminal.cols*Fr)),NC=r*this._dimensions.device.cell.width,LC=c*this._dimensions.device.cell.height,MC=(Pr>>24&255)/255,OC=(Pr>>16&255)/255,DC=(Pr>>8&255)/255,jC=1,this._addRectangle(e.attributes,t,NC,LC,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,MC,OC,DC,jC)}_addRectangle(e,t,n,i,r,o,c,d,p,f){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c,e[t+5]=d,e[t+6]=p,e[t+7]=f}_addRectangleFloat(e,t,n,i,r,o,c){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c[0],e[t+5]=c[1],e[t+6]=c[2],e[t+7]=c[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])}},G8=class extends Ys{constructor(t,n,i,r,o,c,d,p){super(),this._container=n,this._alpha=o,this._coreBrowserService=c,this._optionsService=d,this._themeService=p,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(Ei(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=zn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,i){}handleSelectionChanged(t,n,i,r=!1){}_setTransparency(t,n){if(n===this._alpha)return;let i=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=$T(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=TT,this._clipCell(i,r,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,i){let r=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},K8=class extends G8{constructor(t,n,i,r,o,c,d){super(i,t,"link",n,!0,o,c,d),this._register(r.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(r.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,n){super.resize(t,n),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&R8(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Co=typeof window=="object"?window:globalThis,ny=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new on,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new on,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ny.INSTANCE=new ny;var UT=ny;function V8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}UT.INSTANCE.onDidChangeZoomLevel;UT.INSTANCE.onDidChangeFullscreen;var lc=typeof navigator=="object"?navigator.userAgent:"";lc.indexOf("Firefox")>=0;lc.indexOf("AppleWebKit")>=0;var Y8=lc.indexOf("Chrome")>=0;!Y8&&lc.indexOf("Safari")>=0;lc.indexOf("Electron/")>=0;lc.indexOf("Android")>=0;var R_=!1;if(typeof Co.matchMedia=="function"){let e=Co.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Co.matchMedia("(display-mode: fullscreen)");R_=e.matches,V8(Co,e,({matches:n})=>{R_&&t.matches||(R_=n)})}var Pl="en",N_=!1,WT=!1,Gd,Ef=Pl,IC=Pl,X8,zr,No=globalThis,hs;typeof No.vscode<"u"&&typeof No.vscode.process<"u"?hs=No.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(hs=process);var Z8=typeof hs?.versions?.electron=="string",J8=Z8&&hs?.type==="renderer";if(typeof hs=="object"){hs.platform,hs.platform,N_=hs.platform==="linux",N_&&hs.env.SNAP&&hs.env.SNAP_REVISION,hs.env.CI||hs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Gd=Pl,Ef=Pl;let e=hs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Gd=t.userLocale,IC=t.osLocale,Ef=t.resolvedLanguage||Pl,X8=t.languagePack?.translationsConfigFile}catch{}WT=!0}else typeof navigator=="object"&&!J8?(zr=navigator.userAgent,zr.indexOf("Windows")>=0,zr.indexOf("Macintosh")>=0,(zr.indexOf("Macintosh")>=0||zr.indexOf("iPad")>=0||zr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,N_=zr.indexOf("Linux")>=0,zr?.indexOf("Mobi")>=0,Ef=globalThis._VSCODE_NLS_LANGUAGE||Pl,Gd=navigator.language.toLowerCase(),IC=Gd):console.error("Unable to resolve platform.");var BC=WT,fr=zr,ka=Ef,Q8;(e=>{function t(){return ka}e.value=t;function n(){return ka.length===2?ka==="en":ka.length>=3?ka[0]==="e"&&ka[1]==="n"&&ka[2]==="-":!1}e.isDefaultVariant=n;function i(){return ka==="en"}e.isDefault=i})(Q8||={});var e7=typeof No.postMessage=="function"&&!No.importScripts;(()=>{if(e7){let e=[];No.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),No.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var t7=!!(fr&&fr.indexOf("Chrome")>=0);fr&&fr.indexOf("Firefox")>=0;!t7&&fr&&fr.indexOf("Safari")>=0;fr&&fr.indexOf("Edg/")>=0;fr&&fr.indexOf("Android")>=0;var xl=typeof navigator=="object"?navigator:{};BC||document.queryCommandSupported&&document.queryCommandSupported("copy")||xl&&xl.clipboard&&xl.clipboard.writeText,BC||xl&&xl.clipboard&&xl.clipboard.readText;var s0=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}},L_=new s0,PC=new s0,$C=new s0;new Array(230);var n7;(e=>{function t(d){return L_.keyCodeToStr(d)}e.toString=t;function n(d){return L_.strToKeyCode(d)}e.fromString=n;function i(d){return PC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return $C.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return PC.strToKeyCode(d)||$C.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return L_.keyCodeToStr(d)}e.toElectronAccelerator=c})(n7||={});var qT=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),i7;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof s7?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ur.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qT})})(i7||={});var s7=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?qT:(this._emitter||(this._emitter=new on),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},r7;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(r7||={});var zC=class Ls{static fromArray(t){return new Ls(n=>{n.emitMany(t)})}static fromPromise(t){return new Ls(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ls(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ls(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new on,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ur.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ls(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ls.map(this,t)}static filter(t,n){return new Ls(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ls.filter(this,t)}static coalesce(t){return Ls.filter(t,n=>!!n)}coalesce(){return Ls.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ls.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};zC.EMPTY=zC.fromArray([]);var{getWindow:a7}=(function(){let e=new Map,t={window:Co,disposables:new ql};e.set(Co.vscodeWindowId,t);let n=new on,i=new on,r=new on;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ys.None;let d=new ql,p={window:c,disposables:d.add(new ql)};return e.set(c.vscodeWindowId,p),d.add(Ei(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(iy(c,l7.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(p),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let p=c;return p?.view?p.view.window:Co},getDocument(c){return a7(c).document}}})(),o7=class{constructor(t,n,i,r){this._node=t,this._type=n,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function iy(e,t,n,i){return new o7(e,t,n,i)}var l7={BEFORE_UNLOAD:"beforeunload"},c7=class extends Ys{constructor(t,n,i,r,o,c,d,p,f){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=c,this._optionsService=d,this._themeService=p,this._cursorBlinkStateManager=new ou,this._charAtlasDisposable=this._register(new ou),this._observerDisposable=this._register(new ou),this._model=new H8,this._workCell=new TC,this._workCell2=new TC,this._rectangleRenderer=this._register(new ou),this._glyphRenderer=this._register(new ou),this._onChangeTextureAtlas=this._register(new on),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new on),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new on),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new on),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new on),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n8(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new K8(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=e8(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(iy(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(iy(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,kC(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=EC(this._canvas,this._coreBrowserService.window,(_,b)=>this._setCanvasDevicePixelDimensions(_,b)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=EC(this._canvas,_,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ei(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),kC(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,n,i);this._model.selection.update(this._core,t,n,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new q8(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new B8(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=$T(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=wT(Ur.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ur.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new N8(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,c,d,p,f,g,_=0,b=!0,S,w,x,C,O,P,z,T,j;t=HC(t,i.rows-1,0),n=HC(n,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,F=H-i.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),ae=-1,K=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(c=t;c<=n;c++)for(d=c+i.buffer.ydisp,p=i.buffer.lines.get(d),this._model.lineLengths[c]=0,x=H===d,_=0,f=this._characterJoinerService.getJoinedCharacters(d),T=0;T<i.cols;T++){if(o=this._cellColorResolver.result.bg,p.loadCell(T,r),T===0&&(o=this._cellColorResolver.result.bg),g=!1,b=T>=_,S=T,f.length>0&&T===f[0][0]&&b){w=f.shift();let N=this._model.selection.isCellSelected(this._terminal,w[0],d);for(z=w[0]+1;z<w[1];z++)b&&=N===this._model.selection.isCellSelected(this._terminal,z,d);b&&=!x||ee<w[0]||ee>=w[1],b?(g=!0,r=new u7(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):_=w[1]}if(C=r.getChars(),O=r.getCode(),z=(c*i.cols+T)*ep,this._cellColorResolver.resolve(r,T,d,this.dimensions.device.cell.width),K&&d===H&&(T===ee&&(this._model.cursor={x:ee,y:F,width:r.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},ae=ee+r.getWidth()-1),T>=ee&&T<=ae&&(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)),O!==0&&(this._model.lineLengths[c]=T+1),!(this._model.cells[z]===O&&this._model.cells[z+Cf]===this._cellColorResolver.result.bg&&this._model.cells[z+kf]===this._cellColorResolver.result.fg&&this._model.cells[z+T_]===this._cellColorResolver.result.ext)&&(B=!0,C.length>1&&(O|=z8),this._model.cells[z]=O,this._model.cells[z+Cf]=this._cellColorResolver.result.bg,this._model.cells[z+kf]=this._cellColorResolver.result.fg,this._model.cells[z+T_]=this._cellColorResolver.result.ext,P=r.getWidth(),this._glyphRenderer.value.updateCell(T,c,O,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,C,P,o),g)){for(r=this._workCell,T++;T<=S;T++)j=(c*i.cols+T)*ep,this._glyphRenderer.value.updateCell(T,c,0,0,0,0,KI,0,0),this._model.cells[j]=0,this._model.cells[j+Cf]=this._cellColorResolver.result.bg,this._model.cells[j+kf]=this._cellColorResolver.result.fg,this._model.cells[j+T_]=this._cellColorResolver.result.ext;T--}}B&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},u7=class extends Bl{constructor(t,n,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function HC(e,t,n=0){return Math.max(Math.min(e,t),n)}var FC="di$target",UC="di$dependencies",M_=new Map;function _r(e){if(M_.has(e))return M_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h7(t,n,r)};return t._id=e,M_.set(e,t),t}function h7(e,t,n){t[FC]===t?t[UC].push({id:e,index:n}):(t[UC]=[{id:e,index:n}],t[FC]=t)}_r("BufferService");_r("CoreMouseService");_r("CoreService");_r("CharsetService");_r("InstantiationService");_r("LogService");var d7=_r("OptionsService");_r("OscLinkService");_r("UnicodeService");_r("DecorationService");var f7={trace:0,debug:1,info:2,warn:3,error:4,off:5},p7="xterm.js: ",WC=class extends Ys{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=f7[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":p7)+n,...i)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};WC=jI([II(0,d7)],WC);var m7=class extends Ys{constructor(t){if(kT&&GI()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new on),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new on),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new on),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new on),this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=n.coreService,r=n.optionsService,o=n,c=o._renderService,d=o._characterJoinerService,p=o._charSizeService,f=o._coreBrowserService,g=o._decorationService;o._logService;let _=o._themeService;this._renderer=this._register(new c7(t,d,p,f,i,g,r,_,this._preserveDrawingBuffer)),this._register(Ur.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ur.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ur.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ur.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Ei(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var GT=Object.defineProperty,g7=Object.getOwnPropertyDescriptor,_7=(e,t)=>{for(var n in t)GT(e,n,{get:t[n],enumerable:!0})},Tn=(e,t,n,i)=>{for(var r=i>1?void 0:i?g7(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=(i?c(t,n,r):c(r))||r);return i&&r&>(t,n,r),r},De=(e,t)=>(n,i)=>t(n,i,e),qC="Terminal input",sy={get:()=>qC,set:e=>qC=e},GC="Too much output to announce, navigate to rows manually to read",ry={get:()=>GC,set:e=>GC=e};function v7(e){return e.replace(/\r?\n/g,"\r")}function y7(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function b7(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function S7(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");KT(r,t,n,i)}}function KT(e,t,n,i){e=v7(e),e=y7(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function VT(e,t,n){let i=n.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function KC(e,t,n,i,r){VT(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Da(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Bp(e,t=0,n=e.length){let i="";for(let r=t;r<n;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var w7=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(c-55296)*1024+d-56320+65536:(t[i++]=c,t[i++]=d);continue}c!==65279&&(t[i++]=c)}return i}},x7=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r,o,c,d,p=0,f=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,x;for(;(x=this.interim[++w]&63)&&w<4;)S<<=6,S|=x;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,O=C-w;for(;f<O;){if(f>=n)return 0;if(x=e[f++],(x&192)!==128){f--,b=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}b||(C===2?S<128?f--:t[i++]=S:C===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let g=n-4,_=f;for(;_<n;){for(;_<g&&!((r=e[_])&128)&&!((o=e[_+1])&128)&&!((c=e[_+2])&128)&&!((d=e[_+3])&128);)t[i++]=r,t[i++]=o,t[i++]=c,t[i++]=d,_+=4;if(r=e[_++],r<128)t[i++]=r;else if((r&224)===192){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(r&31)<<6|o&63,p<128){_--;continue}t[i++]=p}else if((r&240)===224){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(r&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[i++]=p}else if((r&248)===240){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=c,i;if(d=e[_++],(d&192)!==128){_--;continue}if(p=(r&7)<<18|(o&63)<<12|(c&63)<<6|d&63,p<65536||p>1114111)continue;t[i++]=p}}return i}},YT="",Ba=" ",wh=class XT{constructor(){this.fg=0,this.bg=0,this.extended=new tp}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 XT;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}},tp=class ZT{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new ZT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Is=class JT extends wh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new tp,this.combinedData=""}static fromCharData(t){let n=new JT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Da(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},VC="di$target",ay="di$dependencies",O_=new Map;function C7(e){return e[ay]||[]}function oi(e){if(O_.has(e))return O_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");k7(t,n,r)};return t._id=e,O_.set(e,t),t}function k7(e,t,n){t[VC]===t?t[ay].push({id:e,index:n}):(t[ay]=[{id:e,index:n}],t[VC]=t)}var Bi=oi("BufferService"),QT=oi("CoreMouseService"),Ho=oi("CoreService"),E7=oi("CharsetService"),r0=oi("InstantiationService"),eA=oi("LogService"),Pi=oi("OptionsService"),tA=oi("OscLinkService"),T7=oi("UnicodeService"),xh=oi("DecorationService"),oy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Is,c=n.getTrimmedLength(),d=-1,p=-1,f=!1;for(let g=0;g<c;g++)if(!(p===-1&&!n.hasContent(g))){if(n.loadCell(g,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=g,d=o.extended.urlId;continue}else f=o.extended.urlId!==d;else p!==-1&&(f=!0);if(f||p!==-1&&g===c-1){let _=this._oscLinkService.getLinkData(d)?.uri;if(_){let b={start:{x:p+1,y:e},end:{x:g+(!f&&g===c-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(_);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:_,range:b,activate:(w,x)=>r?r.activate(w,x,b):A7(w,x),hover:(w,x)=>r?.hover?.(w,x,b),leave:(w,x)=>r?.leave?.(w,x,b)})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=g,d=o.extended.urlId):(p=-1,d=-1)}}t(i)}};oy=Tn([De(0,Bi),De(1,Pi),De(2,tA)],oy);function A7(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
81
|
-
|
|
82
|
-
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Pp=oi("CharSizeService"),Zr=oi("CoreBrowserService"),a0=oi("MouseService"),Jr=oi("RenderService"),R7=oi("SelectionService"),nA=oi("CharacterJoinerService"),cc=oi("ThemeService"),iA=oi("LinkProviderService"),N7=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?YC.isErrorNoTelemetry(e)?new YC(e.message+`
|
|
83
|
-
|
|
84
|
-
`+e.stack):new Error(e.message+`
|
|
85
|
-
|
|
86
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},L7=new N7;function Tf(e){M7(e)||L7.onUnexpectedError(e)}var ly="Canceled";function M7(e){return e instanceof O7?!0:e instanceof Error&&e.name===ly&&e.message===ly}var O7=class extends Error{constructor(){super(ly),this.name=this.message}};function D7(e){return new Error(`Illegal argument: ${e}`)}var YC=class cy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof cy)return t;let n=new cy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},uy=class sA extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,sA.prototype)}};function cs(e,t=0){return e[e.length-(1+t)]}var j7;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(j7||={});function I7(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var rA;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let j=T.length-1;j>=0;j--)yield T[j]}e.reverse=d;function p(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(T){return T[Symbol.iterator]().next().value}e.first=f;function g(T,j){let M=0;for(let H of T)if(j(H,M++))return!0;return!1}e.some=g;function _(T,j){for(let M of T)if(j(M))return M}e.find=_;function*b(T,j){for(let M of T)j(M)&&(yield M)}e.filter=b;function*S(T,j){let M=0;for(let H of T)yield j(H,M++)}e.map=S;function*w(T,j){let M=0;for(let H of T)yield*j(H,M++)}e.flatMap=w;function*x(...T){for(let j of T)yield*j}e.concat=x;function C(T,j,M){let H=M;for(let F of T)H=j(H,F);return H}e.reduce=C;function*O(T,j,M=T.length){for(j<0&&(j+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);j<M;j++)yield T[j]}e.slice=O;function P(T,j=Number.POSITIVE_INFINITY){let M=[];if(j===0)return[M,T];let H=T[Symbol.iterator]();for(let F=0;F<j;F++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=P;async function z(T){let j=[];for await(let M of T)j.push(M);return Promise.resolve(j)}e.asyncToArray=z})(rA||={});function Io(e){if(rA.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function B7(...e){return mn(()=>Io(e))}function mn(e){return{dispose:I7(()=>{e()})}}var aA=class oA{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{Io(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?oA.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};aA.DISABLE_DISPOSED_WARNING=!1;var za=aA,_t=class{constructor(){this._store=new za,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)}};_t.None=Object.freeze({dispose(){}});var Jl=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}},Wr=typeof window=="object"?window:globalThis,hy=class dy{constructor(t){this.element=t,this.next=dy.Undefined,this.prev=dy.Undefined}};hy.Undefined=new hy(void 0);var _n=hy,XC=class{constructor(){this._first=_n.Undefined,this._last=_n.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===_n.Undefined}clear(){let e=this._first;for(;e!==_n.Undefined;){let t=e.next;e.prev=_n.Undefined,e.next=_n.Undefined,e=t}this._first=_n.Undefined,this._last=_n.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new _n(e);if(this._first===_n.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==_n.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==_n.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==_n.Undefined&&e.next!==_n.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===_n.Undefined&&e.next===_n.Undefined?(this._first=_n.Undefined,this._last=_n.Undefined):e.next===_n.Undefined?(this._last=this._last.prev,this._last.next=_n.Undefined):e.prev===_n.Undefined&&(this._first=this._first.next,this._first.prev=_n.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==_n.Undefined;)yield e.element,e=e.next}},P7=globalThis.performance&&typeof globalThis.performance.now=="function",$7=class lA{static create(t){return new lA(t)}constructor(t){this._now=P7&&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}},gi;(e=>{e.None=()=>_t.None;function t(B,N){return _(B,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(B){return(N,R=null,A)=>{let E=!1,L;return L=B($=>{if(!E)return L?L.dispose():E=!0,N.call(R,$)},null,A),E&&L.dispose(),L}}e.once=n;function i(B,N,R){return f((A,E=null,L)=>B($=>A.call(E,N($)),null,L),R)}e.map=i;function r(B,N,R){return f((A,E=null,L)=>B($=>{N($),A.call(E,$)},null,L),R)}e.forEach=r;function o(B,N,R){return f((A,E=null,L)=>B($=>N($)&&A.call(E,$),null,L),R)}e.filter=o;function c(B){return B}e.signal=c;function d(...B){return(N,R=null,A)=>{let E=B7(...B.map(L=>L($=>N.call(R,$))));return g(E,A)}}e.any=d;function p(B,N,R,A){let E=R;return i(B,L=>(E=N(E,L),E),A)}e.reduce=p;function f(B,N){let R,A={onWillAddFirstListener(){R=B(E.fire,E)},onDidRemoveLastListener(){R?.dispose()}},E=new ke(A);return N?.add(E),E.event}function g(B,N){return N instanceof Array?N.push(B):N&&N.add(B),B}function _(B,N,R=100,A=!1,E=!1,L,$){let q,X,D,V=0,J,ce={leakWarningThreshold:L,onWillAddFirstListener(){q=B(ve=>{V++,X=N(X,ve),A&&!D&&(ie.fire(X),X=void 0),J=()=>{let Se=X;X=void 0,D=void 0,(!A||V>1)&&ie.fire(Se),V=0},typeof R=="number"?(clearTimeout(D),D=setTimeout(J,R)):D===void 0&&(D=0,queueMicrotask(J))})},onWillRemoveListener(){E&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},ie=new ke(ce);return $?.add(ie),ie.event}e.debounce=_;function b(B,N=0,R){return e.debounce(B,(A,E)=>A?(A.push(E),A):[E],N,void 0,!0,void 0,R)}e.accumulate=b;function S(B,N=(A,E)=>A===E,R){let A=!0,E;return o(B,L=>{let $=A||!N(L,E);return A=!1,E=L,$},R)}e.latch=S;function w(B,N,R){return[e.filter(B,N,R),e.filter(B,A=>!N(A),R)]}e.split=w;function x(B,N=!1,R=[],A){let E=R.slice(),L=B(X=>{E?E.push(X):q.fire(X)});A&&A.add(L);let $=()=>{E?.forEach(X=>q.fire(X)),E=null},q=new ke({onWillAddFirstListener(){L||(L=B(X=>q.fire(X)),A&&A.add(L))},onDidAddFirstListener(){E&&(N?setTimeout($):$())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return A&&A.add(q),q.event}e.buffer=x;function C(B,N){return(R,A,E)=>{let L=N(new P);return B(function($){let q=L.evaluate($);q!==O&&R.call(A,q)},void 0,E)}}e.chain=C;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(R=>(N(R),R)),this}filter(N){return this.steps.push(R=>N(R)?R:O),this}reduce(N,R){let A=R;return this.steps.push(E=>(A=N(A,E),A)),this}latch(N=(R,A)=>R===A){let R=!0,A;return this.steps.push(E=>{let L=R||!N(E,A);return R=!1,A=E,L?E:O}),this}evaluate(N){for(let R of this.steps)if(N=R(N),N===O)break;return N}}function z(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.on(N,A),L=()=>B.removeListener(N,A),$=new ke({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromNodeEventEmitter=z;function T(B,N,R=A=>A){let A=(...q)=>$.fire(R(...q)),E=()=>B.addEventListener(N,A),L=()=>B.removeEventListener(N,A),$=new ke({onWillAddFirstListener:E,onDidRemoveLastListener:L});return $.event}e.fromDOMEventEmitter=T;function j(B){return new Promise(N=>n(B)(N))}e.toPromise=j;function M(B){let N=new ke;return B.then(R=>{N.fire(R)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=M;function H(B,N){return B(R=>N.fire(R))}e.forward=H;function F(B,N,R){return N(R),B(A=>N(A))}e.runAndSubscribe=F;class ee{constructor(N,R){this._observable=N,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new ke(A),R&&R.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,R){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(B,N){return new ee(B,N).emitter.event}e.fromObservable=ae;function K(B){return(N,R,A)=>{let E=0,L=!1,$={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),L&&(L=!1,N.call(R)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver($),B.reportChanges();let q={dispose(){B.removeObserver($)}};return A instanceof za?A.add(q):Array.isArray(A)&&A.push(q),q}}e.fromObservableLight=K})(gi||={});var fy=class py{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${py._idPool++}`,py.all.add(this)}start(t){this._stopWatch=new $7,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}}};fy.all=new Set,fy._idPool=0;var z7=fy,H7=-1,cA=class uA{constructor(t,n,i=(uA._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new W7(d,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};cA._idPool=1;var F7=cA,U7=class hA{constructor(t){this.value=t}static create(){let t=new Error;return new hA(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
-
`).slice(2).join(`
|
|
88
|
-
`))}},W7=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},q7=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},G7=0,D_=class{constructor(e){this.value=e,this.id=G7++}},K7=2,V7,ke=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new F7(t?.onListenerError??Tf,this._options?.leakWarningThreshold??H7):void 0,this._perfMon=this._options?._profName?new z7(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new q7(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Tf)(f),_t.None}if(this._disposed)return _t.None;n&&(t=t.bind(n));let r=new D_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=U7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof D_?(this._deliveryQueue??=new Y7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=mn(()=>{o?.(),this._removeListener(r)});return i instanceof za?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*K7<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||Tf;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof D_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Y7=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},my=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ke,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ke,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};my.INSTANCE=new my;var o0=my;function X7(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}o0.INSTANCE.onDidChangeZoomLevel;function Z7(e){return o0.INSTANCE.getZoomFactor(e)}o0.INSTANCE.onDidChangeFullscreen;var uc=typeof navigator=="object"?navigator.userAgent:"",gy=uc.indexOf("Firefox")>=0,J7=uc.indexOf("AppleWebKit")>=0,l0=uc.indexOf("Chrome")>=0,Q7=!l0&&uc.indexOf("Safari")>=0;uc.indexOf("Electron/")>=0;uc.indexOf("Android")>=0;var j_=!1;if(typeof Wr.matchMedia=="function"){let e=Wr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Wr.matchMedia("(display-mode: fullscreen)");j_=e.matches,X7(Wr,e,({matches:n})=>{j_&&t.matches||(j_=n)})}var $l="en",_y=!1,vy=!1,Af=!1,dA=!1,Kd,Rf=$l,ZC=$l,eB,Hr,Lo=globalThis,ds;typeof Lo.vscode<"u"&&typeof Lo.vscode.process<"u"?ds=Lo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ds=process);var tB=typeof ds?.versions?.electron=="string",nB=tB&&ds?.type==="renderer";if(typeof ds=="object"){_y=ds.platform==="win32",vy=ds.platform==="darwin",Af=ds.platform==="linux",Af&&ds.env.SNAP&&ds.env.SNAP_REVISION,ds.env.CI||ds.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Kd=$l,Rf=$l;let e=ds.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Kd=t.userLocale,ZC=t.osLocale,Rf=t.resolvedLanguage||$l,eB=t.languagePack?.translationsConfigFile}catch{}dA=!0}else typeof navigator=="object"&&!nB?(Hr=navigator.userAgent,_y=Hr.indexOf("Windows")>=0,vy=Hr.indexOf("Macintosh")>=0,(Hr.indexOf("Macintosh")>=0||Hr.indexOf("iPad")>=0||Hr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Af=Hr.indexOf("Linux")>=0,Hr?.indexOf("Mobi")>=0,Rf=globalThis._VSCODE_NLS_LANGUAGE||$l,Kd=navigator.language.toLowerCase(),ZC=Kd):console.error("Unable to resolve platform.");var fA=_y,cr=vy,iB=Af,JC=dA,pr=Hr,Ea=Rf,sB;(e=>{function t(){return Ea}e.value=t;function n(){return Ea.length===2?Ea==="en":Ea.length>=3?Ea[0]==="e"&&Ea[1]==="n"&&Ea[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ea==="en"}e.isDefault=i})(sB||={});var rB=typeof Lo.postMessage=="function"&&!Lo.importScripts;(()=>{if(rB){let e=[];Lo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),Lo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var aB=!!(pr&&pr.indexOf("Chrome")>=0);pr&&pr.indexOf("Firefox")>=0;!aB&&pr&&pr.indexOf("Safari")>=0;pr&&pr.indexOf("Edg/")>=0;pr&&pr.indexOf("Android")>=0;var Cl=typeof navigator=="object"?navigator:{};JC||document.queryCommandSupported&&document.queryCommandSupported("copy")||Cl&&Cl.clipboard&&Cl.clipboard.writeText,JC||Cl&&Cl.clipboard&&Cl.clipboard.readText;var c0=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}},I_=new c0,QC=new c0,ek=new c0,oB=new Array(230),pA;(e=>{function t(d){return I_.keyCodeToStr(d)}e.toString=t;function n(d){return I_.strToKeyCode(d)}e.fromString=n;function i(d){return QC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return ek.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return QC.strToKeyCode(d)||ek.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return I_.keyCodeToStr(d)}e.toElectronAccelerator=c})(pA||={});var lB=class mA{constructor(t,n,i,r,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof mA&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new cB([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},cB=class{constructor(e){if(e.length===0)throw D7("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function uB(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return pA.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(gy)switch(t){case 59:return 85;case 60:if(iB)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(cr)return 57;break}else if(J7&&(cr&&t===93||!cr&&t===92))return 57;return oB[t]||0}var hB=cr?256:2048,dB=512,fB=1024,pB=cr?2048:256,tk=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=uB(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=hB),this.altKey&&(t|=dB),this.shiftKey&&(t|=fB),this.metaKey&&(t|=pB),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new lB(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},nk=new WeakMap;function mB(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var gB=class{static getSameOriginWindowChain(e){let t=nk.get(e);if(!t){t=[],nk.set(e,t);let n=e,i;do i=mB(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let c=o.window.deref();if(n+=c?.scrollY??0,i+=c?.scrollX??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();n+=d.top,i+=d.left}return{top:n,left:i}}},Vd=class{constructor(t,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=gB.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ik=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(l0){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,c=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*c):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?gy&&!cr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Q7&&fA?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*c):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?gy&&!cr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},gA=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),_B;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof vB?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:gA})})(_B||={});var vB=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?gA:(this._emitter||(this._emitter=new ke),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},u0=class{constructor(t,n){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof n=="number"&&this.setIfNotSet(t,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,n){if(this._isDisposed)throw new uy("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new uy("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},yB=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new uy("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=mn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},bB;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(bB||={});var sk=class Ms{static fromArray(t){return new Ms(n=>{n.emitMany(t)})}static fromPromise(t){return new Ms(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ms(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ms(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ke,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await gi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ms(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ms.map(this,t)}static filter(t,n){return new Ms(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ms.filter(this,t)}static coalesce(t){return Ms.filter(t,n=>!!n)}coalesce(){return Ms.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ms.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())}};sk.EMPTY=sk.fromArray([]);var{getWindow:lr,getWindowId:SB,onDidRegisterWindow:wB}=(function(){let e=new Map,t={window:Wr,disposables:new za};e.set(Wr.vscodeWindowId,t);let n=new ke,i=new ke,r=new ke;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return _t.None;let d=new za,p={window:c,disposables:d.add(new za)};return e.set(c.vscodeWindowId,p),d.add(mn(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(nt(c,Qn.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(p),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let p=c;return p?.view?p.view.window:Wr},getDocument(c){return lr(c).document}}})(),xB=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function nt(e,t,n,i){return new xB(e,t,n,i)}var rk=function(e,t,n,i){return nt(e,t,n,i)},h0,CB=class extends yB{constructor(e){super(),this.defaultTarget=e&&lr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},ak=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Tf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,r=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),i.set(o,!0);c.length>0;)c.sort(ak.sort),c.shift().execute();i.set(o,!1)};h0=(o,c,d=0)=>{let p=SB(o),f=new ak(c,d),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(f),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function kB(e){let t=e.getBoundingClientRect(),n=lr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Qn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},EB=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Vi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Vi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Vi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Vi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Vi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Vi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Vi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Vi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Vi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Vi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Vi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Vi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Vi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Vi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Vi(e){return typeof e=="number"?`${e}px`:e}function Ku(e){return new EB(e)}var _A=class{constructor(){this._hooks=new za,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(mn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=lr(e)}this._hooks.add(nt(o,Qn.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(nt(o,Qn.POINTER_UP,c=>this.stopMonitoring(!0)))}};function TB(e,t,n){let i=null,r=null;if(typeof n.value=="function"?(i="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",r=n.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,c)}),this[o]}}var rr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(rr||={});var Du=class Ci extends _t{constructor(){super(),this.dispatched=!1,this.targets=new XC,this.ignoreTargets=new XC,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(gi.runAndSubscribe(wB,({window:t,disposables:n})=>{n.add(nt(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(nt(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(nt(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Wr,disposables:this._store}))}static addTarget(t){if(!Ci.isTouchDevice())return _t.None;Ci.INSTANCE||(Ci.INSTANCE=new Ci);let n=Ci.INSTANCE.targets.push(t);return mn(n)}static ignoreTarget(t){if(!Ci.isTouchDevice())return _t.None;Ci.INSTANCE||(Ci.INSTANCE=new Ci);let n=Ci.INSTANCE.ignoreTargets.push(t);return mn(n)}static isTouchDevice(){return"ontouchstart"in Wr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(rr.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let d=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let p=this.activeTouches[d.identifier],f=Date.now()-p.initialTimeStamp;if(f<Ci.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let g=this.newGestureEvent(rr.Tap,p.initialTarget);g.pageX=cs(p.rollingPageX),g.pageY=cs(p.rollingPageY),this.dispatchEvent(g)}else if(f>=Ci.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let g=this.newGestureEvent(rr.Contextmenu,p.initialTarget);g.pageX=cs(p.rollingPageX),g.pageY=cs(p.rollingPageY),this.dispatchEvent(g)}else if(r===1){let g=cs(p.rollingPageX),_=cs(p.rollingPageY),b=cs(p.rollingTimestamps)-p.rollingTimestamps[0],S=g-p.rollingPageX[0],w=_-p.rollingPageY[0],x=[...this.targets].filter(C=>p.initialTarget instanceof Node&&C.contains(p.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,g,Math.abs(w)/b,w>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(rr.End,p.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===rr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ci.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===rr.Change||t.type===rr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;n.push([r,i])}n.sort((i,r)=>i[0]-r[0]);for(let[i,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,r,o,c,d,p,f){this.handle=h0(t,()=>{let g=Date.now(),_=g-i,b=0,S=0,w=!0;r+=Ci.SCROLL_FRICTION*_,d+=Ci.SCROLL_FRICTION*_,r>0&&(w=!1,b=o*r*_),d>0&&(w=!1,S=p*d*_);let x=this.newGestureEvent(rr.Change);x.translationX=b,x.translationY=S,n.forEach(C=>C.dispatchEvent(x)),w||this.inertia(t,n,g,r,o,c+b,d,p,f+S)})}onTouchMove(t){let n=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],d=this.newGestureEvent(rr.Change,c.initialTarget);d.translationX=o.pageX-cs(c.rollingPageX),d.translationY=o.pageY-cs(c.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Du.SCROLL_FRICTION=-.005,Du.HOLD_DELAY=700,Du.CLEAR_TAP_COUNT_TIME=400,Tn([TB],Du,"isTouchDevice",1);var AB=Du,d0=class extends _t{onclick(e,t){this._register(nt(e,Qn.CLICK,n=>t(new Vd(lr(e),n))))}onmousedown(e,t){this._register(nt(e,Qn.MOUSE_DOWN,n=>t(new Vd(lr(e),n))))}onmouseover(e,t){this._register(nt(e,Qn.MOUSE_OVER,n=>t(new Vd(lr(e),n))))}onmouseleave(e,t){this._register(nt(e,Qn.MOUSE_LEAVE,n=>t(new Vd(lr(e),n))))}onkeydown(e,t){this._register(nt(e,Qn.KEY_DOWN,n=>t(new tk(n))))}onkeyup(e,t){this._register(nt(e,Qn.KEY_UP,n=>t(new tk(n))))}oninput(e,t){this._register(nt(e,Qn.INPUT,t))}onblur(e,t){this._register(nt(e,Qn.BLUR,t))}onfocus(e,t){this._register(nt(e,Qn.FOCUS,t))}onchange(e,t){this._register(nt(e,Qn.CHANGE,t))}ignoreGesture(e){return AB.ignoreTarget(e)}},ok=11,RB=class extends d0{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=ok+"px",this.domNode.style.height=ok+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new _A),this._register(rk(this.bgDomNode,Qn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(rk(this.domNode,Qn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CB),this._pointerdownScheduleRepeatTimer=this._register(new u0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,lr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},NB=class yy{constructor(t,n,i,r,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=r,this.rawScrollTop=d,n<0&&(n=0),r+n>i&&(r=i-n),r<0&&(r=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new yy(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new yy(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:p}}},LB=class extends _t{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new NB(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let i;t?i=new ck(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=ck.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},lk=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function B_(e,t){let n=t-e;return function(i){return e+n*DB(i)}}function MB(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var ck=class by{constructor(t,n,i,r){this.from=t,this.to=n,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,i){if(Math.abs(t-n)>2.5*i){let r,o;return t<n?(r=t+.75*i,o=n-.75*i):(r=t-.75*i,o=n+.75*i),MB(B_(t,r),B_(o,n),.33)}return B_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let i=this.scrollLeft(n),r=this.scrollTop(n);return new lk(i,r,!1)}return new lk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return by.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new by(t,n,r,i)}};function OB(e){return Math.pow(e,3)}function DB(e){return 1-OB(1-e)}var jB=class extends _t{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new u0)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},IB=140,vA=class extends d0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new jB(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new _A),this._shouldRender=!0,this.domNode=Ku(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(nt(this.domNode.domNode,Qn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new RB(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Ku(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(nt(this.slider.domNode,Qn.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=kB(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),c=Math.abs(o-n);if(fA&&c>IB){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},yA=class Sy{constructor(t,n,i,r,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Sy(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,i,r,o){let c=Math.max(0,i-t),d=Math.max(0,c-2*n),p=r>0&&r>i;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*d/r))),g=(d-f)/(r-i),_=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Sy._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},BB=class extends vA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new yA(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},PB=class extends vA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new yA(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},$B=500,uk=50,zB=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},wy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(l0){let n=lr(t.browserEvent),i=Z7(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let r=null,o=new zB(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),d=Math.abs(n.deltaY),p=Math.max(Math.min(r,c),1),f=Math.max(Math.min(o,d),1),g=Math.max(r,c),_=Math.max(o,d);g%p===0&&_%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};wy.INSTANCE=new wy;var HB=wy,FB=class extends d0{constructor(e,t,n){super(),this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ke),this.onWillScroll=this._onWillScroll.event,this._options=WB(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new PB(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new BB(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ku(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ku(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ku(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new u0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Io(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,cr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new ik(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Io(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new ik(n))};this._mouseWheelToDispose.push(nt(this._listenOnDomNode,Qn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=HB.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let c=!cr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),p={};if(r){let f=uk*r,g=d.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,g)}if(o){let f=uk*o,g=d.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,g)}p=this._scrollable.validateScrollPosition(p),(d.scrollLeft!==p.scrollLeft||d.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,i=n?" left":"",r=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),$B)}},UB=class extends FB{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function WB(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,cr&&(t.className+=" mac"),t}var xy=class extends _t{constructor(e,t,n,i,r,o,c,d){super(),this._bufferService=n,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new ke),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new LB({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>h0(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new UB(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(gi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(mn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(mn(()=>this._styleElement.remove())),this._register(gi.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
89
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};xy=Tn([De(2,Bi),De(3,Zr),De(4,QT),De(5,cc),De(6,Pi),De(7,Jr)],xy);var Cy=class extends _t{constructor(e,t,n,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(mn(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Cy=Tn([De(1,Bi),De(2,Zr),De(3,xh),De(4,Jr)],Cy);var qB=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},ir={full:0,left:0,center:0,right:0},Ta={full:0,left:0,center:0,right:0},hu={full:0,left:0,center:0,right:0},np=class extends _t{constructor(e,t,n,i,r,o,c,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new qB,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(mn(()=>this._canvas?.remove()));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ta.full=this._canvas.width,Ta.left=e,Ta.center=t,Ta.right=e,this._refreshDrawHeightConstants(),hu.full=1,hu.left=1,hu.center=1+Ta.left,hu.right=1+Ta.left+Ta.center}_refreshDrawHeightConstants(){ir.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);ir.left=t,ir.center=t,ir.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ir.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ir.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ir.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ir.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(hu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ir[e.position||"full"]/2),Ta[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ir[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};np=Tn([De(2,Bi),De(3,xh),De(4,Jr),De(5,Pi),De(6,cc),De(7,Zr)],np);var _e;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
90
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(_e||={});var Nf;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Nf||={});var bA;(e=>e.ST=`${_e.ESC}\\`)(bA||={});var ky=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${_e.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ky=Tn([De(2,Bi),De(3,Pi),De(4,Ho),De(5,Jr)],ky);var ii=0,si=0,ri=0,En=0,hk={css:"#00000000",rgba:0},Hn;(e=>{function t(r,o,c,d){return d!==void 0?`#${_o(r)}${_o(o)}${_o(c)}${_o(d)}`:`#${_o(r)}${_o(o)}${_o(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(Hn||={});var an;(e=>{function t(p,f){if(En=(f.rgba&255)/255,En===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;ii=S+Math.round((g-S)*En),si=w+Math.round((_-w)*En),ri=x+Math.round((b-x)*En);let C=Hn.toCss(ii,si,ri),O=Hn.toRgba(ii,si,ri);return{css:C,rgba:O}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let _=Lf.ensureContrastRatio(p.rgba,f.rgba,g);if(_)return Hn.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[ii,si,ri]=Lf.toChannels(f),{css:Hn.toCss(ii,si,ri),rgba:f}}e.opaque=r;function o(p,f){return En=Math.round(f*255),[ii,si,ri]=Lf.toChannels(p.rgba),{css:Hn.toCss(ii,si,ri,En),rgba:Hn.toRgba(ii,si,ri,En)}}e.opacity=o;function c(p,f){return En=p.rgba&255,o(p,En*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(an||={});var vn;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ii=parseInt(r.slice(1,2).repeat(2),16),si=parseInt(r.slice(2,3).repeat(2),16),ri=parseInt(r.slice(3,4).repeat(2),16),Hn.toColor(ii,si,ri);case 5:return ii=parseInt(r.slice(1,2).repeat(2),16),si=parseInt(r.slice(2,3).repeat(2),16),ri=parseInt(r.slice(3,4).repeat(2),16),En=parseInt(r.slice(4,5).repeat(2),16),Hn.toColor(ii,si,ri,En);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return ii=parseInt(o[1]),si=parseInt(o[2]),ri=parseInt(o[3]),En=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Hn.toColor(ii,si,ri,En);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ii,si,ri,En]=t.getImageData(0,0,1,1).data,En!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Hn.toRgba(ii,si,ri,En),css:r}}e.toColor=i})(vn||={});var Ni;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(Ni||={});var Lf;(e=>{function t(c,d){if(En=(d&255)/255,En===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,_=c>>24&255,b=c>>16&255,S=c>>8&255;return ii=_+Math.round((p-_)*En),si=b+Math.round((f-b)*En),ri=S+Math.round((g-S)*En),Hn.toRgba(ii,si,ri)}e.blend=t;function n(c,d,p){let f=Ni.relativeLuminance(c>>8),g=Ni.relativeLuminance(d>>8);if($r(f,g)<p){if(g<f){let S=i(c,d,p),w=$r(f,Ni.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),C=$r(f,Ni.relativeLuminance(x>>8));return w>C?S:x}return S}let _=r(c,d,p),b=$r(f,Ni.relativeLuminance(_>>8));if(b<p){let S=i(c,d,p),w=$r(f,Ni.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=$r(Ni.relativeLuminance2(b,S,w),Ni.relativeLuminance2(f,g,_));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=$r(Ni.relativeLuminance2(b,S,w),Ni.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=$r(Ni.relativeLuminance2(b,S,w),Ni.relativeLuminance2(f,g,_));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=$r(Ni.relativeLuminance2(b,S,w),Ni.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Lf||={});function _o(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)}var GB=class extends wh{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ip=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Is}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),r=0,o=0,c=0,d=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==p){if(f-r>1){let g=this._getJoinedRanges(i,c,o,t,r);for(let _=0;_<g.length;_++)n.push(g[_])}r=f,c=o,d=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||Ba.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(i,c,o,t,r);for(let g=0;g<f.length;g++)n.push(f[g])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let p=this._characterJoiners[d].handler(o);for(let f=0;f<p.length;f++)ip._mergeRanges(c,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,i,r),c}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,c=e[i];if(c){for(let d=n;d<this._bufferService.cols;d++){let p=t.getWidth(d),f=t.getString(d).length||Ba.length;if(p!==0){if(!r&&c[0]<=o&&(c[0]=d,r=!0),c[1]<=o){if(c[1]=d,c=e[++i],!c)break;c[0]<=o?(c[0]=d,r=!0):r=!1}o+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];if(n){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};ip=Tn([De(0,Bi)],ip);function KB(e){return 57508<=e&&e<=57558}function VB(e){return 9472<=e&&e<=9631}function YB(e){return KB(e)||VB(e)}function XB(){return{css:{canvas:Yd(),cell:Yd()},device:{canvas:Yd(),cell:Yd(),char:{width:0,height:0,left:0,top:0}}}}function Yd(){return{width:0,height:0}}var Ey=class{constructor(e,t,n,i,r,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=c,this._workCell=new Is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,c,d,p,f,g){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,C=0,O="",P=0,z=0,T=0,j=0,M=!1,H=0,F=!1,ee=0,ae=0,K=[],B=f!==-1&&g!==-1;for(let N=0;N<w;N++){e.loadCell(N,this._workCell);let R=this._workCell.getWidth();if(R===0)continue;let A=!1,E=N>=ae,L=N,$=this._workCell;if(b.length>0&&N===b[0][0]&&E){let xe=b.shift(),ze=this._isCellInSelection(xe[0],t);for(P=xe[0]+1;P<xe[1];P++)E&&=ze===this._isCellInSelection(P,t);E&&=!n||o<xe[0]||o>=xe[1],E?(A=!0,$=new GB(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),L=xe[1]-1,R=$.getWidth()):ae=xe[1]}let q=this._isCellInSelection(N,t),X=n&&N===o,D=B&&N>=f&&N<=g,V=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,xe=>{V=!0});let J=$.getChars()||Ba;if(J===" "&&($.isUnderline()||$.isOverline())&&(J=" "),ee=R*d-p.get(J,$.isBold(),$.isItalic()),!x)x=this._document.createElement("span");else if(C&&(q&&F||!q&&!F&&$.bg===z)&&(q&&F&&S.selectionForeground||$.fg===T)&&$.extended.ext===j&&D===M&&ee===H&&!X&&!A&&!V&&E){$.isInvisible()?O+=Ba:O+=J,C++;continue}else C&&(x.textContent=O),x=this._document.createElement("span"),C=0,O="";if(z=$.bg,T=$.fg,j=$.extended.ext,M=D,H=ee,F=q,A&&o>=N&&o<=L&&(o=N),!this._coreService.isCursorHidden&&X&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&K.push("xterm-cursor-blink"),K.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if($.isBold()&&K.push("xterm-bold"),$.isItalic()&&K.push("xterm-italic"),$.isDim()&&K.push("xterm-dim"),$.isInvisible()?O=Ba:O=$.getChars()||Ba,$.isUnderline()&&(K.push(`xterm-underline-${$.extended.underlineStyle}`),O===" "&&(O=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${wh.toColorRGB($.getUnderlineColor()).join(",")})`;else{let xe=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&xe<8&&(xe+=8),x.style.textDecorationColor=S.ansi[xe].css}$.isOverline()&&(K.push("xterm-overline"),O===" "&&(O=" ")),$.isStrikethrough()&&K.push("xterm-strikethrough"),D&&(x.style.textDecoration="underline");let ce=$.getFgColor(),ie=$.getFgColorMode(),ve=$.getBgColor(),Se=$.getBgColorMode(),Oe=!!$.isInverse();if(Oe){let xe=ce;ce=ve,ve=xe;let ze=ie;ie=Se,Se=ze}let Ne,ct,Ze=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,xe=>{xe.options.layer!=="top"&&Ze||(xe.backgroundColorRGB&&(Se=50331648,ve=xe.backgroundColorRGB.rgba>>8&16777215,Ne=xe.backgroundColorRGB),xe.foregroundColorRGB&&(ie=50331648,ce=xe.foregroundColorRGB.rgba>>8&16777215,ct=xe.foregroundColorRGB),Ze=xe.options.layer==="top")}),!Ze&&q&&(Ne=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ve=Ne.rgba>>8&16777215,Se=50331648,Ze=!0,S.selectionForeground&&(ie=50331648,ce=S.selectionForeground.rgba>>8&16777215,ct=S.selectionForeground)),Ze&&K.push("xterm-decoration-top");let Re;switch(Se){case 16777216:case 33554432:Re=S.ansi[ve],K.push(`xterm-bg-${ve}`);break;case 50331648:Re=Hn.toColor(ve>>16,ve>>8&255,ve&255),this._addStyle(x,`background-color:#${dk((ve>>>0).toString(16),"0",6)}`);break;default:Oe?(Re=S.foreground,K.push("xterm-bg-257")):Re=S.background}switch(Ne||$.isDim()&&(Ne=an.multiplyOpacity(Re,.5)),ie){case 16777216:case 33554432:$.isBold()&&ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ce+=8),this._applyMinimumContrast(x,Re,S.ansi[ce],$,Ne,void 0)||K.push(`xterm-fg-${ce}`);break;case 50331648:let xe=Hn.toColor(ce>>16&255,ce>>8&255,ce&255);this._applyMinimumContrast(x,Re,xe,$,Ne,ct)||this._addStyle(x,`color:#${dk(ce.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Re,S.foreground,$,Ne,ct)||Oe&&K.push("xterm-fg-257")}K.length&&(x.className=K.join(" "),K.length=0),!X&&!A&&!V&&E?C++:x.textContent=O,ee!==this.defaultSpacing&&(x.style.letterSpacing=`${ee}px`),_.push(x),N=L}return x&&C&&(x.textContent=O),_}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||YB(i.getCode()))return!1;let c=this._getContrastCache(i),d;if(!r&&!o&&(d=c.getColor(t.rgba,n.rgba)),d===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=an.ensureContrastRatio(r||t,o||n,p),c.setColor((r||t).rgba,(o||n).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};Ey=Tn([De(1,nA),De(2,Pi),De(3,Zr),De(4,Ho),De(5,xh),De(6,cc)],Ey);function dk(e,t,n){for(;e.length<n;)e=t+e;return e}var ZB=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,i,r,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},JB=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,c=n[1]-r,d=Math.max(o,0),p=Math.min(c,e.rows-1);if(d>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function QB(){return new JB}var P_="xterm-dom-renderer-owner-",As="xterm-rows",Xd="xterm-fg-",fk="xterm-bg-",du="xterm-focus",Zd="xterm-selection",eP=1,Ty=class extends _t{constructor(e,t,n,i,r,o,c,d,p,f,g,_,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=f,this._bufferService=g,this._coreService=_,this._coreBrowserService=b,this._themeService=S,this._terminalClass=eP++,this._rowElements=[],this._selectionRenderModel=QB(),this.onRequestRedraw=this._register(new ke).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(As),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(Zd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=XB(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Ey,document),this._element.classList.add(P_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(mn(()=>{this._element.classList.remove(P_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ZB(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${As} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${As} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${As} .xterm-dim { color: ${an.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${As}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${As}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${As}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Zd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Zd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Zd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Xd}${o} { color: ${c.css}; }${this._terminalSelector} .${Xd}${o}.xterm-dim { color: ${an.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${fk}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Xd}257 { color: ${an.opaque(e.background).css}; }${this._terminalSelector} .${Xd}257.xterm-dim { color: ${an.multiplyOpacity(an.opaque(e.background),.5).css}; }${this._terminalSelector} .${fk}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(du),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(du),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];d.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=i===o?e[0]:0,f=o===r?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,p,f));let g=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let _=r===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${c}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let f=p+n.ydisp,g=this._rowElements[p],_=n.lines.get(f);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,f,f===i,c,d,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${P_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,i,r,o){n<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),i=Math.max(Math.min(i,c),0),r=Math.min(r,this._bufferService.cols);let d=this._bufferService.buffer,p=d.ybase+d.y,f=Math.min(d.x,r-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+d.ydisp,x=this._rowElements[S],C=d.lines.get(w);if(!x||!C)break;x.replaceChildren(...this._rowFactory.createRow(C,w,w===p,_,b,f,g,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};Ty=Tn([De(7,r0),De(8,Pp),De(9,Pi),De(10,Bi),De(11,Ho),De(12,Zr),De(13,cc)],Ty);var Ay=class extends _t{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ke),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new nP(this._optionsService))}catch{this._measureStrategy=this._register(new tP(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Ay=Tn([De(2,Pi)],Ay);var SA=class extends _t{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},tP=class extends SA{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},nP=class extends SA{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},iP=class extends _t{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new sP(this._window)),this._onDprChange=this._register(new ke),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ke),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(gi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(nt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(nt(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},sP=class extends _t{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Jl),this._onDprChange=this._register(new ke),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(mn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=nt(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)}},rP=class extends _t{constructor(){super(),this.linkProviders=[],this._register(mn(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function f0(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),c=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-c]}function aP(e,t,n,i,r,o,c,d,p){if(!o)return;let f=f0(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(p?c/2:0))/c),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),i+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),r),f}var Ry=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return aP(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=f0(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ry=Tn([De(0,Jr),De(1,Pp)],Ry);var oP=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},wA={};_7(wA,{getSafariVersion:()=>cP,isChromeOS:()=>EA,isFirefox:()=>xA,isIpad:()=>uP,isIphone:()=>hP,isLegacyEdge:()=>lP,isLinux:()=>p0,isMac:()=>sp,isNode:()=>$p,isSafari:()=>CA,isWindows:()=>kA});var $p=typeof process<"u"&&"title"in process,Ch=$p?"node":navigator.userAgent,kh=$p?"node":navigator.platform,xA=Ch.includes("Firefox"),lP=Ch.includes("Edge"),CA=/^((?!chrome|android).)*safari/i.test(Ch);function cP(){if(!CA)return 0;let e=Ch.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var sp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(kh),uP=kh==="iPad",hP=kh==="iPhone",kA=["Windows","Win16","Win32","WinCE"].includes(kh),p0=kh.indexOf("Linux")>=0,EA=/\bCrOS\b/.test(Ch),TA=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},dP=class extends TA{_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())}}},fP=class extends TA{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rp=!$p&&"requestIdleCallback"in window?fP:dP,pP=class{constructor(){this._queue=new rp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ny=class extends _t{constructor(e,t,n,i,r,o,c,d,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new Jl),this._pausedResizeTask=new pP,this._observerDisposable=this._register(new Jl),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 ke),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ke),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ke),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ke),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new oP((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new mP(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(mn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=mn(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ny=Tn([De(2,Pi),De(3,Pp),De(4,Ho),De(5,xh),De(6,Bi),De(7,Zr),De(8,cc)],Ny);var mP=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function gP(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return yP(r,o,e,t,n,i)+zp(o,t,n,i)+bP(r,o,e,t,n,i);let c;if(o===t)return c=r>e?"D":"C",oh(Math.abs(r-e),ah(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),p=vP(o>t?e:r,n)+(d-1)*n.cols+1+_P(o>t?r:e);return oh(p,ah(c,i))}function _P(e,t){return e-1}function vP(e,t){return t.cols-e}function yP(e,t,n,i,r,o){return zp(t,i,r,o).length===0?"":oh(RA(e,t,e,t-Bo(t,r),!1,r).length,ah("D",o))}function zp(e,t,n,i){let r=e-Bo(e,n),o=t-Bo(t,n),c=Math.abs(r-o)-SP(e,t,n);return oh(c,ah(AA(e,t),i))}function bP(e,t,n,i,r,o){let c;zp(t,i,r,o).length>0?c=i-Bo(i,r):c=t;let d=i,p=wP(e,t,n,i,r,o);return oh(RA(e,c,n,d,p==="C",r).length,ah(p,o))}function SP(e,t,n){let i=0,r=e-Bo(e,n),o=t-Bo(t,n);for(let c=0;c<Math.abs(r-o);c++){let d=AA(e,t)==="A"?-1:1;n.buffer.lines.get(r+d*c)?.isWrapped&&i++}return i}function Bo(e,t){let n=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return n}function wP(e,t,n,i,r,o){let c;return zp(n,i,r,o).length>0?c=i-Bo(i,r):c=t,e<n&&c<=i||e>=n&&c<i?"C":"D"}function AA(e,t){return e>t?"A":"B"}function RA(e,t,n,i,r,o){let c=e,d=t,p="";for(;(c!==n||d!==i)&&d>=0&&d<o.buffer.lines.length;)c+=r?1:-1,r&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!r&&c<0&&(p+=o.buffer.translateBufferLineToString(d,!1,0,e+1),c=o.cols-1,e=c,d--);return p+o.buffer.translateBufferLineToString(d,!1,e,c)}function ah(e,t){let n=t?"O":"[";return _e.ESC+n+e}function oh(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var xP=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function pk(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var $_=50,CP=15,kP=50,EP=500,TP=" ",AP=new RegExp(TP,"g"),Ly=class extends _t{constructor(e,t,n,i,r,o,c,d,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ke),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ke),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ke),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ke),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new xP(this._bufferService),this._activeSelectionMode=0,this._register(mn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=n.translateBufferLineToString(c,!0,r,o);i.push(d)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),d=n.translateBufferLineToString(o,!0);c?.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(r=>r.replace(AP," ")).join(kA?`\r
|
|
91
|
-
`:`
|
|
92
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),p0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=pk(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=f0(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-$_),$_),t/=$_,t/Math.abs(t)+Math.round(t*(CP-1)))}shouldForceSelection(e){return sp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),kP)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(sp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let i=n.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<EP&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let i=gP(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==i&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let c=r.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),p=d,f=e[0]-d,g=0,_=0,b=0,S=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let C=e[0],O=e[0];o.getWidth(C)===0&&(g++,C--),o.getWidth(O)===2&&(_++,O++);let P=o.getString(O).length;for(P>1&&(S+=P-1,p+=P-1);C>0&&d>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):z>1&&(b+=z-1,d-=z-1),d--,C--}for(;O<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(O+1,this._workCell));){o.loadCell(O+1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,O++):z>1&&(S+=z-1,p+=z-1),p++,O++}}p++;let w=d+f-g+b,x=Math.min(this._bufferService.cols,p-d+g+_-b-S);if(!(!t&&c.slice(d,p).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=r.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let O=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(O){let P=this._bufferService.cols-O.start;w-=P,x+=P}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=r.lines.get(e[1]+1);if(C?.isWrapped&&C.getCodePoint(0)!==32){let O=this._getWordAt([0,e[1]+1],!1,!1,!0);O&&(x+=O.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=pk(n,this._bufferService.cols)}};Ly=Tn([De(3,Bi),De(4,Ho),De(5,a0),De(6,Pi),De(7,Jr),De(8,Zr)],Ly);var mk=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},gk=class{constructor(){this._color=new mk,this._css=new mk}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Kn=Object.freeze((()=>{let e=[vn.toColor("#2e3436"),vn.toColor("#cc0000"),vn.toColor("#4e9a06"),vn.toColor("#c4a000"),vn.toColor("#3465a4"),vn.toColor("#75507b"),vn.toColor("#06989a"),vn.toColor("#d3d7cf"),vn.toColor("#555753"),vn.toColor("#ef2929"),vn.toColor("#8ae234"),vn.toColor("#fce94f"),vn.toColor("#729fcf"),vn.toColor("#ad7fa8"),vn.toColor("#34e2e2"),vn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],r=t[n/6%6|0],o=t[n%6];e.push({css:Hn.toCss(i,r,o),rgba:Hn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:Hn.toCss(i,i,i),rgba:Hn.toRgba(i,i,i)})}return e})()),wo=vn.toColor("#ffffff"),ju=vn.toColor("#000000"),_k=vn.toColor("#ffffff"),vk=ju,fu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},RP=wo,My=class extends _t{constructor(e){super(),this._optionsService=e,this._contrastCache=new gk,this._halfContrastCache=new gk,this._onChangeColors=this._register(new ke),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:wo,background:ju,cursor:_k,cursorAccent:vk,selectionForeground:void 0,selectionBackgroundTransparent:fu,selectionBackgroundOpaque:an.blend(ju,fu),selectionInactiveBackgroundTransparent:fu,selectionInactiveBackgroundOpaque:an.blend(ju,fu),scrollbarSliderBackground:an.opacity(wo,.2),scrollbarSliderHoverBackground:an.opacity(wo,.4),scrollbarSliderActiveBackground:an.opacity(wo,.5),overviewRulerBorder:wo,ansi:Kn.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Xt(e.foreground,wo),t.background=Xt(e.background,ju),t.cursor=an.blend(t.background,Xt(e.cursor,_k)),t.cursorAccent=an.blend(t.background,Xt(e.cursorAccent,vk)),t.selectionBackgroundTransparent=Xt(e.selectionBackground,fu),t.selectionBackgroundOpaque=an.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Xt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=an.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Xt(e.selectionForeground,hk):void 0,t.selectionForeground===hk&&(t.selectionForeground=void 0),an.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=an.opacity(t.selectionBackgroundTransparent,.3)),an.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=an.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Xt(e.scrollbarSliderBackground,an.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Xt(e.scrollbarSliderHoverBackground,an.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Xt(e.scrollbarSliderActiveBackground,an.opacity(t.foreground,.5)),t.overviewRulerBorder=Xt(e.overviewRulerBorder,RP),t.ansi=Kn.slice(),t.ansi[0]=Xt(e.black,Kn[0]),t.ansi[1]=Xt(e.red,Kn[1]),t.ansi[2]=Xt(e.green,Kn[2]),t.ansi[3]=Xt(e.yellow,Kn[3]),t.ansi[4]=Xt(e.blue,Kn[4]),t.ansi[5]=Xt(e.magenta,Kn[5]),t.ansi[6]=Xt(e.cyan,Kn[6]),t.ansi[7]=Xt(e.white,Kn[7]),t.ansi[8]=Xt(e.brightBlack,Kn[8]),t.ansi[9]=Xt(e.brightRed,Kn[9]),t.ansi[10]=Xt(e.brightGreen,Kn[10]),t.ansi[11]=Xt(e.brightYellow,Kn[11]),t.ansi[12]=Xt(e.brightBlue,Kn[12]),t.ansi[13]=Xt(e.brightMagenta,Kn[13]),t.ansi[14]=Xt(e.brightCyan,Kn[14]),t.ansi[15]=Xt(e.brightWhite,Kn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=Xt(e.extendedAnsi[i],Kn[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};My=Tn([De(0,Pi)],My);function Xt(e,t){if(e!==void 0)try{return vn.toColor(e)}catch{}return t}var NP=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},LP=class{constructor(){this._services=new NP,this._services.set(r0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=C7(e).sort((o,c)=>o.index-c.index),i=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(c)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},MP={trace:0,debug:1,info:2,warn:3,error:4,off:5},OP="xterm.js: ",Oy=class extends _t{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=MP[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":OP)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Oy=Tn([De(0,Pi)],Oy);var yk=class extends _t{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ke),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ke),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ke),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},mt=3,$n=Object.freeze(new wh),Jd=0,z_=2,Iu=class NA{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*mt);let r=n||Is.fromCharData([0,YT,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*mt+0],i=n&2097151;return[this._data[t*mt+1],n&2097152?this._combined[t]:i?Da(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*mt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*mt+0]=t|2097152|n[2]<<22):this._data[t*mt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*mt+0]>>22}hasWidth(t){return this._data[t*mt+0]&12582912}getFg(t){return this._data[t*mt+1]}getBg(t){return this._data[t*mt+2]}hasContent(t){return this._data[t*mt+0]&4194303}getCodePoint(t){let n=this._data[t*mt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*mt+0]&2097152}getString(t){let n=this._data[t*mt+0];return n&2097152?this._combined[t]:n&2097151?Da(n&2097151):""}isProtected(t){return this._data[t*mt+2]&536870912}loadCell(t,n){return Jd=t*mt,n.content=this._data[Jd+0],n.fg=this._data[Jd+1],n.bg=this._data[Jd+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*mt+0]=n.content,this._data[t*mt+1]=n.fg,this._data[t*mt+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*mt+0]=n|i<<22,this._data[t*mt+1]=r.fg,this._data[t*mt+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*mt+0];r&2097152?this._combined[t]+=Da(n):r&2097151?(this._combined[t]=Da(r&2097151)+Da(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*mt+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new Is;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new Is;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*z_<this._data.buffer.byteLength;let i=t*mt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let c=0;c<r.length;c++){let d=parseInt(r[c],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let d=parseInt(o[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*z_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*z_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new NA(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*mt+0]&4194303)return t+(this._data[t*mt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*mt+0]&4194303||this._data[t*mt+2]&50331648)return t+(this._data[t*mt+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let c=t._data;if(o)for(let p=r-1;p>=0;p--){for(let f=0;f<mt;f++)this._data[(i+p)*mt+f]=c[(n+p)*mt+f];c[(n+p)*mt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}else for(let p=0;p<r;p++){for(let f=0;f<mt;f++)this._data[(i+p)*mt+f]=c[(n+p)*mt+f];c[(n+p)*mt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}let d=Object.keys(t._combined);for(let p=0;p<d.length;p++){let f=parseInt(d[p],10);f>=n&&(this._combined[f-n+i]=t._combined[f])}}translateToString(t,n,i,r){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;n<i;){let c=this._data[n*mt+0],d=c&2097151,p=c&2097152?this._combined[n]:d?Da(d):Ba;if(o+=p,r)for(let f=0;f<p.length;++f)r.push(n);n+=c>>22||1}return r&&r.push(n),o}};function DP(e,t,n,i,r,o){let c=[];for(let d=0;d<e.length-1;d++){let p=d,f=e.get(++p);if(!f.isWrapped)continue;let g=[e.get(d)];for(;p<e.length&&f.isWrapped;)g.push(f),f=e.get(++p);if(!o&&i>=d&&i<p){d+=g.length-1;continue}let _=0,b=lh(g,_,t),S=1,w=0;for(;S<g.length;){let C=lh(g,S,t),O=C-w,P=n-b,z=Math.min(O,P);g[_].copyCellsFrom(g[S],w,b,z,!1),b+=z,b===n&&(_++,b=0),w+=z,w===C&&(S++,w=0),b===0&&_!==0&&g[_-1].getWidth(n-1)===2&&(g[_].copyCellsFrom(g[_-1],n-1,b++,1,!1),g[_-1].setCell(n-1,r))}g[_].replaceCells(b,n,r);let x=0;for(let C=g.length-1;C>0&&(C>_||g[C].getTrimmedLength()===0);C--)x++;x>0&&(c.push(d+g.length-x),c.push(x)),d+=g.length-1}return c}function jP(e,t){let n=[],i=0,r=t[i],o=0;for(let c=0;c<e.length;c++)if(r===c){let d=t[++i];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,r=t[++i]}else n.push(c);return{layout:n,countRemoved:o}}function IP(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function BP(e,t,n){let i=[],r=e.map((p,f)=>lh(e,f,t)).reduce((p,f)=>p+f),o=0,c=0,d=0;for(;d<r;){if(r-d<n){i.push(r-d);break}o+=n;let p=lh(e,c,t);o>p&&(o-=p,c++);let f=e[c].getWidth(o-1)===2;f&&o--;let g=f?n-1:n;i.push(g),d+=g}return i}function lh(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?n-1:n}var LA=class MA{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=MA._nextId++,this._onDispose=this.register(new ke),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Io(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};LA._nextId=1;var PP=LA,Yn={},xo=Yn.B;Yn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Yn.A={"#":"£"};Yn.B=void 0;Yn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Yn.C=Yn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Yn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Yn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Yn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Yn.E=Yn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Yn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Yn.H=Yn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var bk=4294967295,Sk=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=$n.clone(),this.savedCharset=xo,this.markers=[],this._nullCell=Is.fromCharData([0,YT,1,0]),this._whitespaceCell=Is.fromCharData([0,Ba,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new rp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new yk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new tp),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new tp),this._whitespaceCell}getBlankLine(e,t){return new Iu(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>bk?bk:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=$n);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new yk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell($n),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Iu(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Iu(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let c=this.lines.length-r;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=DP(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell($n),n);if(i.length>0){let r=jP(this.lines,i);IP(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell($n),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Iu(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell($n),r=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let p=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),p.unshift(d);if(!n){let z=this.ybase+this.y;if(z>=c&&z<c+p.length)continue}let f=p[p.length-1].getTrimmedLength(),g=BP(p,this._cols,e),_=g.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let S=[];for(let z=0;z<_;z++){let T=this.getBlankLine($n,!0);S.push(T)}S.length>0&&(r.push({start:c+p.length+o,newLines:S}),o+=S.length),p.push(...S);let w=g.length-1,x=g[w];x===0&&(w--,x=g[w]);let C=p.length-_-1,O=f;for(;C>=0;){let z=Math.min(O,x);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[C],O-z,x-z,z,!0),x-=z,x===0&&(w--,x=g[w]),O-=z,O===0){C--;let T=Math.max(C,0);O=lh(p,T,this._cols)}}for(let z=0;z<p.length;z++)g[z]<e&&p[z].setCell(g[z],i);let P=_-b;for(;P-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(r.length>0){let c=[],d=[];for(let x=0;x<this.lines.length;x++)d.push(this.lines.get(x));let p=this.lines.length,f=p-1,g=0,_=r[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let x=Math.min(this.lines.maxLength-1,p+o-1);x>=0;x--)if(_&&_.start>f+b){for(let C=_.newLines.length-1;C>=0;C--)this.lines.set(x--,_.newLines[C]);x++,c.push({index:f+1,amount:_.newLines.length}),b+=_.newLines.length,_=r[++g]}else this.lines.set(x,d[f--]);let S=0;for(let x=c.length-1;x>=0;x--)c[x].index+=S,this.lines.onInsertEmitter.fire(c[x]),S+=c[x].amount;let w=Math.max(0,p+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,i){let r=this.lines.get(e);return r?r.translateToString(t,n,i):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new PP(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},$P=class extends _t{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ke),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 Sk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Sk(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},OA=2,DA=1,Dy=class extends _t{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ke),this.onResize=this._onResize.event,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,OA),this.rows=Math.max(e.rawOptions.rows||0,DA),this.buffers=this._register(new $P(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-r+1;n.lines.shiftElements(r+1,c-1,-1),n.lines.set(o,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Dy=Tn([De(0,Pi)],Dy);var kl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:sp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},zP=["normal","bold","100","200","300","400","500","600","700","800","900"],HP=class extends _t{constructor(e){super(),this._onOptionChange=this._register(new ke),this.onOptionChange=this._onOptionChange.event;let t={...kl};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(mn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in kl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in kl))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=kl[e]),!FP(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=kl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=zP.includes(t)?t:kl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function FP(e){return e==="block"||e==="underline"||e==="bar"}function Bu(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&Bu(e[i],t-1);return n}var wk=Object.freeze({insertMode:!1}),xk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jy=class extends _t{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ke),this.onData=this._onData.event,this._onUserInput=this._register(new ke),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ke),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ke),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Bu(wk),this.decPrivateModes=Bu(xk)}reset(){this.modes=Bu(wk),this.decPrivateModes=Bu(xk)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};jy=Tn([De(0,Bi),De(1,eA),De(2,Pi)],jy);var Ck={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function H_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var F_=String.fromCharCode,kk={DEFAULT:e=>{let t=[H_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${F_(t[0])}${F_(t[1])}${F_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${H_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${H_(e,!0)};${e.x};${e.y}${t}`}},Iy=class extends _t{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ke),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(Ck))this.addProtocol(i,Ck[i]);for(let i of Object.keys(kk))this.addEncoding(i,kk[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let i=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Iy=Tn([De(0,Bi),De(1,Ho),De(2,Pi)],Iy);var U_=[[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]],UP=[[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]],Vn;function WP(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var qP=class{constructor(){if(this.version="6",!Vn){Vn=new Uint8Array(65536),Vn.fill(1),Vn[0]=0,Vn.fill(0,1,32),Vn.fill(0,127,160),Vn.fill(2,4352,4448),Vn[9001]=2,Vn[9002]=2,Vn.fill(2,11904,42192),Vn[12351]=1,Vn.fill(2,44032,55204),Vn.fill(2,63744,64256),Vn.fill(2,65040,65050),Vn.fill(2,65072,65136),Vn.fill(2,65280,65377),Vn.fill(2,65504,65511);for(let e=0;e<U_.length;++e)Vn.fill(0,U_[e][0],U_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Vn[e]:WP(e,UP)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let r=ko.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return ko.createPropertyValue(0,n,i)}},ko=class Mf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ke,this.onChange=this._onChange.event;let t=new qP;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let d=this.charProperties(c,i),p=Mf.extractWidth(d);Mf.extractShouldJoin(d)&&(p-=Mf.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},GP=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Ek(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var pu=2147483647,KP=256,jA=class By{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>KP)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new By;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)n.addSubParam(r[o]);else n.addParam(r)}return n}clone(){let t=new By(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>pu?pu:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>pu?pu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&(t[n]=this._subParams.slice(i,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[n-1];i[n-1]=~r?Math.min(r*10+t,pu):t}},mu=[],VP=class{constructor(){this._state=0,this._active=mu,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=mu}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=mu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mu,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Bp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=mu,this._id=-1,this._state=0}}},us=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=Bp(t,n,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,n}},gu=[],YP=class{constructor(){this._handlers=Object.create(null),this._active=gu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=gu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=gu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||gu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Bp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=gu,this._ident=0}},Pu=new jA;Pu.addParam(0);var Tk=class{constructor(e){this._handler=e,this._data="",this._params=Pu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Pu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Bp(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Pu,this._data="",this._hitLimit=!1,n));return this._params=Pu,this._data="",this._hitLimit=!1,t}},XP=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},Ds=160,ZP=(function(){let e=new XP(4095),t=Array.apply(null,Array(256)).map((d,p)=>p),n=(d,p)=>t.slice(d,p),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ds,0,2,0),e.add(Ds,8,5,8),e.add(Ds,6,0,6),e.add(Ds,11,0,11),e.add(Ds,13,13,13),e})(),JP=class extends _t{constructor(e=ZP){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new jA,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(mn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new VP),this._dcsParser=this._register(new YP),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let i=this._escHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,n){let i=0,r=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=d[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=d[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],r=this._transitions.table[this.currentState<<8|(i<160?i:Ds)],r>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(c=p[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,p,f,r,d),c;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,r,d),c;_<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Ds){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=d+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Ds){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},QP=/^([\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})$/,e$=/^[\da-f]+$/;function Ak(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=QP.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),e$.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(n*r,n*r+n),16);i[r]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function W_(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function t$(e,t=16){let[n,i,r]=e;return`rgb:${W_(n,t)}/${W_(i,t)}/${W_(r,t)}`}var n$={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Aa=131072,Rk=10;function Nk(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Lk=5e3,Mk=0,i$=class extends _t{constructor(e,t,n,i,r,o,c,d,p=new JP){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w7,this._utf8Decoder=new x7,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=$n.clone(),this._eraseAttrDataInternal=$n.clone(),this._onRequestBell=this._register(new ke),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ke),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ke),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ke),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ke),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ke),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ke),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ke),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ke),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ke),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ke),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ke),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 Py(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:g.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:g,data:_})}),this._parser.setDcsHandlerFallback((f,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:g,payload:_})}),this._parser.setPrintHandler((f,g,_)=>this.print(f,g,_)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(_e.BEL,()=>this.bell()),this._parser.setExecuteHandler(_e.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(_e.BS,()=>this.backspace()),this._parser.setExecuteHandler(_e.HT,()=>this.tab()),this._parser.setExecuteHandler(_e.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(_e.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Nf.IND,()=>this.index()),this._parser.setExecuteHandler(Nf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Nf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new us(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new us(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new us(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new us(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new us(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new us(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new us(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new us(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new us(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new us(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new us(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new us(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in Yn)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Tk((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),Lk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Lk} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Aa&&(o=this._parseStack.position+Aa)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Aa&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Aa))),c||this._dirtyRowTracker.clearRange(),e.length>Aa)for(let f=o;f<e.length;f+=Aa){let g=f+Aa<e.length?f+Aa:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(f,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,r,_,f),this._logSlowResolvingAsync(n),n}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,r,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let O=o[String.fromCharCode(i)];O&&(i=O.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=ko.extractWidth(w);let x=ko.extractShouldJoin(w),C=x?ko.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(Da(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-C>d){if(p){let O=_,P=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&_ instanceof Iu&&_.copyCellsFrom(O,P,0,C,!1);P<d;)O.setCellFromCodepoint(P++,0,1,g)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let O=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-O,i,r);for(let P=r-C;--P>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(_.insertCells(this._activeBuffer.x,r-C,this._activeBuffer.getNullCell(g)),_.getWidth(d-1)===2&&_.setCellFromCodepoint(d-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,i,r,g),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Nk(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Tk(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new us(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine($n));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,i=ko.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),c=new Uint32Array(o.length*n),d=0;for(let f=0;f<o.length;){let g=o.codePointAt(f)||0;c[d++]=g,f+=g>65535?2:1}let p=d;for(let f=1;f<n;++f)c.copyWithin(p,0,d),p+=d;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(_e.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(_e.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(_e.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(_e.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(_e.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,xo),this._charsetService.setgCharset(1,xo),this._charsetService.setgCharset(2,xo),this._charsetService.setgCharset(3,xo);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:p}=this._bufferService,{active:f,alt:g}=d,_=this._optionsService.rawOptions,b=(x,C)=>(c.triggerDataEvent(`${_e.ESC}[${t?"":"?"}${x};${C}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(c.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(_.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(_.cursorBlink)):w===25?b(w,S(!c.isCursorHidden)):w===45?b(w,S(i.reverseWraparound)):w===66?b(w,S(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,S(r==="VT200")):w===1002?b(w,S(r==="DRAG")):w===1003?b(w,S(r==="ANY")):w===1004?b(w,S(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,S(o==="SGR")):w===1015?b(w,4):w===1016?b(w,S(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,S(f===g)):w===2004?b(w,S(i.bracketedPasteMode)):w===2026?b(w,S(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,n,i,r){return t===2?(e|=50331648,e&=-16777216,e|=wh.fromColorRGB([n,i,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do i[1]===5&&(r=1),i[o+d+1+r]=c[d];while(++d<c.length&&d+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=$n.fg,e.bg=$n.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,i=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=$n.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=$n.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=$n.fg&16777215,i.bg&=-67108864,i.bg|=$n.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${_e.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=$n.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Nk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${_e.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Rk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Rk&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let i=n.shift(),r=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(Ok(o))if(r==="?")t.push({type:0,index:o});else{let c=Ak(r);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,r=n.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Ak(n[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let r=parseInt(n[i]);Ok(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,xo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(n$[e[0]],Yn[e[1]]||xo),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=$n.clone(),this._eraseAttrDataInternal=$n.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Is;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${_e.ESC}${c}${_e.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Py=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Mk=e,e=t,t=Mk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Py=Tn([De(0,Bi)],Py);function Ok(e){return 0<=e&&e<256}var s$=5e7,Dk=12,r$=50,a$=class extends _t{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ke),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>s$)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let c=d=>performance.now()-n>=Dk?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(n,d);r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=Dk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>r$&&(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()}},$y=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(p,d)),this._dataByLinkId.set(p.id,p),p.id}let n=e,i=this._getEntryIdKey(n),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};$y=Tn([De(0,Bi)],$y);var jk=!1,o$=class extends _t{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Jl),this._onBinary=this._register(new ke),this.onBinary=this._onBinary.event,this._onData=this._register(new ke),this.onData=this._onData.event,this._onLineFeed=this._register(new ke),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ke),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ke),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ke),this._instantiationService=new LP,this.optionsService=this._register(new HP(e)),this._instantiationService.setService(Pi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Dy)),this._instantiationService.setService(Bi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Oy)),this._instantiationService.setService(eA,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jy)),this._instantiationService.setService(Ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Iy)),this._instantiationService.setService(QT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ko)),this._instantiationService.setService(T7,this.unicodeService),this._charsetService=this._instantiationService.createInstance(GP),this._instantiationService.setService(E7,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($y),this._instantiationService.setService(tA,this._oscLinkService),this._inputHandler=this._register(new i$(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(gi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(gi.forward(this._bufferService.onResize,this._onResize)),this._register(gi.forward(this.coreService.onData,this._onData)),this._register(gi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new a$((t,n)=>this._inputHandler.parse(t,n))),this._register(gi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ke),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!jk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),jk=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,OA),t=Math.max(t,DA),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Ek.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Ek(this._bufferService),!1))),this._windowsWrappingHeuristics.value=mn(()=>{for(let t of e)t.dispose()})}}},l$={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function c$(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=_e.ESC+"OA":r.key=_e.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=_e.ESC+"OD":r.key=_e.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=_e.ESC+"OC":r.key=_e.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=_e.ESC+"OB":r.key=_e.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":_e.DEL,e.altKey&&(r.key=_e.ESC+r.key);break;case 9:if(e.shiftKey){r.key=_e.ESC+"[Z";break}r.key=_e.HT,r.cancel=!0;break;case 13:r.key=e.altKey?_e.ESC+_e.CR:_e.CR,r.cancel=!0;break;case 27:r.key=_e.ESC,e.altKey&&(r.key=_e.ESC+_e.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=_e.ESC+"[1;"+(o+1)+"D":t?r.key=_e.ESC+"OD":r.key=_e.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=_e.ESC+"[1;"+(o+1)+"C":t?r.key=_e.ESC+"OC":r.key=_e.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=_e.ESC+"[1;"+(o+1)+"A":t?r.key=_e.ESC+"OA":r.key=_e.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=_e.ESC+"[1;"+(o+1)+"B":t?r.key=_e.ESC+"OB":r.key=_e.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=_e.ESC+"[2~");break;case 46:o?r.key=_e.ESC+"[3;"+(o+1)+"~":r.key=_e.ESC+"[3~";break;case 36:o?r.key=_e.ESC+"[1;"+(o+1)+"H":t?r.key=_e.ESC+"OH":r.key=_e.ESC+"[H";break;case 35:o?r.key=_e.ESC+"[1;"+(o+1)+"F":t?r.key=_e.ESC+"OF":r.key=_e.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=_e.ESC+"[5;"+(o+1)+"~":r.key=_e.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=_e.ESC+"[6;"+(o+1)+"~":r.key=_e.ESC+"[6~";break;case 112:o?r.key=_e.ESC+"[1;"+(o+1)+"P":r.key=_e.ESC+"OP";break;case 113:o?r.key=_e.ESC+"[1;"+(o+1)+"Q":r.key=_e.ESC+"OQ";break;case 114:o?r.key=_e.ESC+"[1;"+(o+1)+"R":r.key=_e.ESC+"OR";break;case 115:o?r.key=_e.ESC+"[1;"+(o+1)+"S":r.key=_e.ESC+"OS";break;case 116:o?r.key=_e.ESC+"[15;"+(o+1)+"~":r.key=_e.ESC+"[15~";break;case 117:o?r.key=_e.ESC+"[17;"+(o+1)+"~":r.key=_e.ESC+"[17~";break;case 118:o?r.key=_e.ESC+"[18;"+(o+1)+"~":r.key=_e.ESC+"[18~";break;case 119:o?r.key=_e.ESC+"[19;"+(o+1)+"~":r.key=_e.ESC+"[19~";break;case 120:o?r.key=_e.ESC+"[20;"+(o+1)+"~":r.key=_e.ESC+"[20~";break;case 121:o?r.key=_e.ESC+"[21;"+(o+1)+"~":r.key=_e.ESC+"[21~";break;case 122:o?r.key=_e.ESC+"[23;"+(o+1)+"~":r.key=_e.ESC+"[23~";break;case 123:o?r.key=_e.ESC+"[24;"+(o+1)+"~":r.key=_e.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=_e.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=_e.DEL:e.keyCode===219?r.key=_e.ESC:e.keyCode===220?r.key=_e.FS:e.keyCode===221&&(r.key=_e.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let c=l$[e.keyCode]?.[e.shiftKey?1:0];if(c)r.key=_e.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(d);e.shiftKey&&(p=p.toUpperCase()),r.key=_e.ESC+p}else if(e.keyCode===32)r.key=_e.ESC+(e.ctrlKey?_e.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),r.key=_e.ESC+d,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=_e.US),e.key==="@"&&(r.key=_e.NUL));break}return r}var Mn=0,u$=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new rp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new rp,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,o)=>this._getKey(r)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[r]=e[t],t++):i[r]=this._array[n++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Mn=this._search(t),Mn===-1)||this._getKey(this._array[Mn])!==t)return!1;do if(this._array[Mn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Mn),!0;while(++Mn<this._array.length&&this._getKey(this._array[Mn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[i++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Mn=this._search(e),!(Mn<0||Mn>=this._array.length)&&this._getKey(this._array[Mn])===e))do yield this._array[Mn];while(++Mn<this._array.length&&this._getKey(this._array[Mn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Mn=this._search(e),!(Mn<0||Mn>=this._array.length)&&this._getKey(this._array[Mn])===e))do t(this._array[Mn]);while(++Mn<this._array.length&&this._getKey(this._array[Mn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,r=this._getKey(this._array[i]);if(r>e)n=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},q_=0,Ik=0,h$=class extends _t{constructor(){super(),this._decorations=new u$(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ke),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ke),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(mn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new d$(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,r=>{q_=r.options.x??0,Ik=q_+(r.options.width??1),e>=q_&&e<Ik&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},d$=class extends za{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ke),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ke),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=vn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=vn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},f$=1e3,p$=class{constructor(e,t=f$){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Bk=20,ap=class extends _t{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new p$(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
93
|
-
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(nt(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(mn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Bk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Bk+1&&(this._liveRegion.textContent+=ry.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,i=n.lines.length.toString();for(let r=e;r<=t;r++){let o=n.lines.get(n.ydisp+r),c=[],d=o?.translateToString(!0,void 0,void 0,c)||"",p=(n.ydisp+r+1).toString(),f=this._rowElements[r];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let c,d;if(t===0?(c=n,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let r=({node:d,offset:p})=>{let f=d instanceof Text?d.parentNode:d,g=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(f);if(!_)return console.warn("columns is null. Race condition?"),null;let b=p<_.length?_[p]:_.slice(-1)[0]+1;return b>=this._terminal.cols&&(++g,b=0),{row:g,column:b}},o=r(t),c=r(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};ap=Tn([De(1,r0),De(2,Zr),De(3,Jr)],ap);var zy=class extends _t{constructor(e,t,n,i,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ke),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ke),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(mn(()=>{Io(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(nt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(nt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(nt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(nt(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let i=0;i<n.length;i++){let r=n[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let c=o?.map(d=>({link:d}));this._activeProviderReplies?.set(i,c),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let c=r[o],d=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=d;f<=p;f++){if(n.has(f)){r.splice(o--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(c=>this._linkAtPosition(c.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let c=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&m$(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Io(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,r){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:r}}};zy=Tn([De(1,a0),De(2,Jr),De(3,Bi),De(4,iA)],zy);function m$(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var g$=class extends o${constructor(e={}){super(e),this._linkifier=this._register(new Jl),this.browser=wA,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Jl),this._onCursorMove=this._register(new ke),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ke),this.onKey=this._onKey.event,this._onRender=this._register(new ke),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ke),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ke),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ke),this.onBell=this._onBell.event,this._onFocus=this._register(new ke),this._onBlur=this._register(new ke),this._onA11yCharEmitter=this._register(new ke),this._onA11yTabEmitter=this._register(new ke),this._onWillOpen=this._register(new ke),this._setup(),this._decorationService=this._instantiationService.createInstance(h$),this._instantiationService.setService(xh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rP),this._instantiationService.setService(iA,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(oy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(gi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(gi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(gi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(gi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(mn(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let r=an.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${_e.ESC}]${i};${t$(r)}${bA.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Hn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Hn.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ap,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_e.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(_e.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(nt(this.element,"copy",t=>{this.hasSelection()&&b7(t,this._selectionService)}));let e=t=>S7(t,this.textarea,this.coreService,this.optionsService);this._register(nt(this.textarea,"paste",e)),this._register(nt(this.element,"paste",e)),xA?this._register(nt(this.element,"mousedown",t=>{t.button===2&&KC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(nt(this.element,"contextmenu",t=>{KC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),p0&&this._register(nt(this.element,"auxclick",t=>{t.button===1&&VT(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(nt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(nt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(nt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(nt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(nt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(nt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(nt(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(nt(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",sy.get()),EA||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(iP,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zr,this._coreBrowserService),this._register(nt(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(nt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ay,this._document,this._helperContainer),this._instantiationService.setService(Pp,this._charSizeService),this._themeService=this._instantiationService.createInstance(My),this._instantiationService.setService(cc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ip),this._instantiationService.setService(nA,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ny,this.rows,this.screenElement)),this._instantiationService.setService(Jr,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ky,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ry),this._instantiationService.setService(a0,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(zy,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(xy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ly,this.element,this.screenElement,i)),this._instantiationService.setService(R7,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(gi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Cy,this.screenElement)),this._register(nt(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ap,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(np,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(np,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ty,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let d,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,d=o.button<3?o.button:3;break;case"mousedown":p=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let f=o.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,d=4;break;default:return!1}return p===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(nt(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(nt(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let c=_e.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){KT(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=c$(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===_e.ETX||n.key===_e.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(_$(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine($n));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(_e.ESC+"[I"):this.coreService.triggerDataEvent(_e.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function _$(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var v$=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},y$=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Pk=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new y$(t)}getNullCell(){return new Is}},b$=class extends _t{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ke),this.onBufferChange=this._onBufferChange.event,this._normal=new Pk(this._core.buffers.normal,"normal"),this._alternate=new Pk(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)}},S$=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,i)=>t(n,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},w$=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},x$=["cols","rows"],sr=0,C$=class extends _t{constructor(e){super(),this._core=this._register(new g$(e)),this._addonManager=this._register(new v$),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(x$.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new S$(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w$(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 b$(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
95
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return sy.get()},set promptLabel(e){sy.set(e)},get tooMuchOutput(){return ry.get()},set tooMuchOutput(e){ry.set(e)}}}_verifyIntegers(...e){for(sr of e)if(sr===1/0||isNaN(sr)||sr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sr of e)if(sr&&(sr===1/0||isNaN(sr)||sr%1!==0||sr<0))throw new Error("This API only accepts positive integers")}};function k$(e){let t=!1,n=!1,i=!1,r=!1,o=null,c=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},p=()=>{c!==null&&(clearTimeout(c),c=null),n=!1},f=()=>{p(),n=!0,c=setTimeout(()=>{c=null,n=!1},0)},g=()=>{i=!1,o!==null&&clearTimeout(o),c!==null&&(clearTimeout(c),c=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},_=()=>{t=!1,o===null&&(p(),i=!1)},b=()=>{t=!1,r=!1,p(),d()},S=w=>{if(o===null){if(t||n||T$(w)){i=!0,n&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),i&&g()},onCompositionCancel:_,handleKeyEvent(w){return E$(w)&&w.shiftKey?(w.preventDefault?.(),w.type==="keydown"?(r=!0,S(w)):w.type==="keypress"?(r||S(w),r=!1):w.type==="keyup"&&(r=!1),!1):!0},dispose:b}}function E$(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function T$(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function A$({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,c=!1;const d=()=>{o=!1,c=!1},p=b=>{$k(b)&&(o=!0,c=!1)},f=()=>{o&&(c=!0)},g=b=>{const S=o&&c&&$k(b);if(d(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},_=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),n.addEventListener("mouseup",g),n.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),_.dispose(),t.removeEventListener("mousedown",p,!0),n.removeEventListener("mouseup",g),n.removeEventListener("blur",d))}}}function $k(e){return e.button===0}function R$(e,t){return{activate(n,i){try{const r=new URL(i);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const N$={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:R$((e,t,n)=>window.open(e,t,n),e=>window.confirm(`Do you want to navigate to ${e}?
|
|
96
|
-
|
|
97
|
-
WARNING: This link could potentially be dangerous`)),lineHeight:1},L$="Symbols Nerd Font Mono",Qd=`ui-monospace, "SF Mono", Menlo, "${L$}", monospace`,m0=14,IA=10,BA=22,M$={min:IA,max:BA},O$="cascadia",ch=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Qd}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Qd}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Qd}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Qd}`,meta:"Variable · Adobe mono"}],Gl=ch[0];function D$(e){return ch.find(t=>t.id===e)??Gl}function uh(){return{source:"curated",id:O$,customName:"",family:Gl.family,size:m0}}function g0(e,t){const n=D$(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:y0(t)}}function _0(e,t){const n=B$(e);return{source:"custom",id:null,customName:n,family:Gf(n,Gl.family),size:y0(t)}}function PA(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=y0(typeof t.size=="number"?t.size:m0);return t.source==="custom"&&typeof t.customName=="string"?_0(t.customName,n):typeof t.id=="string"&&I$(t.id)?g0(t.id,n):null}function v0(e){if(!e)return uh();try{const t=PA(JSON.parse(e));if(t!==null)return t}catch{}return uh()}function j$(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function y0(e){return Number.isFinite(e)?Math.min(BA,Math.max(IA,Math.round(e))):m0}function I$(e){return ch.some(t=>t.id===e)}function B$(e){return Np(e)}const op="fleet-plugin.terminal.renderer",Kl="fleet-plugin.terminal.font",zk="fleet-console.terminalRenderer",Hk="fleet-console.terminalFont",Hy=new Set;let Ha=X$(),hh=null,Mo=0;function P$(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(op)!==null||window.localStorage.getItem(Kl)!==null)return;const e=window.localStorage.getItem(zk),t=window.localStorage.getItem(Hk),n=e==="webgl"||e==="dom"?e:"webgl",i=v0(t);window.localStorage.setItem(op,n),window.localStorage.setItem(Kl,j$(i)),window.localStorage.removeItem(zk),window.localStorage.removeItem(Hk)}catch{}}function $$(e){Mo+=1,hh=e,W$()}function $A(){return y.useSyncExternalStore(Y$,Fk,Fk)}function z$(e){K$(e),Ql({renderer:e})}function H$(e){const t=g0(e,Ha.font.size);Mo+=1,Ql({font:t}),Hp(t)}function F$(e){const t=_0(e,Ha.font.size);Mo+=1,Ql({font:t}),Hp(t)}function U$(e){const t=Ha.font.source==="custom"?_0(Ha.font.customName,e):g0(Ha.font.id,e);Mo+=1,Ql({font:t}),Hp(t)}async function W$(){if(!hh)return;const e=Mo;try{const t=await hh.read("terminal");if(t!==null){const n=PA(t.font);if(n!==null){if(e!==Mo)return;Ql({font:n});try{window.localStorage.removeItem(Kl)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Kl)}catch{}if(n!==null){const i=v0(n);if(e!==Mo)return;Ql({font:i}),Hp(i);try{window.localStorage.removeItem(Kl)}catch{}}}}catch{}}async function Hp(e){if(hh)try{await hh.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function q$(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(op);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function G$(){if(typeof window>"u")return uh();try{return v0(window.localStorage.getItem(Kl))}catch{return uh()}}function K$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(op,e)}catch{}}function V$(){for(const e of Hy)e()}function Ql(e){Ha={...Ha,...e},V$()}function Y$(e){return Hy.add(e),()=>{Hy.delete(e)}}function Fk(){return Ha}function X$(){return typeof window>"u"?{renderer:"webgl",font:uh()}:(P$(),{renderer:q$(),font:G$()})}function Uk({baseY:e,viewportY:t}){return t>=e}function Z$(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:f,viewportY:g}=e.getViewport();n=Math.max(0,f-g)},o=()=>{if(n===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-n)))},c=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{i===null&&(i=e.requestFrame(()=>{i=null,c()}))},p=()=>{t&&(c(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=Uk(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,p()},preserveAfterGeometryChange:f=>{f(),c(),d()},restoreAfterOutputParsing:()=>{if(t){p();return}Uk(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function J$({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!Q$(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function Q$(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const e9="Symbols Nerd Font Mono",t9=`1em "${e9}"`,n9=650;let ef=null;function zA(){return ef||(ef=s9(),ef)}async function i9(){await r9(zA(),n9)}async function s9(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(t9)}catch{}}async function r9(e,t){await new Promise(n=>{let i=!1;const r=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(r),n())}})}const a9=80,o9=16,l9=250,c9=1024*1024,u9=120,h9={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)"},d9={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)"},f9={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 b0({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,zoom:c=1}){const d=i,{renderer:p,font:f}=$A(),g=y.useRef(null),_=y.useRef(null),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(null),C=y.useRef(null),[O,P]=y.useState(c),z=y.useRef(r);z.current=r;const T=y.useRef(o);T.current=o;const[j,M]=y.useState("connecting"),[H,F]=y.useState(0);y.useEffect(()=>{const K=g.current;if(!K)return;let B=!1,N=null,R=null,A=null;return(async()=>{if(await i9(),B)return;const L=Wk(d),$=new C$({...N$,fontFamily:f.family,fontSize:f.size*O,theme:L});_.current=$;const q=new oI;C.current=q,$.loadAddon(q),$.open(K),qk(K,L);const X=A$({terminal:$,selectionTarget:K,windowTarget:window,clipboard:navigator.clipboard});$.loadAddon(new DI),$.unicode.activeVersion="11";const D=k$(()=>$.input(`
|
|
98
|
-
`)),V=K.querySelector("textarea.xterm-helper-textarea, textarea")??K;V.addEventListener("compositionstart",D.onCompositionStart),V.addEventListener("compositionend",D.onCompositionEnd),V.addEventListener("focusout",D.onCompositionCancel);const J=J$({getPlatform:()=>navigator.platform,getSelection:()=>$.getSelection(),writeText:Ze=>navigator.clipboard.writeText(Ze)});$.attachCustomKeyEventHandler(Ze=>J.handleKeyEvent(Ze)&&D.handleKeyEvent(Ze));const ce=Z$({getViewport:()=>$.buffer.active,scrollToBottom:()=>p9($),scrollToLine:Ze=>m9($,Ze),requestFrame:Ze=>window.requestAnimationFrame(Ze),cancelFrame:Ze=>window.cancelAnimationFrame(Ze)});x.current=ce;const ie=g9(K,V,ce.recordUserViewportChange),ve=y9($,T.current!==!1,ce.restoreAfterOutputParsing);w.current=ve;const Se=eI({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:Ze=>$.onData(Re=>{ce.resumeFollowing(),Ze(Re)}),write:ve.write},onExit:()=>z.current?.(),onStatus:(Ze,Re)=>{M(Re?`${Ze}: ${Re}`:Ze)}});b.current=Se;const Oe=()=>{ce.preserveAfterGeometryChange(()=>{q.fit(),Se.resize($.cols,$.rows),$.refresh(0,$.rows-1)})},Ne=()=>{R&&clearTimeout(R),R=setTimeout(()=>{R=null,B||Oe()},a9)},ct=async()=>{await document.fonts?.ready,!B&&(Oe(),Se.start(),T.current!==!1&&$.focus())};N=new ResizeObserver(Ne),N.observe(K),ct(),A=()=>{R&&clearTimeout(R),V.removeEventListener("compositionstart",D.onCompositionStart),V.removeEventListener("compositionend",D.onCompositionEnd),V.removeEventListener("focusout",D.onCompositionCancel),D.dispose(),Se.dispose(),X.dispose(),ie.dispose(),ve.dispose(),ce.dispose(),_.current=null,b.current=null,w.current=null,x.current=null,C.current=null;try{$.dispose()}catch{}},F(Ze=>Ze+1)})(),()=>{B=!0,N?.disconnect(),A?.()}},[e,t,n]),y.useEffect(()=>{w.current?.setActive(o!==!1),o&&(_.current?.focus(),x.current?.resumeFollowing())},[o]),y.useEffect(()=>{const K=_.current;if(!K)return;let B=!1;if(p==="webgl")try{const N=new m7;S.current=N,N.onContextLoss(()=>{if(!B){try{N.dispose()}catch{}S.current===N&&(S.current=null)}}),K.loadAddon(N)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{B=!0;const N=S.current;if(N){S.current=null;try{N.dispose()}catch{}}}},[p,e,H]),y.useEffect(()=>{const K=_.current,B=g.current;if(!K||!B)return;const N=Wk(d);K.options.theme=N,qk(B,N)},[d,H]),y.useEffect(()=>{const K=_.current;K&&(K.options.fontFamily=f.family,Gk(K,C.current,b.current,x.current))},[f.family,H]),y.useEffect(()=>{if(c===O)return;const K=setTimeout(()=>P(c),u9);return()=>clearTimeout(K)},[c,O]),y.useEffect(()=>{const K=_.current;K&&(K.options.fontSize=f.size*O,Gk(K,C.current,b.current,x.current))},[O,f.size,H]);const ee=j.startsWith("live"),ae=O===1?void 0:{width:`${O*100}%`,height:`${O*100}%`,transform:`scale(${1/O})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[ee?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),j]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:g,style:ae})})]})})}function Wk(e){return e==="carbon"?f9:e==="maritime"?d9:h9}function qk(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function p9(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function m9(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function g9(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const c=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},d=()=>c(),p=()=>{r=!0},f=S=>{r=_9(S,i)},g=()=>{r&&c()},_=()=>{const S=r;r=!1,S&&c()},b=S=>{v9(S)&&c()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",p,{capture:!0,passive:!0}),i.addEventListener("touchend",_),i.addEventListener("touchcancel",_),i.addEventListener("pointerdown",f,!0),i.addEventListener("scroll",g),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",p,!0),i.removeEventListener("touchend",_),i.removeEventListener("touchcancel",_),i.removeEventListener("pointerdown",f,!0),i.removeEventListener("scroll",g),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function _9(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function v9(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function y9(e,t,n){let i=t,r=!1,o=null,c=0,d=[];const p=()=>{o&&(clearTimeout(o),o=null)},f=()=>{if(p(),r||c===0)return;const _=b9(d,c);d=[],c=0,e.write(_,()=>{r||n()})},g=()=>{r||o||c===0||(o=setTimeout(f,i?o9:l9))};return{write:_=>{if(!(r||_.byteLength===0)){if(d.push(_),c+=_.byteLength,c>=c9){f();return}g()}},setActive:_=>{if(i!==_){if(i=_,p(),i){f();return}g()}},dispose:()=>{f(),r=!0,d=[],c=0,p()}}}function b9(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.byteLength;return n}function Gk(e,t,n,i){const r=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(r);return}r()}const S9=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),HA=50*1024,w9="default-src 'none'; script-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'",x9="http://www.w3.org/1999/xhtml",C9=new Set(["abbr","address","article","aside","b","bdi","bdo","blockquote","br","caption","cite","code","col","colgroup","data","dd","details","div","dl","dt","em","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hr","i","img","kbd","li","main","mark","meter","ol","p","pre","progress","q","s","samp","section","small","span","strong","style","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","u","ul","var"]),k9=new Set(["class","dir","hidden","id","lang","role","style","title"]),E9=new Map([["col",new Set(["span"])],["colgroup",new Set(["span"])],["data",new Set(["value"])],["details",new Set(["open"])],["img",new Set(["alt","height","src","width"])],["li",new Set(["value"])],["meter",new Set(["high","low","max","min","optimum","value"])],["ol",new Set(["reversed","start","type"])],["progress",new Set(["max","value"])],["td",new Set(["colspan","headers","rowspan"])],["th",new Set(["abbr","colspan","headers","rowspan","scope"])],["time",new Set(["datetime"])]]),T9=/^data:image\/(?:png|jpeg|gif|webp|avif);base64,[a-z0-9+/]*={0,2}$/i;function A9(e){if(qA(e)>HA)return null;const t=document.createElement("template");t.innerHTML=e;const i=new DOMParser().parseFromString("<!doctype html><html><head></head><body></body></html>","text/html"),r=i.createElement("meta");return r.httpEquiv="Content-Security-Policy",r.content=w9,i.head.append(r),FA(t.content,i.body,i),`<!doctype html>${i.documentElement.outerHTML}`}function FA(e,t,n){for(const i of e.childNodes){if(i.nodeType===Node.TEXT_NODE){t.appendChild(n.createTextNode(i.textContent??""));continue}if(!(i instanceof Element)||i.namespaceURI!==x9)continue;const r=i.localName;if(!C9.has(r))continue;const o=n.createElement(r);R9(i,o,r),r==="style"?o.textContent=UA(i.textContent??""):FA(i,o,n),t.appendChild(o)}}function R9(e,t,n){const i=E9.get(n);for(const r of e.attributes){const o=r.name.toLowerCase();if(!(!k9.has(o)&&!i?.has(o)&&!/^aria-[a-z0-9-]+$/.test(o)&&!/^data-[a-z0-9-]+$/.test(o))){if(o==="src"){n==="img"&&T9.test(r.value)&&t.setAttribute(o,r.value);continue}if(o==="style")t.setAttribute(o,UA(r.value));else{if(o==="dir"&&!["ltr","rtl","auto"].includes(r.value.toLowerCase()))continue;t.setAttribute(o,r.value)}}}}function UA(e){return e.replace(/@import\b[\s\S]*?(?:;|$)/gi,"").replace(/url\s*\([^)]*\)/gi,"none")}function dh(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(dh):Object.entries(e).some(([t,n])=>S9.has(t.toLowerCase())||dh(n))}function N9(e){if(dh(e)||!Po(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(O9);return t.every(n=>n!==null)?{clis:t}:null}function L9(e){return dh(e)||!Po(e)||typeof e.type!="string"?null:e.type==="connected"?{type:"connected"}:(e.type==="chunk"||e.type==="thought")&&typeof e.text=="string"?{type:e.type,text:e.text}:e.type==="tool"&&typeof e.title=="string"&&typeof e.status=="string"?{type:"tool",title:e.title,status:e.status}:e.type==="complete"?{type:"complete"}:e.type==="error"&&WA(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&Po(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&qA(e.artifact.html)<=HA?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function M9(e){return!dh(e)&&Po(e)&&WA(e.error)?e.error:null}function O9(e){if(!Po(e)||typeof e.cliId!="string"||typeof e.label!="string"||typeof e.available!="boolean"||!Array.isArray(e.models))return null;const t=e.models.map(n=>Po(n)&&typeof n.id=="string"&&typeof n.label=="string"&&Array.isArray(n.effortLevels)&&n.effortLevels.every(i=>typeof i=="string")?{id:n.id,label:n.label,effortLevels:n.effortLevels,defaultEffort:typeof n.defaultEffort=="string"?n.defaultEffort:void 0}:null);return t.every(n=>n!==null)?{cliId:e.cliId,label:e.label,available:e.available,defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0,models:t}:null}function WA(e){return Po(e)&&typeof e.code=="string"&&typeof e.message=="string"}function Po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qA(e){return new TextEncoder().encode(e).byteLength}class Fy extends Error{constructor(t,n){super(n),this.code=t}code}const Eh=e=>`analysis/${encodeURIComponent(e)}`;async function D9(e){const t=await w0(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=N9(n);if(i)return i;throw x0(t.status,n)}async function j9(e,t){try{const n=await w0(e,`${Eh(t)}/ready`);if(!n.ok)return!1;const i=await n.json().catch(()=>null);return!!i&&typeof i=="object"&&!Array.isArray(i)&&i.ready===!0}catch{return!1}}async function I9(e,t,n){await S0(e,`${Eh(t)}/start`,n)}async function B9(e,t,n){await S0(e,`${Eh(t)}/message`,{text:n})}async function G_(e,t){await S0(e,`${Eh(t)}/stop`,{})}function P9(e,t,n){return e.subscribe("terminal",`${Eh(t)}/stream`,i=>{try{const r=L9(JSON.parse(i.data));r&&n(r)}catch{}})}async function S0(e,t,n){const i=await w0(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw x0(i.status,await i.json().catch(()=>null))}async function w0(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof ki?x0(i.status,i.body):i}}function x0(e,t){const n=M9(t);return new Fy(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const Uy={catalog:null,cliId:"",model:"",effort:"",started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],error:null};function $9(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...Kk(t.catalog)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),r=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:r?.id??"",effort:r?.defaultEffort??r?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(r=>r.cliId===e.cliId)?.models.find(r=>r.id===t.model);return{...e,model:t.model,effort:i?.defaultEffort??i?.effortLevels[0]??""}}if(t.type==="select-effort"&&!e.started)return{...e,effort:t.effort};if(t.type==="sending")return{...e,started:e.started||t.started,busy:!0,phase:"starting",latestActivity:{kind:"starting",connected:!t.started},runStartedAt:t.now,runEndedAt:null,error:null,tools:[],entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return _u(e,t.message,t.now);if(t.type==="session-lost")return{..._u(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{..._u(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,error:null};if(t.type==="stop-failed")return{..._u(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...Uy,catalog:i,...Kk(i)}:Uy}if(t.type==="clear-artifacts")return{...e,artifacts:[]};if(t.type!=="event")return e;const n=t.event;return n.type==="connected"?e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e:n.type==="chunk"?{...e,phase:"writing",latestActivity:{kind:"writing"},entries:z9(e.entries,n.text)}:n.type==="thought"?{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}}:n.type==="tool"?{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(i=>i.title!==n.title),{title:n.title,status:n.status}]}:n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)]}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,error:null}:_u(e,n.error.message,t.now)}function Kk(e){const t=e.clis.find(r=>r.cliId==="claude"&&r.available)??e.clis.find(r=>r.available)??e.clis[0],n=t?.models.find(r=>t.cliId==="claude"&&r.id==="sonnet")??t?.models.find(r=>r.id===t.defaultModel)??t?.models[0],i=n?.effortLevels.includes("medium")?"medium":n?.defaultEffort??n?.effortLevels[0]??"";return{cliId:t?.cliId??"",model:n?.id??"",effort:i}}function _u(e,t,n){return{...e,busy:!1,phase:"error",runEndedAt:n,error:t}}function z9(e,t){const n=e.at(-1);return n?.role==="analyst"?[...e.slice(0,-1),{role:"analyst",text:n.text+t}]:[...e,{role:"analyst",text:t}]}const lp=new Map;function GA(e){const t=H9(e.operationId,e.api);return{state:y.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function H9(e,t){const n=lp.get(e);if(n)return n;const i=q9(e,t);return lp.set(e,i),i}function F9(e){lp.get(e)?.dispose()}const U9=2e3,W9=12e4;function q9(e,t){let n=Uy,i=!1,r=null,o=null,c=null,d=null,p=null,f=0,g=0;const _=new Set,b=T=>{if(i)return;const j=$9(n,T);if(j!==n){n=j;for(const M of _)M()}},S=()=>{o!==null&&(clearTimeout(o),o=null)},w=()=>{S(),o=setTimeout(()=>{o=null,b({type:"error",message:"Analysis response timed out.",now:Date.now()})},W9)},x=()=>{S(),f+=1,g+=1;const T=r;r=null,T?.()},C=()=>{x(),b({type:"session-lost",now:Date.now()})},O=async()=>{if(r)return;const T=++f;let j=null;const M=new Promise(H=>{j=H});r=P9(t,e,H=>{if(!(T!==f||i)){if(H.type==="connected"){b({type:"event",event:H,now:Date.now()}),j?.(),j=null;return}if(H.type==="error"&&Vk(H.error.code)){j?.(),j=null,C();return}(H.type==="complete"||H.type==="error")&&S(),b({type:"event",event:H,now:Date.now()})}}),await Promise.race([M,new Promise(H=>setTimeout(H,U9))])},z={getSnapshot:()=>n,subscribe:T=>(_.add(T),()=>_.delete(T)),dispatch:b,send:async T=>{if(p)try{await p}catch{return}d&&await d;const j=T.trim();if(!j||n.busy||i)return;const M=!n.started,H=++g,F={cliId:n.cliId,model:n.model,effort:n.effort};if(b({type:"sending",started:M,text:j,now:Date.now()}),M){const ee=I9(t,e,F);c=ee;try{await ee}catch(ae){if(i||H!==g)return;if(!(ae instanceof Fy&&ae.code==="analysis_session_exists")){b({type:"start-failed",message:vu(ae),now:Date.now()});return}}finally{c===ee&&(c=null)}if(i||H!==g||!n.started||(await O(),H!==g||!n.started))return}try{if(await B9(t,e,j),H!==g||!n.busy||!n.started)return;w()}catch(ee){if(i||H!==g)return;ee instanceof Fy&&Vk(ee.code)?C():b({type:"error",message:vu(ee),now:Date.now()})}},stop:async()=>{if(p){await p.catch(()=>{});return}if(d)return d;if(i||!n.started)return;x(),b({type:"stopped",now:Date.now()});const T=G_(t,e).catch(j=>{b({type:"stop-failed",message:vu(j),now:Date.now()})});d=T,await T,d===T&&(d=null)},reset:async()=>{if(p)return p;if(i)return;const T=n.started||n.phase!=="idle"||n.entries.length>0||n.artifacts.length>0;x();const j=(async()=>{d&&await d,c&&await c.catch(()=>{}),T&&await G_(t,e),b({type:"reset"})})().catch(M=>{throw b({type:"error",message:`Reset failed: ${vu(M)}`,now:Date.now()}),M});p=j;try{await j}finally{p===j&&(p=null)}},dispose:()=>{i||(i=!0,lp.delete(e),x(),_.clear(),n.started&&G_(t,e).catch(()=>{}))}};return D9(t).then(T=>b({type:"catalog",catalog:T})).catch(T=>b({type:"error",message:vu(T),now:Date.now()})),z}function vu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function Vk(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function G9({context:e}){const{state:t,dispatch:n}=GA(e),i=y.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),r=t.artifacts[0]?.id??null,[o,c]=y.useState(null),[d,p]=y.useState(!1),f=y.useId(),g=y.useRef(null);y.useEffect(()=>{r&&c(r)},[r]);const _=i.find(S=>S.id===o)??i.at(-1)??null,b=i.length;return y.useEffect(()=>{if(!d)return;const S=x=>{x.target instanceof Node&&!g.current?.contains(x.target)&&p(!1)},w=x=>{x.key==="Escape"&&p(!1)};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",w)}},[d]),y.useEffect(()=>{b||p(!1)},[b]),u.jsxs("section",{className:"session-analyst__artifacts","aria-label":"Artifacts",children:[u.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[u.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:"Artifacts"}),u.jsx("small",{children:"Visual outputs from this analysis"})]}),u.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:g,children:[u.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":d,"aria-controls":f,"aria-haspopup":"listbox","aria-label":`${d?"Hide":"Show"} artifacts (${b} ${b===1?"item":"items"})`,onClick:()=>p(S=>!S),disabled:!b,children:[u.jsx("strong",{children:b})," ",u.jsx("span",{children:b===1?"item":"items"}),u.jsx("i",{"aria-hidden":"true"})]}),d?u.jsx("div",{className:"session-analyst__artifact-menu",id:f,role:"listbox","aria-label":"Published artifacts",children:i.map(S=>{const w=S.id===_?.id;return u.jsxs("button",{type:"button",role:"option","aria-selected":w,className:w?"is-active":void 0,title:S.title,onClick:()=>{c(S.id),p(!1)},children:[u.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),u.jsx("strong",{children:S.title}),u.jsx(KA,{createdAt:S.createdAt})]},S.id)})}):null]}),u.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{p(!1),n({type:"clear-artifacts"})},disabled:!b,children:"Clear"})]}),b===0?u.jsxs("div",{className:"session-analyst__artifacts-empty",children:[u.jsx("strong",{children:"No artifacts yet"}),"Artifacts the analyst publishes will appear here."]}):u.jsx("div",{className:"session-analyst__artifact-content",children:_?u.jsx(K9,{artifact:_},_.id):null})]})}function K9({artifact:e}){const t=A9(e.html);return t?u.jsxs("article",{"aria-label":"Selected artifact preview",children:[u.jsxs("header",{children:[u.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),u.jsx(KA,{createdAt:e.createdAt})]}),u.jsx("iframe",{title:e.title,srcDoc:t,sandbox:""})]}):null}function KA({createdAt:e}){const t=new Date(e),n=Number.isFinite(t.getTime());return u.jsx("time",{dateTime:n?t.toISOString():void 0,children:n?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Unknown time"})}const V9=[{icon:"◈",tone:"aurora",text:"Walk me through how this session unfolded"},{icon:"●",tone:"aurora",text:"What is the agent doing right now?"},{icon:"▲",tone:"coral",text:"Flag anything I should review"},{icon:"≡",tone:"brass",text:"Draft a handoff brief"}];function Y9({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=GA(e),[c,d]=y.useState(""),p=t.catalog?.clis.find(C=>C.cliId===t.cliId),f=p?.models.find(C=>C.id===t.model),g=t.entries.length>0,_=y.useRef(null),b=t.entries.at(-1),S=y.useRef(g).current,w=g&&!S;y.useLayoutEffect(()=>{const C=_.current;!C||!g||(C.scrollTop=C.scrollHeight)},[g,b?.text,t.entries.length,t.latestActivity,t.phase]);const x=async C=>{const O=C.trim();!O||t.busy||(d(""),await i(O))};return u.jsxs("section",{className:`session-analyst__chat-pane ${g?"has-interacted":"is-initial"}`,"aria-label":"Session Analyst chat","data-phase":t.phase,children:[u.jsx(X9,{state:t,onReset:()=>{o().then(()=>d("")).catch(()=>{})}}),u.jsxs("div",{className:"session-analyst__workspace",children:[u.jsxs("section",{ref:_,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[g?u.jsx("ol",{className:t.busy?"is-dimmed":void 0,children:t.entries.map((C,O)=>u.jsx("li",{className:`session-analyst__message session-analyst__message--${C.role}`,children:C.text},`${C.role}-${O}`))}):u.jsxs("div",{className:"session-analyst__hero-wrap",children:[u.jsxs("header",{className:"session-analyst__hero",children:[u.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),u.jsx("h2",{children:"Ask about this session"}),u.jsx("p",{children:"Review, explain, and summarize this session — without affecting the host agent."})]}),u.jsx("div",{className:"session-analyst__suggestions",children:V9.map(C=>u.jsxs("button",{type:"button",onClick:()=>{x(C.text)},children:[u.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":C.tone,"aria-hidden":"true",children:C.icon}),C.text]},C.text))})]}),t.phase!=="idle"?u.jsx(Z9,{state:t}):null]}),u.jsx("form",{className:`session-analyst__composer ${g?"is-docked":"is-initial"}${w?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:C=>{C.preventDefault(),x(c)},children:u.jsxs("div",{className:"session-analyst__composer-surface",children:[g?null:u.jsxs("div",{className:"session-analyst__selector-strip","aria-label":"Initial analysis settings",children:[u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis CLI",disabled:t.started||!t.catalog,value:t.cliId,onChange:C=>n({type:"select-cli",cliId:C.target.value}),children:t.catalog?.clis.map(C=>u.jsx("option",{value:C.cliId,disabled:!C.available,children:C.label},C.cliId))})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis model",disabled:t.started||!f,value:t.model,onChange:C=>n({type:"select-model",model:C.target.value}),children:p?.models.map(C=>u.jsx("option",{value:C.id,children:C.label},C.id))})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis effort",disabled:t.started||!f||!f.effortLevels.length,value:t.effort,onChange:C=>n({type:"select-effort",effort:C.target.value}),children:f?.effortLevels.length?f.effortLevels.map(C=>u.jsx("option",{value:C,children:C},C)):u.jsx("option",{value:"",children:"n/a"})})})]}),u.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:"Ask about this session"}),u.jsx("textarea",{id:`analysis-${e.operationId}`,rows:1,placeholder:"Ask about the session…",value:c,onChange:C=>d(C.target.value),onKeyDown:C=>{C.key!=="Enter"||C.shiftKey||C.nativeEvent.isComposing||(C.preventDefault(),x(c))},disabled:t.busy}),t.busy?u.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":"Stop",onClick:()=>{r()},children:u.jsx("span",{"aria-hidden":"true"})}):u.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":"Send",disabled:!c.trim(),children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:u.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]})})]})]})}function X9({state:e,onReset:t}){const n=e.started||e.phase!=="idle"||e.entries.length>0||e.artifacts.length>0;return u.jsxs("header",{className:"session-analyst__panel-head",children:[u.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:"Session Analyst"}),u.jsx("small",{children:"Read-only intelligence for this operation"})]}),u.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":"Reset Session Analyst",onClick:t,disabled:!n,children:"Reset"}),u.jsxs("span",{className:"session-analyst__panel-state",children:[u.jsx("i",{"aria-hidden":"true"}),ez(e)]})]})}function Z9({state:e}){const t=tz(e),n=nz(t),i=Q9(e.latestActivity);if(e.phase==="complete")return null;if(e.phase==="stopped")return u.jsxs("div",{className:"session-analyst__receipt is-stopped",role:"status",children:["Stopped · last confirmed: ",i," · ",n]});const r=e.phase==="error",o=J9(e.latestActivity);return u.jsxs("div",{className:`session-analyst__pulse${r?" is-error":""}`,role:r?"alert":"status","aria-live":r?void 0:"polite",children:[r?null:u.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),u.jsxs("div",{className:"session-analyst__pulse-main",children:[u.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),u.jsxs("span",{className:"session-analyst__pulse-copy",children:[u.jsx("strong",{children:r?e.error:o.label},`${e.phase}-${o.label}`),u.jsx("small",{children:r?`Last confirmed activity: ${i}`:o.note})]}),u.jsx("time",{children:n})]}),u.jsx("span",{className:"session-analyst__truth-mark",children:"Last confirmed activity only"})]})}function J9(e){return!e||e.kind==="starting"?{label:"Starting analyst",note:e?.connected?"Analyst connection confirmed":"Starting a new analysis session"}:e.kind==="reasoning"?{label:"Reasoning over session",note:"Thought event received · content hidden"}:e.kind==="tool"?{label:`Using ${e.title}`,note:`Tool status: ${e.status}`}:{label:"Writing answer",note:"Answer chunk received"}}function Q9(e){return!e||e.kind==="starting"?"Starting analyst":e.kind==="reasoning"?"Reasoning over session":e.kind==="tool"?`Using ${e.title} (${e.status})`:"Writing answer"}function ez(e){return e.phase==="error"?"Needs attention":e.busy?"Analyzing":e.phase==="complete"?"Complete":e.phase==="stopped"?"Stopped":"Ready"}function tz(e){const[t,n]=y.useState(()=>Date.now());return y.useEffect(()=>{if(!e.busy)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e.busy,e.runStartedAt]),e.runStartedAt===null?0:Math.max(0,(e.runEndedAt??t)-e.runStartedAt)}function nz(e){return`${Math.floor(e/1e3)}s`}const iz=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class Zs extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function VA(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new Zs(t.status,"Invalid agent state response");return n.agentClis.map(i=>dz(i,t.status))}async function sz(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.clis))throw new Zs(t.status,"Invalid Agent CLI state response");return n}async function rz(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Zs(t.status,"Invalid tenants response");return n.tenants.map(i=>fz(i,t.status))}async function az(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Zs(t.status,"Invalid jobs response");return n.tenants}async function oz(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new Zs(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Fp(i,t.status))}async function lz(e){const t=await fetch("/api/v1/operations",{signal:e});await Qr(t);const n=await t.json();if(!Array.isArray(n.operations))throw new Zs(t.status,"Invalid operations response");return{operations:n.operations.map(i=>pz(i,t.status))}}async function cz(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await Qr(i),Fp(await i.json(),i.status)}async function uz(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Qr(n),Fp(await n.json(),n.status)}async function hz(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Qr(n)}function Fp(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||Wy(n))throw new Zs(t,"Invalid agent session response");return{sessionId:n.sessionId,terminalSessionId:typeof n.terminalSessionId=="string"?n.terminalSessionId:n.sessionId,cwdLabel:n.cwdLabel,label:typeof n.label=="string"?n.label:void 0,cliId:typeof n.cliId=="string"?n.cliId:void 0,cliLabel:typeof n.cliLabel=="string"?n.cliLabel:void 0,status:n.status,turnState:n.turnState==="running"||n.turnState==="ended"?n.turnState:"none",createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function Qr(e){if(!e.ok)throw new Zs(e.status,`Agent plugin request failed: ${e.status}`)}function dz(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new Zs(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function fz(e,t){const n=e;if(!n||typeof n.tenantId!="string"||typeof n.tenantLabel!="string"||typeof n.createdAt!="number"||typeof n.sessions!="number")throw new Zs(t,"Invalid tenant response");return n}function pz(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||Wy(n)||Wy(n.payload))throw new Zs(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,ts:n.ts}}function Wy(e){return qy(e,new Set(iz))}function qy(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>qy(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||qy(i,t))}const mz="active",Gy=new Set(["done","error","aborted"]);function gz(e,t){let n=XA(Ky(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=YA(n,i);return Gy.has(t.status)&&!Gy.has(n.status)&&(n={...n,status:t.status}),n}function YA(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:bz(e.recentEvents,t)};switch(t.type){case"job:registered":return vz(i,n);case"job:finalized":return{...i,status:Cn(n.status)??"done",finishedAt:Oa(n.finishedAt)??t.at,summary:Cn(n.summary),error:Cn(n.error)};case"track:begin":return El(XA(i,n.request),n,t.id,r=>({...r,startedAt:Oa(n.startedAt)??t.at,requestPreview:Cn(n.requestPreview)}));case"track:status":return El(i,n,t.id,r=>({...r,status:Cn(n.status)??r.status}));case"track:text":return El(i,n,t.id,r=>{const o=r.text+(Cn(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Oa(n.textLength)??Cn(n.text)?.length??0),latestLine:Sz(o)||r.latestLine}});case"track:thought":return El(i,n,t.id,r=>{const o=r.thought+(Cn(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Oa(n.textLength)??Cn(n.text)?.length??0)}});case"track:tool":return El(i,n,t.id,r=>({...r,status:"stream",tools:yz(r.tools,n)}));case"track:finalized":return El(i,n,t.id,r=>{const o=Yk(r.text,r.sentTextLength,Cn(n.fallbackText),Oa(n.fallbackTextLength)),c=Yk(r.thought,r.sentThoughtLength,Cn(n.fallbackThought),Oa(n.fallbackThoughtLength));return{...r,status:Cn(n.status)??"done",finishedAt:Oa(n.finishedAt)??t.at,error:Cn(n.error),text:o.text,sentTextLength:o.sentLength,thought:c.text,sentThoughtLength:c.sentLength}});default:return i}}function XA(e,t){if(e.request)return e;const n=_z(t);return n?{...e,request:n}:e}function _z(e){if(typeof e!="object"||e===null)return;const t=e;if(!Array.isArray(t.blocks)||typeof t.additional!="string")return;const n=[];for(const i of t.blocks){if(typeof i!="object"||i===null)return;const r=i;if(typeof r.tag!="string"||typeof r.hint!="string"||typeof r.required!="boolean"||typeof r.present!="boolean"||typeof r.body!="string")return;n.push({tag:r.tag,hint:r.hint,required:r.required,present:r.present,body:r.body})}return{blocks:n,additional:t.additional}}function Ky(e,t,n){return{jobId:t,tenantId:e,status:mz,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function ec(e){return Gy.has(e)}function vz(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,r=e.tracks;for(const o of n){if(!o.trackId)continue;const c=r[o.trackId],d={...c??ZA(o.trackId),displayName:o.displayName??c?.displayName??o.trackId,displayCli:o.displayCli??c?.displayCli,model:o.model??c?.model,effort:o.effort??c?.effort,subtitle:o.subtitle??c?.subtitle,kind:o.kind??c?.kind,startedAt:o.startedAt??c?.startedAt};c||(i=[...i,o.trackId]),r={...r,[o.trackId]:d}}return{...e,label:Cn(t.label)??e.label,ownerCarrierId:Cn(t.ownerCarrierId)??e.ownerCarrierId,kind:Cn(t.kind)??e.kind,signatureCli:Cn(t.signatureCli)??e.signatureCli,startedAt:Oa(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function El(e,t,n,i){const r=Cn(t.trackId);if(!r)return e;const o=e.tracks[r],c={...i(o??ZA(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:c}}}function ZA(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function yz(e,t){const n=Cn(t.toolId)??Cn(t.id);if(!n)return e;const i={id:n,name:Cn(t.name),input:t.input,output:t.output,status:Cn(t.status)},r=e.findIndex(o=>o.id===n);return r>=0?[...e.slice(0,r),{...e[r],...i},...e.slice(r+1)]:[...e,i]}function Yk(e,t,n,i){return n?t>=(i??n.length)?{text:e,sentLength:t}:{text:n,sentLength:i??n.length}:{text:e,sentLength:t}}function bz(e,t){return[...e,t].slice(-120)}function Sz(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
99
|
-
`);return n[n.length-1]?.trim()??""}function Cn(e){return typeof e=="string"?e:void 0}function Oa(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const wz=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function xz(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
|
|
100
|
-
|
|
101
|
-
`);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=kz(r);o&&n.push(o),i=e.indexOf(`
|
|
102
|
-
|
|
103
|
-
`)}return n}}function Cz(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const i=t.tenant?.tenantId;return!i||!t.truncation?null:{kind:"truncation",tenantId:i,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const i=Zk(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=Zk(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:Ez(t.reason)}:null}const n=Xk(t.event)??Xk(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function kz(e){const t=e.split(`
|
|
104
|
-
`),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
105
|
-
`);return!i&&n==="message"?null:{event:n,data:i}}function Xk(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 Zk(e){try{return Fp(e,200)}catch{return null}}function Ez(e){return typeof e=="string"&&wz.has(e)?e:void 0}const C0={droppedCount:0},Vy=new Set;let ln={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function Tz(){return t5(Az,JA)}function JA(){return ln}function Az(e){return Vy.add(e),()=>{Vy.delete(e)}}function ps(e){ln={...ln,...e},Dz()}function QA(e){ps({agentClis:e})}function Rz(e){const t={};for(const n of e)t[n.sessionId]=n;ps({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function cp(e){const t=!!ln.sessions[e.sessionId];ps({sessions:{...ln.sessions,[e.sessionId]:e},sessionOrder:t?ln.sessionOrder:[e.sessionId,...ln.sessionOrder],turnState:{...ln.turnState,[e.sessionId]:e.turnState}})}function eR(e){const{[e]:t,...n}=ln.sessions,{[e]:i,...r}=ln.turnState;ps({sessions:n,sessionOrder:ln.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:ln.activeTerminalSessionId===e?null:ln.activeTerminalSessionId,turnState:r})}function tR(e){ps({activeTerminalSessionId:e})}function Nz(e){ps({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...ln.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&ln.tenantJobs[t])]})}function Lz(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=gz(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??C0}}ps({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...ln.tenantOrder.filter(n=>t[n])]})}function Mz(e,t){const n=e.tenantId,i=e.jobId??jz(e),r=ln.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:C0},o=i?r.jobs[i]??Ky(n,i,e.at):Ky(n,"__unknown__",e.at),c=YA(o,e),d=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,p={...r,tenantLabel:t??r.tenantLabel,jobOrder:d,jobs:i?{...r.jobs,[i]:c}:r.jobs};return ps({tenantJobs:{...ln.tenantJobs,[n]:p},tenantOrder:ln.tenantOrder.includes(n)?ln.tenantOrder:[n,...ln.tenantOrder]}),{job:c,unknownTenant:!ln.tenantJobs[n]}}function Oz(e,t,n){const i=ln.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:C0};ps({tenantJobs:{...ln.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function nR(e){const t=e.tenantId;if(!t)return[];const n=ln.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function Dz(){for(const e of Vy)e()}function jz(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const Jk=250,Iz=5e3,Yy=new Map;function Bz(e){const t=new AbortController;return Pz(t.signal,e),()=>t.abort()}async function Pz(e,t){let n=Jk;for(;!e.aborted;){ps({connection:"connecting"});try{await Fz(e,t);const i=await fetch("/plugins/terminal/agent/events",{signal:e});if(!i.ok||!i.body)throw new Error(`Agent stream failed: ${i.status}`);ps({connection:"live",connectionError:null}),n=Jk,await $z(i.body.getReader(),e,t),e.aborted||ps({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;ps({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await Wz(n,e),n=Math.min(n*2,Iz)}}async function $z(e,t,n){const i=new TextDecoder,r=xz();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const c of r(i.decode(o.value,{stream:!0}))){const d=Cz(c);if(d){if(d.kind==="truncation"&&d.truncation){Oz(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){cp(d.session),up(n,d.session.sessionId,k0(d.session));continue}if(d.kind==="attention"&&d.session){cp(d.session),d.reason!=="idle_prompt"&&up(n,d.session.sessionId,"awaiting");continue}d.event&&(Mz(d.event,d.tenantLabel),Hz(n,d.event.tenantId))}}}}function k0(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&zz(e)?"running":"idle"}function zz(e){return nR(e).some(t=>!ec(t.status))}function up(e,t,n){const i=Yy.get(t);e.status.set(t,n),Yy.set(t,n),i!==n&&(n==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):n==="idle"&&(i==="running"||i==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function Hz(e,t){const{sessions:n}=JA();for(const i of Object.values(n))i.tenantId===t&&Yy.get(i.sessionId)!=="awaiting"&&up(e,i.sessionId,k0(i))}async function Fz(e,t){const[n,i,r,o,c]=await Promise.all([VA(e),oz(e),rz(e),az(e),lz(e)]);QA(n),Rz(i),Nz(r),Lz(o);for(const d of i)up(t,d.sessionId,k0(d));Uz(c.operations,t)}function Uz(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function Wz(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const qz=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function Gz(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return`${n}m ${i}s`}function Kz(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function Vz(e){return e.trackOrder.reduce((t,n)=>{const i=e.tracks[n];return i?t+Math.round((i.sentTextLength+i.sentThoughtLength)/4):t},0)}function iR(e){if(e)return qz.has(e)?e:void 0}function Yz(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function Up(e){return e==="err"||e==="error"}function fh(e,t){return!ec(e)&&Yz(t)}function E0(e,t){return Up(e)?"error":e==="done"||e==="aborted"?e:ec(t)?t:e}function Xz(e,t){const n=new Set(e),i=t.filter(r=>n.has(r)?!1:(n.add(r),!0));return i.length===0?e:[...e,...i]}function Zz(e,t,n){const i=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)i.get(o)?.expiresAt!==n&&(i.set(o,{jobId:o,expiresAt:n}),r=!0);return r?[...i.values()]:e}function Jz(e,t,n){const i=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>n&&i.has(o.jobId));return r.length===e.length?e:r}function sR(e,t){const n=new Map(e.map(i=>[i.jobId,i]));return t.flatMap(i=>{const r=n.get(i);return r?[r]:[]})}function Qz(e){const t=e.flatMap(r=>r.trackOrder.map(o=>({job:r,track:r.tracks[o]}))).filter(r=>!!r.track).sort((r,o)=>o.track.lastEventId-r.track.lastEventId),n=t.filter(({job:r,track:o})=>fh(r.status,o.status)),i=n.length>0?n:t;for(const{job:r,track:o}of i){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(fh(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function eH(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=sR(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class Wp extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function tH(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await T0(t),aR(await t.json(),t.status)}async function nH(e,t,n){const i=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t}),signal:n});return await T0(i),rR(await i.json(),i.status)}async function iH(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await T0(n),rR(await n.json(),n.status)}async function T0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Wp(e.status,t)}function rR(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Wp(t,"Invalid model auth mutation response");return{state:aR(n.state,t)}}function aR(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Wp(t,"Invalid model auth state response");return{providers:n.providers.map(i=>sH(i,t))}}function sH(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Wp(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const Xy=new Set;let Zy={loading:!1,state:null,busyCli:null,error:null},qr=0;function rH(){return y.useSyncExternalStore(aH,Qk,Qk)}function Qk(){return Zy}function aH(e){return Xy.add(e),()=>Xy.delete(e)}async function oH(e){const t=++qr;Gr({loading:!0,error:null});try{const n=await tH(e);if(t!==qr)return;Gr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==qr)return;Gr({loading:!1,error:A0(n)})}}async function lH(e,t){const n=++qr;Gr({busyCli:e,error:null});try{const i=await nH(e,t);return n!==qr||(Gr({state:i.state,busyCli:null,error:null}),await oR()),!0}catch(i){return n!==qr||Gr({busyCli:null,error:A0(i)}),!1}}async function cH(e){const t=++qr;Gr({busyCli:e,error:null});try{const n=await iH(e);return t!==qr||(Gr({state:n.state,busyCli:null,error:null}),await oR()),!0}catch(n){return t!==qr||Gr({busyCli:null,error:A0(n)}),!1}}async function oR(){try{QA(await VA())}catch{}}function Gr(e){Zy={...Zy,...e};for(const t of Xy)t()}function A0(e){return e instanceof Error?e.message:String(e)}class lR extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function uH(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await cR(t),uR(await t.json(),t.status)}async function hH(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await cR(n),uR(await n.json(),n.status)}async function cR(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new lR(e.status,t)}function uR(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new lR(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode}}const Jy=new Set;let hp={loading:!1,state:null,savingField:null,error:null},Of=0;function hR(){return y.useSyncExternalStore(dH,e2,e2)}function e2(){return hp}function dH(e){return Jy.add(e),()=>{Jy.delete(e)}}async function dR(e){const t=++Of;Vl({loading:!0,error:null});try{const n=await uH(e);if(t!==Of)return;Vl({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Of)return;Vl({loading:!1,error:pR(n)})}}async function fR(e,t){const n=hp.state;if(!n)return!1;Of+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:{codexLaunchMode:i.codexLaunchMode};Vl({state:i,savingField:e,error:null});try{const o=await hH(r);return Vl({state:o,savingField:null,error:null}),!0}catch(o){return Vl({state:n,savingField:null,error:pR(o)}),!1}}function Vl(e){hp={...hp,...e};for(const t of Jy)t()}function pR(e){return e instanceof Error?e.message:String(e)}function fH({job:e}){const t=e.request;return u.jsxs("section",{className:"request-details","aria-label":`Request for ${e.label??e.jobId}`,children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),t?u.jsxs("div",{className:"request-details-blocks",children:[t.blocks.map((n,i)=>u.jsx(pH,{block:n},`${n.tag}-${i}`)),t.additional.trim().length>0?u.jsxs("section",{className:"request-details-block request-details-additional","aria-label":"Additional request",children:[u.jsxs("header",{className:"request-details-block-head",children:[u.jsx("span",{className:"request-details-tag",children:"Additional"}),u.jsx("span",{className:"request-details-presence",children:"residual"})]}),u.jsx("pre",{children:t.additional})]}):null]}):u.jsx("p",{className:"request-details-unavailable",children:"Request unavailable for this legacy job."})]})}function pH({block:e}){const t=e.present?e.body.length===0?"present · empty":"present":e.required?"missing · required":"missing · optional";return u.jsxs("section",{className:"request-details-block","aria-label":`${e.tag} ${t}`,children:[u.jsxs("header",{className:"request-details-block-head",children:[u.jsx("span",{className:"request-details-tag",children:e.tag}),u.jsx("span",{className:"request-details-hint",children:e.hint}),u.jsx("span",{className:"request-details-required",children:e.required?"required":"optional"}),u.jsx("span",{className:`request-details-presence ${e.present?"is-present":"is-missing"}`,children:t})]}),e.present?u.jsx("pre",{children:e.body}):null]})}const mH=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],gH="/plugins/terminal/agent/ticket",_H="/plugins/terminal/ws",K_="fleet-plugin.terminal.stream-dock-expanded",vH="fleet-plugin.terminal.stream-dock-collapsed",yH=56,bH=4e3,SH={...M$,step:1,defaultValue:14},wH="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",xH=5e3,mR={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>$u(e.payload,"cliLabel")??void 0,render:e=>u.jsx(NH,{context:e}),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>u.jsx(Y9,{context:e})},{id:"session-analyst-artifacts",title:"Artifacts",hideCaption:!0,render:e=>u.jsx(G9,{context:e})}]},gR={id:"general",title:"General",render:()=>u.jsx(OH,{})},_R={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(DH,{})},vR={id:"agent.attention",title:"Agent input waiting"},CH={id:"agent.ended",title:"Agent turn ended"},tf={id:"terminal",operationKinds:[mR],settingsSections:[gR,_R],notificationKinds:[vR,CH],install:e=>kH(e),closeOperation:async e=>{try{await hz(e)}finally{F9(e),eR(e)}},launch:async({theaterId:e,kind:t})=>{const n=await cz(e,t.id);return cp(n),tR(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude"||e.id==="claude-kimi"?u.jsx(ZH,{}):e.id==="codex"?u.jsx(JH,{}):u.jsx(XH,{})};function kH(e){return Bz({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function yR(e,t){const n=y.useRef(null),i=y.useRef(!0),[r,o]=y.useState(!0),c=y.useCallback(p=>{i.current!==p&&(i.current=p,o(p))},[]);y.useEffect(()=>{const p=n.current;if(!p)return;const f=()=>{const g=p.scrollHeight-p.scrollTop-p.clientHeight;c(g<=yH)};return p.addEventListener("scroll",f,{passive:!0}),()=>p.removeEventListener("scroll",f)},[e,c]),y.useLayoutEffect(()=>{c(!0);const p=n.current;p&&(p.scrollTop=p.scrollHeight)},[e,c]),y.useLayoutEffect(()=>{const p=n.current;!p||!i.current||(p.scrollTop=p.scrollHeight)},[t]);const d=y.useCallback(()=>{const p=n.current;p&&(p.scrollTop=p.scrollHeight,p.focus({preventScroll:!0}),c(!0))},[c]);return{containerRef:n,pinned:r,jumpToLatest:d}}function EH(e){return Array.from(e.querySelectorAll("button, summary, [href], input, select, textarea, [tabindex]")).filter(t=>{if(t.tabIndex<0||t.hidden||t.closest("[hidden]")||t.matches(":disabled"))return!1;const n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"&&t.getClientRects().length>0})}function TH(){const[e,t]=y.useState(()=>{try{return localStorage.removeItem(vH),localStorage.getItem(K_)==="true"}catch{return!1}}),n=y.useCallback(i=>{try{i?localStorage.setItem(K_,"true"):localStorage.removeItem(K_)}catch{}t(i)},[]);return[e,n]}function AH(e,t){const[n,i]=y.useState(Date.now);return y.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":Gz((t??n)-e)}function RH(e){const t=e.companionsOpen??!1,[n,i]=y.useState(!1);return y.useEffect(()=>{if(t||n)return;let r=!1,o=!1;const c=async()=>{if(o)return;o=!0;const p=await j9(e.api,e.operationId);o=!1,!r&&p&&i(!0)};c();const d=window.setInterval(()=>{c()},xH);return()=>{r=!0,window.clearInterval(d)}},[t,e.api,e.operationId,n]),t||n}function t2({context:e,ready:t}){const n=e.companionsOpen??!1;return u.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}`,"aria-label":n?"Exit Session Analyst":"Open Session Analyst","aria-pressed":n,"aria-disabled":!t,disabled:!t,title:t?void 0:"Send a message in this session first",onClick:()=>{t&&e.onRequestCompanions?.(!e.companionsOpen)},children:[u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),u.jsx("span",{className:"session-analyst-handle__label",children:n?"EXIT":"ANALYZE"})]})}function NH({context:e}){const n=Tz().sessions[e.operationId]??UH(e),[i,r]=y.useState(!1),[o,c]=y.useState("request"),[d,p]=y.useState([]),[f,g]=y.useState([]),_=y.useId(),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(new Set),C=RH(e),O=nR(n),P=O.filter(B=>!ec(B.status)),z=eH(P,O,f),T=sR(O,d),j=`${i}:${o}`,M=T.map(B=>`${B.jobId}:${B.lastEventId}`).join(","),H=yR(j,M);y.useLayoutEffect(()=>{const B=x.current,N=O.filter(R=>B.has(R.jobId)&&ec(R.status)).map(R=>R.jobId);x.current=new Set(P.map(R=>R.jobId)),N.length!==0&&g(R=>Zz(R,N,Date.now()+bH))},[P,O]),y.useEffect(()=>{if(f.length===0)return;const B=Math.min(...f.map(R=>R.expiresAt)),N=window.setTimeout(()=>{g(R=>Jz(R,O,Date.now()))},Math.max(0,B-Date.now()));return()=>window.clearTimeout(N)},[O,f]),y.useEffect(()=>{i&&p(B=>Xz(B,P.map(N=>N.jobId)))},[P,i]);const F=y.useCallback(()=>{r(!1),p([]),w.current?.focus()},[]),ee=y.useCallback(()=>{p(z.map(B=>B.jobId)),c("request"),r(!0)},[z]),ae=y.useCallback(B=>{c(B)},[]),K=y.useCallback(B=>{const N=["request","activity"],R=N.indexOf(o);let A;if(B.key==="ArrowLeft"&&(A=(R+N.length-1)%N.length),B.key==="ArrowRight"&&(A=(R+1)%N.length),B.key==="Home"&&(A=0),B.key==="End"&&(A=N.length-1),A===void 0)return;B.preventDefault();const E=N[A];c(E),document.getElementById(`${_}-${E}`)?.focus()},[o,_]);return y.useLayoutEffect(()=>{if(!i)return;const B=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame(B)},[i]),y.useEffect(()=>{if(!i)return;const B=N=>{if(N.key==="Escape"){N.stopPropagation(),F();return}if(N.key==="Tab"){const R=S.current;if(!R)return;const A=EH(R),E=A[0],L=A[A.length-1];N.shiftKey&&document.activeElement===E?(N.preventDefault(),L?.focus()):!N.shiftKey&&document.activeElement===L&&(N.preventDefault(),E?.focus())}};return document.addEventListener("keydown",B,!0),()=>document.removeEventListener("keydown",B,!0)},[i,F]),n.status==="dormant"?u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(t2,{context:e,ready:C}),u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{FH(n.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(t2,{context:e,ready:C}),u.jsx(b0,{operationId:n.sessionId,ticketPath:gH,wsPath:_H,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>eR(n.sessionId)}),z.length>0?u.jsx(LH,{activeJobs:z,onOpenDetail:ee,detailBtnRef:w}):null,i?u.jsxs("div",{ref:S,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[u.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:F}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:F,children:"×"}),u.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[u.jsx("button",{id:`${_}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${_}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>ae("request"),onKeyDown:K,children:"Request"}),u.jsx("button",{id:`${_}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${_}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>ae("activity"),onKeyDown:K,children:"Activity"})]}),u.jsx("div",{id:`${_}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:T.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):T.map(B=>u.jsx(fH,{job:B},B.jobId))}),u.jsx("div",{id:`${_}-activity-panel`,ref:o==="activity"?H.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:T.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):T.map(B=>u.jsx(zH,{job:B},B.jobId))}),o==="activity"&&!H.pinned?u.jsx("button",{type:"button",className:"follow-button",onClick:H.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function LH({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=TH(),o=e[0],c=AH(o?.startedAt,o?.finishedAt),d=e.reduce((M,H)=>M+Vz(H),0),p=Kz(d),f=e.length===1&&o?iR(o.ownerCarrierId):void 0,g=e.length===1&&o?o.label:void 0,_=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",b=Qz(e),S=e.map(M=>`${M.jobId}:${M.lastEventId}`).join(","),w=`${i}:${e.map(M=>M.jobId).join(",")}`,{containerRef:x,pinned:C,jumpToLatest:O}=yR(w,S),P=e.some(M=>M.trackOrder.some(H=>{const F=M.tracks[H];return F?fh(M.status,F.status):!1})),z=e.some(M=>!ec(M.status)),T=e.some(M=>M.status==="error"||M.trackOrder.some(H=>Up(M.tracks[H]?.status??""))),j=z?"job-dock-dot":T?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return u.jsxs("div",{className:"job-dock",children:[u.jsxs("div",{className:"job-dock-strip",children:[u.jsx("span",{className:j,"aria-hidden":"true"}),u.jsxs("span",{className:"job-dock-carrier",title:g,children:[f?u.jsx("span",{className:"job-dock-captain-dot","data-captain":f,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:_})]}),u.jsxs("span",{className:"job-dock-strip-line",style:i?{display:"none"}:void 0,"aria-hidden":"true",children:[b.thinking?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):b.text,!i&&P&&b.text?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"job-dock-meta",children:[c?u.jsx("span",{children:c}):null,p?u.jsx("span",{children:p}):null]}),u.jsx("button",{type:"button",className:"job-dock-grip","aria-label":i?"Collapse stream dock":"Expand stream dock","aria-expanded":i,onClick:()=>r(!i),children:i?"▼":"▲"}),u.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:x,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(M=>{const H=e.length>1,F=!H&&M.trackOrder.length===1;return M.trackOrder.map(ee=>{const ae=M.tracks[ee];return ae?u.jsx(MH,{track:ae,job:M,multiJob:H,singleTrack:F},`${M.jobId}:${ee}`):null})})]}),C?null:u.jsx("button",{type:"button",className:"follow-button",onClick:O,children:"↓ Follow"})]})]})}function MH({track:e,job:t,multiJob:n,singleTrack:i}){const r=fh(t.status,e.status),c=qH(e.text),d=!c&&r&&!!e.thought,p=r?WH(e):void 0,f=E0(e.status,t.status),g=n||!i,_=n?iR(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[g?u.jsxs("span",{className:"job-dock-row-name",children:[_?u.jsx("span",{className:"job-dock-captain-dot","data-captain":_,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,u.jsxs("span",{className:`job-dock-row-status${r?" job-dock-row-status--live":""}${Up(f)?" job-dock-row-status--error":""}`,children:[f,p?` · ${p}`:""]}),c?u.jsxs("span",{className:"job-dock-row-line",children:[c,r?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,d?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function OH(){const{renderer:e,font:t}=$A();return u.jsxs(u.Fragment,{children:[u.jsx(BH,{}),u.jsx(GH,{terminalFont:t}),u.jsx(KH,{terminalRenderer:e})]})}function DH(){const[e,t]=y.useState([]),[n,i]=y.useState(null),r=hR();return y.useEffect(()=>{const o=new AbortController;return sz(o.signal).then(c=>t(c.clis)).catch(c=>{o.signal.aborted||i(c instanceof Error?c.message:String(c))}),()=>o.abort()},[]),y.useEffect(()=>{const o=new AbortController;return dR(o.signal),()=>o.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),n?u.jsx("p",{className:"settings-error",children:n}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(o=>u.jsx($H,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:c=>{fR("codexLaunchMode",c)}},o.id))}),r.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:r.error}):null,u.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."}),u.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),u.jsx(jH,{})]})}function jH(){const e=rH();return y.useEffect(()=>{const t=new AbortController;return oH(t.signal),()=>t.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[u.jsxs("div",{className:"model-auth-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Settings for Kimi"}),u.jsx("p",{className:"global-settings-help",children:"Register a Kimi API key to run carriers and terminal sessions through Claude Code against the Kimi endpoint. The key is validated and stored locally, and is never returned to the browser."})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(t=>u.jsx(IH,{provider:t,busy:e.busyCli===t.cli},t.cli)),u.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function IH({provider:e,busy:t}){const[n,i]=y.useState(""),r=async()=>{await lH(e.cli,n)&&i("")};return u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"model-auth-row-head",children:[u.jsx("span",{className:"model-auth-name",children:e.displayName}),u.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?u.jsx("div",{className:"model-auth-actions",children:u.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{cH(e.cli)},children:t?"Working…":"Sign out"})}):u.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[u.jsx("input",{type:"password",className:"model-auth-input",placeholder:"API key",value:n,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":`${e.displayName} API key`,onChange:o=>i(o.target.value)}),u.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function BH(){const e=hR(),t=e.state,n=e.savingField!==null;return y.useEffect(()=>{const i=new AbortController;return dR(i.signal),()=>i.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsx(u.Fragment,{children:u.jsx(PH,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:n,onToggle:()=>{fR("enableMetaphor",!t.enableMetaphor)}})}):u.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function PH({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:c}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:c,children:u.jsx("span",{children:r?n:i})})]})}function $H({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?u.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[u.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),u.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:n,onClick:()=>i("app-server"),children:"App Server"})]}):null,e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function zH({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?u.jsx(HH,{track:n,jobStatus:e.status},n.trackId):null})})]})}function HH({track:e,jobStatus:t}){const n=YH(e.status,t),i=n==="track-card--live",r=E0(e.status,t);return u.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[u.jsxs("header",{className:"track-card-head",children:[u.jsx("span",{className:"track-card-title",children:e.displayName}),u.jsx("span",{className:"track-card-status",children:r})]}),e.thought?u.jsxs("details",{className:"track-card-thinking",children:[u.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),u.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:u.jsx("pre",{children:e.thought})})]}):null,e.text?u.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[u.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),u.jsxs("pre",{children:[e.text,i?u.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?u.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?u.jsx("ul",{className:"track-card-tools",children:e.tools.map(o=>u.jsx("li",{children:o.name??o.id},o.id))}):null]})}async function FH(e){cp(await uz(e)),tR(e)}function UH(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:$u(e.operation.payload,"cliId")??void 0,cliLabel:$u(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:$u(e.operation.payload,"tenantId")??void 0,registrationId:$u(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function $u(e,t){const n=e[t];return typeof n=="string"?n:null}function WH(e){const t=e.tools.find(n=>n.status!=="completed"&&n.status!=="failed"&&n.status!=="error");return t?t.name??t.id:void 0}function qH(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
106
|
-
`);return n[n.length-1]?.trim()??""}function GH({terminalFont:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!0),[o,c]=y.useState(null),d=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Gl.id:Gl.id}:{source:"system",familyName:e.customName};y.useEffect(()=>{const f=new AbortController;return r(!0),c(null),cT({signal:f.signal}).then(g=>{f.signal.aborted||n(g.fonts.filter(_=>_.monospace).map(_=>({family:_.family,monospace:_.monospace})))}).catch(g=>{f.signal.aborted||VH(g)||(n([]),c("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||r(!1)}),()=>f.abort()},[]);const p=f=>{if(f.source==="system"){F$(f.familyName);return}const g=ch.find(_=>_.id===f.id);g&&H$(g.id)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[u.jsx("div",{className:"global-settings-row",children:u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),u.jsx("div",{"aria-describedby":"terminal-font-help",children:u.jsx(oT,{builtIns:ch.map(f=>({id:f.id,label:f.name,family:f.family,aliases:[f.familyName],description:f.meta})),installedFonts:t,selected:d,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Gl.family,previewText:wH,size:e.size,sizeRange:SH,loading:i,error:o,onSelectionChange:p,onSizeCommit:U$})}),u.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 KH({terminalRenderer:e}){return u.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),u.jsx("p",{className:"global-settings-help",children:"WebGL paints the terminal on the GPU for sharper, faster output; DOM is a compatibility fallback. Switching applies to the live terminal instantly without dropping the session."})]}),u.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:mH.map(t=>{const n=t.id===e;return u.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>z$(t.id),children:t.label},t.id)})})]})})}function VH(e){return e instanceof DOMException&&e.name==="AbortError"}function YH(e,t){if(fh(t,e))return"track-card--live";const n=E0(e,t);return Up(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function XH(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function ZH(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function JH(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}class mr extends Error{constructor(t,n){super(n),this.status=t}status}const QH=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function bR(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await N0(t),SR(await t.json(),t.status)}async function eF(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await N0(t),iF(await t.json(),t.status)}async function V_(e,t,n){return R0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function tF(e,t,n,i){return R0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function nF(e,t,n){return R0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function R0(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await N0(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new mr(r.status,"Invalid carrier settings mutation response");return{state:SR(o.state,r.status)}}async function N0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new mr(e.status,t)}function SR(e,t){wR(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new mr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>sF(i,t))}}function iF(e,t){wR(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new mr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>rF(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function sF(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceCapable!="boolean"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new mr(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceCapable:n.taskForceCapable,taskforce:{backends:n.taskforce.backends.map(i=>oF(i,t))}}}function rF(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new mr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>aF(i,t)),defaultModel:n.defaultModel}}function aF(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new mr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new mr(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function oF(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new mr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function wR(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[r,o]of Object.entries(i)){if(QH.has(r))throw new mr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const lF={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Qy=new Set;let _i={loading:!1,state:null,options:null,activeCarrierId:null,draft:lF,savingActionId:null,error:null};function xR(){return y.useSyncExternalStore(cF,n2,n2)}function n2(){return _i}function cF(e){return Qy.add(e),()=>{Qy.delete(e)}}async function Y_(e){ur({loading:!0,error:null});try{const[t,n]=await Promise.all([bR(e),eF(e)]);CR(t,n)}catch(t){if(e?.aborted)return;ur({loading:!1,error:ER(t)})}}function uF(e){const t=_i.state?.carriers.find(n=>n.carrierId===e);ur({activeCarrierId:e,draft:t?L0(t,_i.options):_i.draft,error:null})}function zl(e){ur({draft:{..._i.draft,...e},error:null})}function eb(e,t){const n=_i.draft.taskforce[e]??{model:"",effort:""};ur({draft:{..._i.draft,taskforce:{..._i.draft.taskforce,[e]:{...n,...t}}},error:null})}function hF(){const e=kR();e&&ur({draft:L0(e,_i.options),error:null})}async function dF(e){const t=kR();return t?fF("save-all",async()=>{const n=_i.draft;let i=null;n.displayName!==t.displayName&&(i=(await V_(t.carrierId,{displayName:n.displayName})).state);const r=n.cliType!==t.cliType;return r&&(i=(await V_(t.carrierId,{cli:n.cliType})).state),(r||n.model!==t.model||(n.effort||"")!==(t.effort||""))&&(i=(await V_(t.carrierId,{model:mF(n)})).state),i=await gF(t,e,i),{state:i??await bR()}}):!1}function CR(e,t){const n=_F(e,_i.activeCarrierId),i=e.carriers.find(r=>r.carrierId===n)??null;ur({loading:!1,state:e,options:t,activeCarrierId:n,draft:i?L0(i,t):_i.draft,error:null})}async function fF(e,t){ur({savingActionId:e,error:null});try{const n=await t();return CR(n.state,_i.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),ur({savingActionId:null}),!0}catch(n){return ur({savingActionId:null,error:ER(n)}),!1}}function L0(e,t){const n=Object.fromEntries((t?.cliTypes??[]).map(i=>{const r=e.taskforce.backends.find(o=>o.cliType===i.id);return[i.id,{model:r?.model??i.defaultModel,effort:r?.effort??pF(i.id,r?.model??i.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:n}}function pF(e,t,n){return n?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function mF(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function kR(){return _i.state?.carriers.find(e=>e.carrierId===_i.activeCarrierId)??null}async function gF(e,t,n){const i=new Set(t.map(r=>r.cliType));for(const r of e.taskforce.backends)i.has(r.cliType)||(n=(await nF(e.carrierId,r.cliType)).state);for(const r of t){const o=e.taskforce.backends.find(c=>c.cliType===r.cliType);o&&o.model===r.model&&(o.effort||"")===(r.effort||"")||(n=(await tF(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return n}function _F(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function ur(e){_i={..._i,...e};for(const t of Qy)t()}function ER(e){return e instanceof Error?e.message:String(e)}const vF=50,yF=2400,bF={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)"},SF={id:"carriers",title:"Carriers",render:()=>u.jsx(wF,{})};function wF(){const e=xR(),t=e.state?.carriers.find(x=>x.carrierId===e.activeCarrierId)??null,n=e.options?.cliTypes.find(x=>x.id===e.draft.cliType)??null,i=n?.models.find(x=>x.modelId===e.draft.model)??null,[r,o]=y.useState(!1),[c,d]=y.useState([]),[p,f]=y.useState("idle"),g=e.savingActionId==="save-all",_=t?AF(t,e.draft,c):!1,b=t?.taskforce.backends.map(x=>`${x.cliType}:${x.model}:${x.effort??""}`).join("|")??"";y.useEffect(()=>{const x=new AbortController;return Y_(x.signal),()=>x.abort()},[]),y.useEffect(()=>{o(!1),d(t?.taskforce.backends.map(x=>x.cliType)??[]),f("idle")},[t?.carrierId,b]),y.useEffect(()=>{if(p!=="saved")return;const x=window.setTimeout(()=>f("idle"),yF);return()=>window.clearTimeout(x)},[p]);function S(){t&&(hF(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),f("idle"))}async function w(){if(!t)return;if(f("saving"),!await dF(NF(c,e.draft.taskforce))){f("idle");return}o(!1),f("saved")}return u.jsxs(u.Fragment,{children:[e.error?u.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,u.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(x=>u.jsx(xF,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>uF(x.carrierId)},x.carrierId))]}),t&&e.options&&n?u.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:RR(t.carrierId),children:[u.jsxs("div",{className:"terminal-carriers-detail-head",children:[u.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[u.jsxs("div",{className:"terminal-carriers-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`terminal-carriers-name-line ${r?"is-editing":""}`,children:r?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:e.draft.displayName,maxLength:vF,onChange:x=>zl({displayName:x.target.value})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Save display name",disabled:g,onClick:()=>{o(!1)},children:u.jsx(MF,{})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Cancel display name edit",onClick:()=>{zl({displayName:t.displayName}),o(!1)},children:u.jsx(OF,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",onClick:()=>{zl({displayName:t.displayName}),o(!0)},children:u.jsx(LF,{})})]})}),u.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),u.jsxs("div",{className:"terminal-carriers-detail-actions",children:[u.jsx("div",{className:`terminal-carriers-save-status ${p==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:p==="saving"||g?"Saving…":p==="saved"?"Saved ✓":""}),u.jsxs("div",{className:"terminal-carriers-save-actions",children:[u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${_?"is-dirty":""}`,disabled:!_||g,onClick:()=>{w()},children:"Save"}),u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${_?"is-dirty":""}`,disabled:!_||g,onClick:S,children:"Discard"}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading,onClick:()=>{Y_()},children:"Refresh"})]})]})]}),u.jsxs("div",{className:"terminal-carriers-body",children:[u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),u.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),u.jsxs("div",{className:"terminal-carriers-runtime",children:[u.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:u.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"terminal-carriers-select",value:e.draft.cliType,onChange:x=>kF(x.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(x=>u.jsx("option",{value:x.id,children:x.displayName},x.id))})]})}),u.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[u.jsx(TR,{id:"carrier-model",label:"Model",models:n.models,value:e.draft.model,onChange:x=>EF(n,x)}),u.jsx(AR,{id:"carrier-effort",model:i,value:e.draft.effort,onChange:x=>zl({effort:x})})]})]})]}),t.taskForceCapable?u.jsx(CF,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:c,onRowsChange:d}):null]})]},t.carrierId):u.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[u.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{Y_()},children:"Refresh"})]})]})}function xF({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return u.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:RR(e.carrierId),onClick:i,children:[u.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),u.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?u.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function TR({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:i,disabled:r,onChange:c=>o(c.target.value),children:n.map(c=>u.jsx("option",{value:c.modelId,children:c.name},c.modelId))})]})}function AR({id:e,model:t,value:n,disabled:i=!1,onChange:r}){return t?.effort?u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:n||t.effort.default,disabled:i,onChange:o=>r(o.target.value),children:t.effort.levels.map(o=>u.jsx("option",{value:o,children:o},o))})]}):u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),u.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]})}function CF({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,rows:r,onRowsChange:o}){const c=xR(),d=e.taskforce.backends.length,[p,f]=y.useState(d>0),[g,_]=y.useState(!1),[b,S]=y.useState(""),w=e.taskforce.backends.length>=n,x=t.filter(O=>!r.includes(O.id)),C=b||x[0]?.id||"";return u.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${p?"is-expanded":""}`,children:[u.jsxs("div",{className:"terminal-carriers-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),u.jsx("p",{className:"terminal-carriers-help",children:d>0?`${d} backend${d===1?"":"s"} configured${w?" · active":` · needs ${n}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${n} to activate.`})]}),u.jsx("div",{className:"terminal-carriers-tf-head-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":p,onClick:()=>f(O=>!O),children:p?"Hide":"Configure"})})]}),p?u.jsxs("div",{className:"terminal-carriers-tf-list",children:[r.length===0?u.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend drafted."}):null,r.map(O=>{const P=t.find(M=>M.id===O);if(!P)return null;const z=c.draft.taskforce[P.id]??{model:P.defaultModel,effort:""},T=P.models.find(M=>M.modelId===z.model)??P.models[0]??null,j=e.taskforce.backends.some(M=>M.cliType===P.id);return u.jsxs("div",{className:`terminal-carriers-tf-item ${j?"is-active":""}`,children:[u.jsxs("div",{className:"terminal-carriers-tf-title",children:[u.jsx("span",{className:`terminal-carriers-live-dot ${j?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:P.displayName})]}),u.jsx(TR,{id:`tf-${P.id}-model`,label:"Model",models:P.models,value:z.model,onChange:M=>TF(P,M)}),u.jsx(AR,{id:`tf-${P.id}-effort`,model:T,value:z.effort,onChange:M=>eb(P.id,{effort:M})}),u.jsx("div",{className:"terminal-carriers-tf-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:i==="save-all",onClick:()=>o(r.filter(M=>M!==P.id)),children:"Remove"})})]},P.id)}),u.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[g&&x.length>0?u.jsx("select",{className:"terminal-carriers-select terminal-carriers-tf-add-select",value:C,onChange:O=>S(O.target.value),"aria-label":"Task Force CLI to add",children:x.map(O=>u.jsx("option",{value:O.id,children:O.displayName},O.id))}):null,u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:x.length===0||i==="save-all",onClick:()=>{if(!g){_(!0);return}const O=C,P=t.find(T=>T.id===O),z=P?.models.find(T=>T.modelId===P.defaultModel)??P?.models[0]??null;!P||!z||(eb(P.id,{model:z.modelId,effort:z.effort?.default??""}),o(r.includes(P.id)?r:[...r,P.id]),S(""),_(!1))},children:"Add"})]})]}):null]})}function kF(e,t){const n=t.find(r=>r.id===e),i=n?.models.find(r=>r.modelId===n.defaultModel)??n?.models[0]??null;zl({cliType:e,model:i?.modelId??"",effort:i?.effort?.default??""})}function EF(e,t){const n=e.models.find(i=>i.modelId===t);zl({model:t,effort:n?.effort?.default??""})}function TF(e,t){const n=e.models.find(i=>i.modelId===t);eb(e.id,{model:t,effort:n?.effort?.default??""})}function AF(e,t,n){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:RF(e,n,t.taskforce)}function RF(e,t,n){if(t.length!==e.taskforce.backends.length)return!0;const i=new Set(t);for(const r of e.taskforce.backends){if(!i.has(r.cliType))return!0;const o=n[r.cliType];if(!o||o.model!==r.model||(o.effort||"")!==(r.effort||""))return!0}return!1}function NF(e,t){return e.map(n=>{const i=t[n];return i?{cliType:n,model:i.model,...i.effort?{effort:i.effort}:{}}:null}).filter(n=>n!==null)}function RR(e){return{"--cap-color":bF[e]??"var(--brass)"}}function LF(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function MF(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function OF(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const DF="global-shell",jF="/plugins/terminal/global/ticket",IF="/plugins/terminal/ws",BF=168,PF={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},$F={id:"global-shell",title:"Shell",icon:zF,preferredExtraWidth:BF,render:e=>u.jsx("div",{style:PF,children:u.jsx(b0,{operationId:DF,ticketPath:jF,wsPath:IF,theme:"instrument",active:!0})})};function zF(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const HF="/plugins/terminal/shell/ticket",FF="/plugins/terminal/ws",NR={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>y.createElement(UF,{context:e})},X_={id:"terminal",operationKinds:[NR],install:()=>{},closeOperation:async e=>{await fetch(`/plugins/terminal/shell/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},launch:async({theaterId:e,operations:t})=>({id:(await t.create({theaterId:e,type:"shell",pluginId:"terminal",title:"Shell",payload:{theaterId:e}})).id}),renderLaunchIcon:()=>u.jsx(WF,{})};function UF({context:e}){return u.jsx(b0,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:HF,wsPath:FF,theme:e.theme,onExit:e.onClose})}function WF(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),u.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const qF=new Set(["agent"]),GF={id:"terminal",operationKinds:[NR,mR],settingsSections:[gR,_R,SF],notificationKinds:[vR],railPanels:[$F],install:e=>(zA(),$$(e.settings),tf.install?.(e)),closeOperation:async e=>{const t=await VF(e);if(t?.type==="shell"){await X_.closeOperation?.(e);return}t&&qF.has(t.type)&&await tf.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?X_.launch?.(e)??{id:""}:tf.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?X_.renderLaunchIcon?.(e):tf.renderLaunchIcon?.(e)},KF=[GF];async function VF(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const n=await t.json();return typeof n.operation?.type=="string"?{type:n.operation.type}:null}const Q={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"},YF={src:Q.ts,lib:Q.ts,app:Q.ts,test:Q.shell,tests:Q.shell,__tests__:Q.shell,spec:Q.shell,specs:Q.shell,node_modules:Q.binary,vendor:Q.binary,dist:Q.config,build:Q.config,out:Q.config,target:Q.config,docs:Q.md,doc:Q.md,public:Q.data,assets:Q.data,static:Q.data,components:Q.image,scripts:Q.js,styles:Q.css,".git":Q.html,".github":Q.config,".vscode":Q.css},i2={ts:{shape:"angle",tone:Q.ts},tsx:{shape:"angle",tone:Q.ts},mts:{shape:"angle",tone:Q.ts},cts:{shape:"angle",tone:Q.ts},"d.ts":{shape:"angle",tone:Q.ts},js:{shape:"angle",tone:Q.js},jsx:{shape:"angle",tone:Q.js},mjs:{shape:"angle",tone:Q.js},cjs:{shape:"angle",tone:Q.js},json:{shape:"braces",tone:Q.json},jsonc:{shape:"braces",tone:Q.json},json5:{shape:"braces",tone:Q.json},jsonl:{shape:"braces",tone:Q.json},graphql:{shape:"braces",tone:Q.image},gql:{shape:"braces",tone:Q.image},proto:{shape:"braces",tone:Q.go},css:{shape:"hash",tone:Q.css},scss:{shape:"hash",tone:Q.css},sass:{shape:"hash",tone:Q.css},less:{shape:"hash",tone:Q.css},styl:{shape:"hash",tone:Q.css},html:{shape:"markup",tone:Q.html},htm:{shape:"markup",tone:Q.html},xml:{shape:"markup",tone:Q.html},xhtml:{shape:"markup",tone:Q.html},vue:{shape:"markup",tone:Q.shell},svelte:{shape:"markup",tone:Q.rust},astro:{shape:"markup",tone:Q.image},md:{shape:"doc",tone:Q.md},mdx:{shape:"doc",tone:Q.md},markdown:{shape:"doc",tone:Q.md},rst:{shape:"doc",tone:Q.md},txt:{shape:"doc",tone:Q.default},text:{shape:"doc",tone:Q.default},log:{shape:"doc",tone:Q.default},adoc:{shape:"doc",tone:Q.md},pdf:{shape:"doc",tone:Q.ruby},py:{shape:"angle",tone:Q.py},pyi:{shape:"angle",tone:Q.py},pyw:{shape:"angle",tone:Q.py},go:{shape:"angle",tone:Q.go},rs:{shape:"angle",tone:Q.rust},rb:{shape:"angle",tone:Q.ruby},rake:{shape:"angle",tone:Q.ruby},gemspec:{shape:"angle",tone:Q.ruby},java:{shape:"angle",tone:Q.html},kt:{shape:"angle",tone:Q.config},kts:{shape:"angle",tone:Q.config},scala:{shape:"angle",tone:Q.ruby},c:{shape:"angle",tone:Q.ts},h:{shape:"angle",tone:Q.ts},cpp:{shape:"angle",tone:Q.css},cc:{shape:"angle",tone:Q.css},cxx:{shape:"angle",tone:Q.css},hpp:{shape:"angle",tone:Q.css},cs:{shape:"angle",tone:Q.config},php:{shape:"angle",tone:Q.config},swift:{shape:"angle",tone:Q.html},lua:{shape:"angle",tone:Q.ts},dart:{shape:"angle",tone:Q.go},sh:{shape:"terminal",tone:Q.shell},bash:{shape:"terminal",tone:Q.shell},zsh:{shape:"terminal",tone:Q.shell},fish:{shape:"terminal",tone:Q.shell},ps1:{shape:"terminal",tone:Q.css},bat:{shape:"terminal",tone:Q.shell},cmd:{shape:"terminal",tone:Q.shell},yaml:{shape:"gear",tone:Q.config},yml:{shape:"gear",tone:Q.config},toml:{shape:"gear",tone:Q.config},ini:{shape:"gear",tone:Q.config},conf:{shape:"gear",tone:Q.config},cfg:{shape:"gear",tone:Q.config},properties:{shape:"gear",tone:Q.config},env:{shape:"gear",tone:Q.config},editorconfig:{shape:"gear",tone:Q.config},png:{shape:"image",tone:Q.image},jpg:{shape:"image",tone:Q.image},jpeg:{shape:"image",tone:Q.image},gif:{shape:"image",tone:Q.image},webp:{shape:"image",tone:Q.image},svg:{shape:"image",tone:Q.image},ico:{shape:"image",tone:Q.image},bmp:{shape:"image",tone:Q.image},avif:{shape:"image",tone:Q.image},tiff:{shape:"image",tone:Q.image},heic:{shape:"image",tone:Q.image},mp4:{shape:"image",tone:Q.data},mov:{shape:"image",tone:Q.data},webm:{shape:"image",tone:Q.data},mkv:{shape:"image",tone:Q.data},mp3:{shape:"chip",tone:Q.shell},wav:{shape:"chip",tone:Q.shell},flac:{shape:"chip",tone:Q.shell},ogg:{shape:"chip",tone:Q.shell},sql:{shape:"database",tone:Q.data},csv:{shape:"database",tone:Q.data},tsv:{shape:"database",tone:Q.data},db:{shape:"database",tone:Q.data},sqlite:{shape:"database",tone:Q.data},sqlite3:{shape:"database",tone:Q.data},parquet:{shape:"database",tone:Q.data},zip:{shape:"archive",tone:Q.archive},tar:{shape:"archive",tone:Q.archive},gz:{shape:"archive",tone:Q.archive},tgz:{shape:"archive",tone:Q.archive},bz2:{shape:"archive",tone:Q.archive},xz:{shape:"archive",tone:Q.archive},rar:{shape:"archive",tone:Q.archive},"7z":{shape:"archive",tone:Q.archive},zst:{shape:"archive",tone:Q.archive},bin:{shape:"chip",tone:Q.binary},exe:{shape:"chip",tone:Q.binary},dll:{shape:"chip",tone:Q.binary},so:{shape:"chip",tone:Q.binary},dylib:{shape:"chip",tone:Q.binary},wasm:{shape:"chip",tone:Q.config},class:{shape:"chip",tone:Q.binary},lock:{shape:"chip",tone:Q.binary},woff:{shape:"chip",tone:Q.config},woff2:{shape:"chip",tone:Q.config},ttf:{shape:"chip",tone:Q.config},otf:{shape:"chip",tone:Q.config}},XF={dockerfile:{shape:"chip",tone:Q.css},"docker-compose.yml":{shape:"gear",tone:Q.css},"docker-compose.yaml":{shape:"gear",tone:Q.css},makefile:{shape:"gear",tone:Q.html},"cmakelists.txt":{shape:"gear",tone:Q.html},".gitignore":{shape:"gear",tone:Q.html},".gitattributes":{shape:"gear",tone:Q.html},".dockerignore":{shape:"gear",tone:Q.html},".npmignore":{shape:"gear",tone:Q.html},".npmrc":{shape:"gear",tone:Q.ruby},"package.json":{shape:"braces",tone:Q.shell},"tsconfig.json":{shape:"braces",tone:Q.ts},license:{shape:"doc",tone:Q.json},"license.md":{shape:"doc",tone:Q.json},licence:{shape:"doc",tone:Q.json}},ZF={shape:"default",tone:Q.default},tb={angle:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),u.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),u.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:u.jsxs(u.Fragment,{children:[u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function JF({name:e}){const t=eU(e);return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:tb[t.shape]})}function QF({name:e,open:t}){const n=YF[e.toLowerCase()]??Q.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?tb.folderOpen:tb.folderClosed})}function eU(e){const t=e.toLowerCase(),n=XF[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:Q.config};if(t.startsWith("readme"))return{shape:"doc",tone:Q.md};if(t.endsWith(".d.ts"))return i2["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=i2[r];if(o)return o}return ZF}function tU(e,t){return`${e??""}:${t??""}`}function nb(e,t){const n=dp(t);if(n===null)return null;const i=e?dp(e):"";return i===null?null:i?n?`${i}/${n}`:i:n}function Df(e,t){const n=dp(t),i=e?dp(e):"";return n===null||i===null?null:i?n===i?"":n.startsWith(`${i}/`)?n.slice(i.length+1):null:n}function LR(e,t){const n=Df(e,t.relativePath);if(n===null)return null;const i=n===""||t.parentRelativePath===null?null:Df(e,t.parentRelativePath);if(n!==""&&t.parentRelativePath!==null&&i===null)return null;const r=[];for(const o of t.entries){const c=Df(e,o.relativePath);c!==null&&r.push({...o,relativePath:c})}return{...t,relativePath:n,parentRelativePath:i,entries:r}}function nU(e,t){return Df(e,t)}function dp(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const n of e.replaceAll("\\","/").split("/"))if(!(!n||n===".")){if(n==="..")return null;t.push(n)}return t.join("/")}const iU=200,nf=30,s2=5,MR="fleet-console.fileExplorer.showHidden",r2=500;function Us(e,t){return e===t}async function sU({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const c=[],d=new Map(t),p=new Set,f=new Set;let g=0;const _=b=>{for(const S of b)if(!(!aU(S,i)||p.has(S.relativePath))){if(p.size>=r2)return;p.add(S.relativePath),c.push(S)}};for(_(e);c.length>0&&r();){const b=c.shift();if(!b)return;const S=d.get(b.relativePath);if(S){if(f.has(S.relativePath))continue;f.add(S.relativePath),_(S.entries);continue}if(g>=r2)return;g+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(d.set(b.relativePath,w),o(b.relativePath,w),f.has(w.relativePath))continue;f.add(w.relativePath),_(w.entries)}catch{}}}function OR(e,t,n,i,r,o,c,d,p=new Set){const f=[];for(const g of e){if(!d&&g.name.startsWith("."))continue;const _=o.get(g.relativePath),b=_?.entries,S=_?.relativePath??g.relativePath,w=g.kind==="dir"&&p.has(S),x=g.kind==="dir"&&!w&&DR(b??[],o,c,d);if(c&&!g.name.toLowerCase().includes(c)&&!x)continue;const C=i.has(g.relativePath)||!!(c&&x);if(f.push({entry:g,depth:t,isSelected:n===g.relativePath,isExpanded:C,isLoading:r.has(g.relativePath)}),g.kind==="dir"&&C&&!w&&b){const O=new Set(p);O.add(S),f.push(...OR(b,t+1,n,i,r,o,c,d,O))}}return f}function rU({contextKey:e,contextRelPath:t,files:n,theaterId:i,selectedPath:r,onSelect:o}){const[c,d]=y.useState(null),[p,f]=y.useState(null),[g,_]=y.useState(""),[b,S]=y.useState(new Set),[w,x]=y.useState(new Set),[C,O]=y.useState(new Map),[P,z]=y.useState(""),[T,j]=y.useState(0),[M,H]=y.useState(600),[F,ee]=y.useState(()=>oU()),ae=y.useRef(null),K=y.useRef(b);K.current=b;const B=y.useRef(g);B.current=g;const N=y.useRef(n);N.current=n;const R=y.useRef(e);R.current=e;const A=y.useRef(C);A.current=C;const E=y.useRef(0),L=!!P;y.useEffect(()=>{i&&(d(null),f(null),_(""),S(new Set),O(new Map),z(""),j(0))},[e,i]),y.useEffect(()=>{if(!i)return;const Re=e;n.listFolder(g||void 0).then(xe=>{Us(Re,R.current)&&(d(xe),f(null))}).catch(xe=>{Us(Re,R.current)&&f(xe instanceof Error?xe.message:"Unable to load folder")})},[e,i,g,n]),y.useEffect(()=>{const Re=++E.current;if(!L||!c)return;let xe=!0;const ze=e,le=()=>xe&&Re===E.current&&Us(ze,R.current);return sU({entries:c.entries,cachedResults:A.current,files:n,showHidden:F,isCurrent:le,onFolderResult:(We,Le)=>{le()&&O(it=>new Map(it).set(We,Le))}}),()=>{xe=!1}},[e,n,L,c,F]),y.useEffect(()=>{const Re=ae.current;if(!Re)return;const xe=new ResizeObserver(()=>H(Re.clientHeight));return xe.observe(Re),H(Re.clientHeight),()=>xe.disconnect()},[]),y.useEffect(()=>{if(!i)return;let Re=!0;const xe=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(i)}`,ze=new EventSource(xe),le=()=>{const Le=e;N.current.listFolder(B.current||void 0).then(it=>{Us(Le,R.current)&&(d(it),f(null))}).catch(()=>{})},We=()=>{le();for(const Le of K.current){const it=e;N.current.listFolder(Le).then(bt=>{Us(it,R.current)&&O(je=>new Map(je).set(Le,bt))}).catch(()=>{})}};return ze.addEventListener("change",Le=>{let it;try{it=JSON.parse(Le.data)}catch{return}if(typeof it!="string")return;const bt=nU(t,it);if(bt!==null&&((bt===""||bt===B.current)&&le(),bt!==""&&K.current.has(bt))){const je=e;N.current.listFolder(bt).then(dt=>{Us(je,R.current)&&O(we=>new Map(we).set(bt,dt))}).catch(()=>{})}}),ze.onopen=()=>{if(Re){Re=!1;return}We()},()=>{ze.close()}},[t,i,n]);const $=y.useCallback(Re=>{const xe=Re.relativePath,ze=!b.has(xe);if(S(le=>{const We=new Set(le);return We.has(xe)?(We.delete(xe),We):(We.add(xe),We)}),ze){const le=e;x(We=>new Set(We).add(xe)),n.listFolder(xe).then(We=>{Us(le,R.current)&&(O(Le=>new Map(Le).set(xe,We)),x(Le=>{const it=new Set(Le);return it.delete(xe),it}))}).catch(()=>{Us(le,R.current)&&x(We=>{const Le=new Set(We);return Le.delete(xe),Le})})}},[e,n,b]),q=y.useCallback(Re=>{Re.kind==="dir"?$(Re):o(Re)},[$,o]),X=y.useCallback(Re=>{j(Re.currentTarget.scrollTop)},[]),D=y.useCallback(()=>{ee(Re=>{const xe=!Re;try{localStorage.setItem(MR,xe?"1":"0")}catch{}return xe})},[]),V=y.useCallback(()=>{if(!i)return;const Re=e;n.listFolder(g||void 0).then(xe=>{Us(Re,R.current)&&(d(xe),f(null))}).catch(xe=>{Us(Re,R.current)&&f(xe instanceof Error?xe.message:"Unable to load folder")});for(const xe of b)n.listFolder(xe).then(ze=>{Us(Re,R.current)&&O(le=>new Map(le).set(xe,ze))}).catch(()=>{})},[e,n,g,b,i]),J=P.toLowerCase(),ce=y.useMemo(()=>c?OR(c.entries,0,r,b,w,C,J,F):[],[c,r,b,w,C,J,F]),ie=!F&&c!==null&&c.entries.length>0&&ce.length===0&&!P,ve=ce.length>iU,Se=ve?Math.max(0,Math.floor(T/nf)-s2):0,Oe=ve?Math.min(ce.length,Math.ceil((T+M)/nf)+s2):ce.length,Ne=ce.slice(Se,Oe),ct=ce.length*nf,Ze=Se*nf;return i?p&&!c?u.jsx("div",{className:"fexp-tree-error",children:p}):c?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:P,onChange:Re=>z(Re.target.value),"aria-label":"Filter files"}),P&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>z(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:V,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${F?" is-active":""}`,onClick:D,"aria-pressed":F,"aria-label":F?"Hide hidden files":"Show hidden files",title:F?"Hide hidden files":"Show hidden files",children:F?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:ae,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:ve?X:void 0,children:[!1,ve?u.jsx("div",{style:{height:ct,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${Ze}px)`},children:Ne.map(Re=>u.jsx(a2,{row:Re,onEntryClick:q},Re.entry.relativePath))})}):Ne.map(Re=>u.jsx(a2,{row:Re,onEntryClick:q},Re.entry.relativePath)),ce.length===0&&P&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),ce.length===0&&!P&&c.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),ie&&u.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):u.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function DR(e,t,n,i,r=new Set){for(const o of e)if(!(!i&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(n))return!0;if(o.kind==="dir"){const c=t.get(o.relativePath);if(c&&!r.has(c.relativePath)){const d=new Set(r);if(d.add(c.relativePath),DR(c.entries,t,n,i,d))return!0}}}return!1}function aU(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function a2({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:c}=e,d=n.kind==="dir",p=i*16,f=y.useCallback(()=>t(n),[n,t]);return u.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${d?" is-dir":" is-file"}`,style:{paddingLeft:`${p+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":d?o:void 0,onClick:f,children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:d?u.jsx(QF,{name:n.name,open:o}):u.jsx(JF,{name:n.name})}),u.jsx("span",{className:"fexp-tree-name",children:n.name}),c&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function oU(){try{return localStorage.getItem(MR)==="1"}catch{return!1}}function lU({name:e,sizeHint:t}){return u.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[u.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),u.jsx("p",{className:"fexp-bin-name",children:e}),t&&u.jsx("p",{className:"fexp-bin-meta",children:t}),u.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function cU(e,t){switch(t){case"typescript":case"javascript":return hU(e);case"json":return dU(e);case"python":return pU(e);case"css":case"scss":case"sass":case"less":return mU(e);case"html":case"xml":return gU(e);case"bash":case"shell":return _U(e);case"yaml":return vU(e);default:return[{kind:"text",value:e}]}}const uU=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 hU(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
107
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=Wa(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])||e[n]==="."&&/[0-9]/.test(e[n+1]??"")){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_$]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_$][\w$]*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);uU.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}function dU(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=Wa(e,n,'"','"'),c=e.slice(n+r).trimStart().startsWith(":");t.push({kind:c?"attr":"str",value:i}),n+=r;continue}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(e.startsWith("true",n)||e.startsWith("false",n)||e.startsWith("null",n)){const i=e.slice(n).match(/^(true|false|null)/);if(i){t.push({kind:"key",value:i[0]}),n+=i[0].length;continue}}if(/[{}[\]:,]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}const fU=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 pU(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
108
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_]\w*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);fU.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function mU(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
109
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==="."||e[n]==="#"||e[n]===":"){const i=e.slice(n).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(i){t.push({kind:"tag",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z-]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z-][\w-]*/);if(i){const r=i[0];e.slice(n+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function gU(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),r=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="<"){t.push({kind:"punct",value:"<"}),n++,e[n]==="/"&&(t.push({kind:"punct",value:"/"}),n++);const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);i&&(t.push({kind:"tag",value:i[0]}),n+=i[0].length);continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const r=e.slice(n+i[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function _U(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
|
|
110
|
-
`,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:r}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const r=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:i.has(r[0])?"key":"text",value:r[0]}),n+=r[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function vU(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
111
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_][\w-]*/);if(i){e.slice(n+i[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:i[0]}):["true","false","null","yes","no","on","off"].includes(i[0])?t.push({kind:"key",value:i[0]}):t.push({kind:"text",value:i[0]}),n+=i[0].length;continue}}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function Wa(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
|
|
112
|
-
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function yU({content:e,lang:t,truncated:n}){const i=y.useMemo(()=>bU(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[n&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:i.map((r,o)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function bU(e,t){return e.split(`
|
|
113
|
-
`).map(i=>SU(i,t))}function SU(e,t){return t==="plaintext"||t==="markdown"?o2(e)||" ":cU(e,t).map(i=>{const r=o2(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function o2(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wU({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function M0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fo=M0();function jR(e){Fo=e}var Vu={exec:()=>null};function jt(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let c=typeof o=="string"?o:o.source;return c=c.replace(ji.caret,"$1"),n=n.replace(r,c),i},getRegex:()=>new RegExp(n,t)};return i}var xU=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ji={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")},CU=/^(?:[ \t]*(?:\n|$))+/,kU=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,EU=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Th=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,TU=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,O0=/(?:[*+-]|\d{1,9}[.)])/,IR=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,BR=jt(IR).replace(/bull/g,O0).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(),AU=jt(IR).replace(/bull/g,O0).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(),D0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,RU=/^[^\n]+/,j0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,NU=jt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",j0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LU=jt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,O0).getRegex(),qp="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",I0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,MU=jt("^ {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",I0).replace("tag",qp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),PR=jt(D0).replace("hr",Th).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",qp).getRegex(),OU=jt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",PR).getRegex(),B0={blockquote:OU,code:kU,def:NU,fences:EU,heading:TU,hr:Th,html:MU,lheading:BR,list:LU,newline:CU,paragraph:PR,table:Vu,text:RU},l2=jt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Th).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",qp).getRegex(),DU={...B0,lheading:AU,table:l2,paragraph:jt(D0).replace("hr",Th).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",l2).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",qp).getRegex()},jU={...B0,html:jt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",I0).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:Vu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:jt(D0).replace("hr",Th).replace("heading",` *#{1,6} *[^
|
|
114
|
-
]`).replace("lheading",BR).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},IU=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,BU=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$R=/^( {2,}|\\)\n(?!\s*$)/,PU=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Gp=/[\p{P}\p{S}]/u,P0=/[\s\p{P}\p{S}]/u,zR=/[^\s\p{P}\p{S}]/u,$U=jt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,P0).getRegex(),HR=/(?!~)[\p{P}\p{S}]/u,zU=/(?!~)[\s\p{P}\p{S}]/u,HU=/(?:[^\s\p{P}\p{S}]|~)/u,FU=jt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xU?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),FR=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,UU=jt(FR,"u").replace(/punct/g,Gp).getRegex(),WU=jt(FR,"u").replace(/punct/g,HR).getRegex(),UR="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qU=jt(UR,"gu").replace(/notPunctSpace/g,zR).replace(/punctSpace/g,P0).replace(/punct/g,Gp).getRegex(),GU=jt(UR,"gu").replace(/notPunctSpace/g,HU).replace(/punctSpace/g,zU).replace(/punct/g,HR).getRegex(),KU=jt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zR).replace(/punctSpace/g,P0).replace(/punct/g,Gp).getRegex(),VU=jt(/\\(punct)/,"gu").replace(/punct/g,Gp).getRegex(),YU=jt(/^<(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(),XU=jt(I0).replace("(?:-->|$)","-->").getRegex(),ZU=jt("^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",XU).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,JU=jt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",fp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),WR=jt(/^!?\[(label)\]\[(ref)\]/).replace("label",fp).replace("ref",j0).getRegex(),qR=jt(/^!?\[(ref)\](?:\[\])?/).replace("ref",j0).getRegex(),QU=jt("reflink|nolink(?!\\()","g").replace("reflink",WR).replace("nolink",qR).getRegex(),c2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,$0={_backpedal:Vu,anyPunctuation:VU,autolink:YU,blockSkip:FU,br:$R,code:BU,del:Vu,emStrongLDelim:UU,emStrongRDelimAst:qU,emStrongRDelimUnd:KU,escape:IU,link:JU,nolink:qR,punctuation:$U,reflink:WR,reflinkSearch:QU,tag:ZU,text:PU,url:Vu},eW={...$0,link:jt(/^!?\[(label)\]\((.*?)\)/).replace("label",fp).getRegex(),reflink:jt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fp).getRegex()},ib={...$0,emStrongRDelimAst:GU,emStrongLDelim:WU,url:jt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",c2).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:jt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",c2).getRegex()},tW={...ib,br:jt($R).replace("{2,}","*").getRegex(),text:jt(ib.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},sf={normal:B0,gfm:DU,pedantic:jU},yu={normal:$0,gfm:ib,breaks:tW,pedantic:eW},nW={"&":"&","<":"<",">":">",'"':""","'":"'"},u2=e=>nW[e];function ar(e,t){if(t){if(ji.escapeTest.test(e))return e.replace(ji.escapeReplace,u2)}else if(ji.escapeTestNoEncode.test(e))return e.replace(ji.escapeReplaceNoEncode,u2);return e}function h2(e){try{e=encodeURI(e).replace(ji.percentDecode,"%")}catch{return null}return e}function d2(e,t){let n=e.replace(ji.findPipe,(o,c,d)=>{let p=!1,f=c;for(;--f>=0&&d[f]==="\\";)p=!p;return p?"|":" |"}),i=n.split(ji.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(ji.slashPipe,"|");return i}function bu(e,t,n){let i=e.length;if(i===0)return"";let r=0;for(;r<i&&e.charAt(i-r-1)===t;)r++;return e.slice(0,i-r)}function iW(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function f2(e,t,n,i,r){let o=t.href,c=t.title||null,d=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:c,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,p}function sW(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
115
|
-
`).map(o=>{let c=o.match(n.other.beginningSpace);if(c===null)return o;let[d]=c;return d.length>=r.length?o.slice(r.length):o}).join(`
|
|
116
|
-
`)}var pp=class{options;rules;lexer;constructor(e){this.options=e||Fo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:bu(n,`
|
|
117
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=sW(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=bu(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:bu(t[0],`
|
|
118
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=bu(t[0],`
|
|
119
|
-
`).split(`
|
|
120
|
-
`),i="",r="",o=[];for(;n.length>0;){let c=!1,d=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))d.push(n[p]),c=!0;else if(!c)d.push(n[p]);else break;n=n.slice(p);let f=d.join(`
|
|
121
|
-
`),g=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
122
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
123
|
-
${f}`:f,r=r?`${r}
|
|
124
|
-
${g}`:g;let _=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,o,!0),this.lexer.state.top=_,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
|
|
125
|
-
`+n.join(`
|
|
126
|
-
`),x=this.blockquote(w);o[o.length-1]=x,i=i.substring(0,i.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
|
|
127
|
-
`+n.join(`
|
|
128
|
-
`),x=this.list(w);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,n=w.substring(o.at(-1).raw.length).split(`
|
|
129
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),c=!1;for(;e;){let p=!1,f="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let _=t[2].split(`
|
|
130
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,O=>" ".repeat(3*O.length)),b=e.split(`
|
|
131
|
-
`,1)[0],S=!_.trim(),w=0;if(this.options.pedantic?(w=2,g=_.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=_.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(b)&&(f+=b+`
|
|
132
|
-
`,e=e.substring(b.length+1),p=!0),!p){let O=this.rules.other.nextBulletRegex(w),P=this.rules.other.hrRegex(w),z=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),j=this.rules.other.htmlBeginRegex(w);for(;e;){let M=e.split(`
|
|
133
|
-
`,1)[0],H;if(b=M,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),H=b):H=b.replace(this.rules.other.tabCharGlobal," "),z.test(b)||T.test(b)||j.test(b)||O.test(b)||P.test(b))break;if(H.search(this.rules.other.nonSpaceChar)>=w||!b.trim())g+=`
|
|
134
|
-
`+H.slice(w);else{if(S||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(_)||T.test(_)||P.test(_))break;g+=`
|
|
135
|
-
`+b}!S&&!b.trim()&&(S=!0),f+=M+`
|
|
136
|
-
`,e=e.substring(M.length+1),_=H.slice(w)}}r.loose||(c?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0));let x=null,C;this.options.gfm&&(x=this.rules.other.listIsTask.exec(g),x&&(C=x[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!x,checked:C,loose:!1,text:g,tokens:[]}),r.raw+=f}let d=r.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let p=0;p<r.items.length;p++)if(this.lexer.state.top=!1,r.items[p].tokens=this.lexer.blockTokens(r.items[p].text,[]),!r.loose){let f=r.items[p].tokens.filter(_=>_.type==="space"),g=f.length>0&&f.some(_=>this.rules.other.anyLine.test(_.raw));r.loose=g}if(r.loose)for(let p=0;p<r.items.length;p++)r.items[p].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=d2(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
137
|
-
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let c of i)this.rules.other.tableAlignRight.test(c)?o.align.push("right"):this.rules.other.tableAlignCenter.test(c)?o.align.push("center"):this.rules.other.tableAlignLeft.test(c)?o.align.push("left"):o.align.push(null);for(let c=0;c<n.length;c++)o.header.push({text:n[c],tokens:this.lexer.inline(n[c]),header:!0,align:o.align[c]});for(let c of r)o.rows.push(d2(c,o.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[p]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
138
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=bu(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=iW(t[2],"()");if(o===-2)return;if(o>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),f2(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return f2(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,o,c,d=r,p=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(c=[...o].length,i[3]||i[4]){d+=c;continue}else if((i[5]||i[6])&&r%3&&!((r+c)%3)){p+=c;continue}if(d-=c,d>0)continue;c=Math.min(c,c+d+p);let g=[...i[0]][0].length,_=e.slice(0,r+i.index+g+c);if(Math.min(r,c)%2){let S=_.slice(1,-1);return{type:"em",raw:_,text:S,tokens:this.lexer.inlineTokens(S)}}let b=_.slice(2,-2);return{type:"strong",raw:_,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Ws=class sb{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Fo,this.options.tokenizer=this.options.tokenizer||new pp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:ji,block:sf.normal,inline:yu.normal};this.options.pedantic?(n.block=sf.pedantic,n.inline=yu.pedantic):this.options.gfm&&(n.block=sf.gfm,this.options.breaks?n.inline=yu.breaks:n.inline=yu.gfm),this.tokenizer.rules=n}static get rules(){return{block:sf,inline:yu}}static lex(t,n){return new sb(n).lex(t)}static lexInline(t,n){return new sb(n).inlineTokens(t)}lex(t){t=t.replace(ji.carriageReturn,`
|
|
139
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace(ji.tabCharGlobal," ").replace(ji.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let c=n.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
140
|
-
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
141
|
-
`)?"":`
|
|
142
|
-
`)+r.raw,c.text+=`
|
|
143
|
-
`+r.text,this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
144
|
-
`)?"":`
|
|
145
|
-
`)+r.raw,c.text+=`
|
|
146
|
-
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let o=t;if(this.options.extensions?.startBlock){let c=1/0,d=t.slice(1),p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(o=t.substring(0,c+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let c=n.at(-1);i&&c?.type==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
147
|
-
`)?"":`
|
|
148
|
-
`)+r.raw,c.text+=`
|
|
149
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r),i=o.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
150
|
-
`)?"":`
|
|
151
|
-
`)+r.raw,c.text+=`
|
|
152
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,r=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=r[2]?r[2].length:0,i=i.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let c=!1,d="";for(;t;){c||(d=""),c=!1;let p;if(this.options.extensions?.inline?.some(g=>(p=g.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let g=n.at(-1);p.type==="text"&&g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,i,d)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let f=t;if(this.options.extensions?.startInline){let g=1/0,_=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},_),typeof b=="number"&&b>=0&&(g=Math.min(g,b))}),g<1/0&&g>=0&&(f=t.substring(0,g+1))}if(p=this.tokenizer.inlineText(f)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(d=p.raw.slice(-1)),c=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},mp=class{options;parser;constructor(e){this.options=e||Fo}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(ji.notSpaceStart)?.[0],r=e.replace(ji.endingNewline,"")+`
|
|
153
|
-
`;return i?'<pre><code class="language-'+ar(i)+'">'+(n?r:ar(r,!0))+`</code></pre>
|
|
154
|
-
`:"<pre><code>"+(n?r:ar(r,!0))+`</code></pre>
|
|
155
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
156
|
-
${this.parser.parse(e)}</blockquote>
|
|
157
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
158
|
-
`}hr(e){return`<hr>
|
|
159
|
-
`}list(e){let t=e.ordered,n=e.start,i="";for(let c=0;c<e.items.length;c++){let d=e.items[c];i+=this.listitem(d)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
160
|
-
`+i+"</"+r+`>
|
|
161
|
-
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+ar(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
162
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
163
|
-
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let c=0;c<o.length;c++)n+=this.tablecell(o[c]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
164
|
-
<thead>
|
|
165
|
-
`+t+`</thead>
|
|
166
|
-
`+i+`</table>
|
|
167
|
-
`}tablerow({text:e}){return`<tr>
|
|
168
|
-
${e}</tr>
|
|
169
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
170
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ar(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=h2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+ar(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=h2(e);if(r===null)return ar(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${ar(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ar(e.text)}},z0=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""}},qs=class rb{options;renderer;textRenderer;constructor(t){this.options=t||Fo,this.options.renderer=this.options.renderer||new mp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new z0}static parse(t,n){return new rb(n).parse(t)}static parseInline(t,n){return new rb(n).parseInline(t)}parse(t,n=!0){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=o,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){i+=p||"";continue}}let c=o;switch(c.type){case"space":{i+=this.renderer.space(c);continue}case"hr":{i+=this.renderer.hr(c);continue}case"heading":{i+=this.renderer.heading(c);continue}case"code":{i+=this.renderer.code(c);continue}case"table":{i+=this.renderer.table(c);continue}case"blockquote":{i+=this.renderer.blockquote(c);continue}case"list":{i+=this.renderer.list(c);continue}case"html":{i+=this.renderer.html(c);continue}case"def":{i+=this.renderer.def(c);continue}case"paragraph":{i+=this.renderer.paragraph(c);continue}case"text":{let d=c,p=this.renderer.text(d);for(;r+1<t.length&&t[r+1].type==="text";)d=t[++r],p+=`
|
|
171
|
-
`+this.renderer.text(d);n?i+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):i+=p;continue}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}parseInline(t,n=this.renderer){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=this.options.extensions.renderers[o.type].call({parser:this},o);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=d||"";continue}}let c=o;switch(c.type){case"escape":{i+=n.text(c);break}case"html":{i+=n.html(c);break}case"link":{i+=n.link(c);break}case"image":{i+=n.image(c);break}case"strong":{i+=n.strong(c);break}case"em":{i+=n.em(c);break}case"codespan":{i+=n.codespan(c);break}case"br":{i+=n.br(c);break}case"del":{i+=n.del(c);break}case"text":{i+=n.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},zu=class{options;block;constructor(e){this.options=e||Fo}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?Ws.lex:Ws.lexInline}provideParser(){return this.block?qs.parse:qs.parseInline}},GR=class{defaults=M0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=qs;Renderer=mp;TextRenderer=z0;Lexer=Ws;Tokenizer=pp;Hooks=zu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let r=i;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let c of o)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=i;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let c=r[o].flat(1/0);n=n.concat(this.walkTokens(c,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...c){let d=r.renderer.apply(this,c);return d===!1&&(d=o.apply(this,c)),d}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new mp(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let c=o,d=n.renderer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new pp(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let c=o,d=n.tokenizer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new zu;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let c=o,d=n.hooks[c],p=r[c];zu.passThroughHooks.has(o)?r[c]=f=>{if(this.defaults.async&&zu.passThroughHooksRespectAsync.has(o))return(async()=>{let _=await d.call(r,f);return p.call(r,_)})();let g=d.call(r,f);return p.call(r,g)}:r[c]=(...f)=>{if(this.defaults.async)return(async()=>{let _=await d.apply(r,f);return _===!1&&(_=await p.apply(r,f)),_})();let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(c){let d=[];return d.push(o.call(this,c)),r&&(d=d.concat(r.call(this,c))),d}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ws.lex(e,t??this.defaults)}parser(e,t){return qs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let c=r.hooks?await r.hooks.preprocess(t):t,d=await(r.hooks?await r.hooks.provideLexer():e?Ws.lex:Ws.lexInline)(c,r),p=r.hooks?await r.hooks.processAllTokens(d):d;r.walkTokens&&await Promise.all(this.walkTokens(p,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser():e?qs.parse:qs.parseInline)(p,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let c=(r.hooks?r.hooks.provideLexer():e?Ws.lex:Ws.lexInline)(t,r);r.hooks&&(c=r.hooks.processAllTokens(c)),r.walkTokens&&this.walkTokens(c,r.walkTokens);let d=(r.hooks?r.hooks.provideParser():e?qs.parse:qs.parseInline)(c,r);return r.hooks&&(d=r.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(e,t){return n=>{if(n.message+=`
|
|
172
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+ar(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},$o=new GR;function Zt(e,t){return $o.parse(e,t)}Zt.options=Zt.setOptions=function(e){return $o.setOptions(e),Zt.defaults=$o.defaults,jR(Zt.defaults),Zt};Zt.getDefaults=M0;Zt.defaults=Fo;Zt.use=function(...e){return $o.use(...e),Zt.defaults=$o.defaults,jR(Zt.defaults),Zt};Zt.walkTokens=function(e,t){return $o.walkTokens(e,t)};Zt.parseInline=$o.parseInline;Zt.Parser=qs;Zt.parser=qs.parse;Zt.Renderer=mp;Zt.TextRenderer=z0;Zt.Lexer=Ws;Zt.lexer=Ws.lex;Zt.Tokenizer=pp;Zt.Hooks=zu;Zt.parse=Zt;Zt.options;Zt.setOptions;Zt.use;Zt.walkTokens;Zt.parseInline;qs.parse;Ws.lex;const{entries:KR,setPrototypeOf:p2,isFrozen:rW,getPrototypeOf:aW,getOwnPropertyDescriptor:oW}=Object;let{freeze:Ii,seal:Bs,create:Ml}=Object,{apply:ab,construct:ob}=typeof Reflect<"u"&&Reflect;Ii||(Ii=function(t){return t});Bs||(Bs=function(t){return t});ab||(ab=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];return t.apply(n,r)});ob||(ob=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new t(...i)});const Su=Fn(Array.prototype.forEach),lW=Fn(Array.prototype.lastIndexOf),m2=Fn(Array.prototype.pop),wu=Fn(Array.prototype.push),cW=Fn(Array.prototype.splice),Li=Array.isArray,Hu=Fn(String.prototype.toLowerCase),Z_=Fn(String.prototype.toString),g2=Fn(String.prototype.match),Tl=Fn(String.prototype.replace),_2=Fn(String.prototype.indexOf),uW=Fn(String.prototype.trim),hW=Fn(Number.prototype.toString),dW=Fn(Boolean.prototype.toString),v2=typeof BigInt>"u"?null:Fn(BigInt.prototype.toString),y2=typeof Symbol>"u"?null:Fn(Symbol.prototype.toString),xn=Fn(Object.prototype.hasOwnProperty),xu=Fn(Object.prototype.toString),mi=Fn(RegExp.prototype.test),rf=fW(TypeError);function Fn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return ab(e,t,i)}}function fW(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return ob(e,n)}}function ht(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hu;if(p2&&p2(e,null),!Li(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(rW(t)||(t[i]=o),r=o)}e[r]=!0}return e}function pW(e){for(let t=0;t<e.length;t++)xn(e,t)||(e[t]=null);return e}function Yi(e){const t=Ml(null);for(const[n,i]of KR(e))xn(e,n)&&(Li(i)?t[n]=pW(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Yi(i):t[n]=i);return t}function mW(e){switch(typeof e){case"string":return e;case"number":return hW(e);case"boolean":return dW(e);case"bigint":return v2?v2(e):"0";case"symbol":return y2?y2(e):"Symbol()";case"undefined":return xu(e);case"function":case"object":{if(e===null)return xu(e);const t=e,n=Ol(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:xu(i)}return xu(e)}default:return xu(e)}}function Ol(e,t){for(;e!==null;){const i=oW(e,t);if(i){if(i.get)return Fn(i.get);if(typeof i.value=="function")return Fn(i.value)}e=aW(e)}function n(){return null}return n}function gW(e){try{return mi(e,""),!0}catch{return!1}}const b2=Ii(["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"]),J_=Ii(["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"]),Q_=Ii(["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"]),_W=Ii(["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"]),ev=Ii(["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"]),vW=Ii(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),S2=Ii(["#text"]),w2=Ii(["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"]),tv=Ii(["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"]),x2=Ii(["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"]),af=Ii(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yW=Bs(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bW=Bs(/<%[\w\W]*|[\w\W]*%>/gm),SW=Bs(/\$\{[\w\W]*/gm),wW=Bs(/^data-[\-\w.\u00B7-\uFFFF]+$/),xW=Bs(/^aria-[\-\w]+$/),VR=Bs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),CW=Bs(/^(?:\w+script|data):/i),kW=Bs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),YR=Bs(/^html$/i),EW=Bs(/^[a-z][.\w]*(-[.\w]+)+$/i);var C2=Object.freeze({__proto__:null,ARIA_ATTR:xW,ATTR_WHITESPACE:kW,CUSTOM_ELEMENT:EW,DATA_ATTR:wW,DOCTYPE_NAME:YR,ERB_EXPR:bW,IS_ALLOWED_URI:VR,IS_SCRIPT_OR_DATA:CW,MUSTACHE_EXPR:yW,TMPLIT_EXPR:SW});const Cu={element:1,text:3,progressingInstruction:7,comment:8,document:9},TW=function(){return typeof window>"u"?null:window},AW=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},k2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function XR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:TW();const t=He=>XR(He);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Cu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:d,Element:p,NodeFilter:f,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:_,DOMParser:b,trustedTypes:S}=e,w=p.prototype,x=Ol(w,"cloneNode"),C=Ol(w,"remove"),O=Ol(w,"nextSibling"),P=Ol(w,"childNodes"),z=Ol(w,"parentNode");if(typeof c=="function"){const He=n.createElement("template");He.content&&He.content.ownerDocument&&(n=He.content.ownerDocument)}let T,j="";const{implementation:M,createNodeIterator:H,createDocumentFragment:F,getElementsByTagName:ee}=n,{importNode:ae}=i;let K=k2();t.isSupported=typeof KR=="function"&&typeof z=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:N,TMPLIT_EXPR:R,DATA_ATTR:A,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:$,CUSTOM_ELEMENT:q}=C2;let{IS_ALLOWED_URI:X}=C2,D=null;const V=ht({},[...b2,...J_,...Q_,...ev,...S2]);let J=null;const ce=ht({},[...w2,...tv,...x2,...af]);let ie=Object.seal(Ml(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,Se=null;const Oe=Object.seal(Ml(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ne=!0,ct=!0,Ze=!1,Re=!0,xe=!1,ze=!0,le=!1,We=!1,Le=!1,it=!1,bt=!1,je=!1,dt=!0,we=!1;const $e="user-content-";let ft=!0,Ti=!1,An={},re=null;const de=ht({},["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 Ie=null;const Te=ht({},["audio","video","img","source","image","track"]);let St=null;const Wn=ht({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xn="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",Rt="http://www.w3.org/1999/xhtml";let Pt=Rt,_s=!1,yn=null;const yi=ht({},[Xn,yt,Rt],Z_);let Rn=ht({},["mi","mo","mn","ms","mtext"]),vs=ht({},["annotation-xml"]);const $s=ht({},["title","style","font","a","script"]);let qt=null;const W=["application/xhtml+xml","text/html"],fe="text/html";let be=null,Ke=null;const $t=n.createElement("form"),Nt=function(U){return U instanceof RegExp||U instanceof Function},Be=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===U)return;(!U||typeof U!="object")&&(U={}),U=Yi(U),qt=W.indexOf(U.PARSER_MEDIA_TYPE)===-1?fe:U.PARSER_MEDIA_TYPE,be=qt==="application/xhtml+xml"?Z_:Hu,D=xn(U,"ALLOWED_TAGS")&&Li(U.ALLOWED_TAGS)?ht({},U.ALLOWED_TAGS,be):V,J=xn(U,"ALLOWED_ATTR")&&Li(U.ALLOWED_ATTR)?ht({},U.ALLOWED_ATTR,be):ce,yn=xn(U,"ALLOWED_NAMESPACES")&&Li(U.ALLOWED_NAMESPACES)?ht({},U.ALLOWED_NAMESPACES,Z_):yi,St=xn(U,"ADD_URI_SAFE_ATTR")&&Li(U.ADD_URI_SAFE_ATTR)?ht(Yi(Wn),U.ADD_URI_SAFE_ATTR,be):Wn,Ie=xn(U,"ADD_DATA_URI_TAGS")&&Li(U.ADD_DATA_URI_TAGS)?ht(Yi(Te),U.ADD_DATA_URI_TAGS,be):Te,re=xn(U,"FORBID_CONTENTS")&&Li(U.FORBID_CONTENTS)?ht({},U.FORBID_CONTENTS,be):de,ve=xn(U,"FORBID_TAGS")&&Li(U.FORBID_TAGS)?ht({},U.FORBID_TAGS,be):Yi({}),Se=xn(U,"FORBID_ATTR")&&Li(U.FORBID_ATTR)?ht({},U.FORBID_ATTR,be):Yi({}),An=xn(U,"USE_PROFILES")?U.USE_PROFILES&&typeof U.USE_PROFILES=="object"?Yi(U.USE_PROFILES):U.USE_PROFILES:!1,Ne=U.ALLOW_ARIA_ATTR!==!1,ct=U.ALLOW_DATA_ATTR!==!1,Ze=U.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=U.SAFE_FOR_TEMPLATES||!1,ze=U.SAFE_FOR_XML!==!1,le=U.WHOLE_DOCUMENT||!1,it=U.RETURN_DOM||!1,bt=U.RETURN_DOM_FRAGMENT||!1,je=U.RETURN_TRUSTED_TYPE||!1,Le=U.FORCE_BODY||!1,dt=U.SANITIZE_DOM!==!1,we=U.SANITIZE_NAMED_PROPS||!1,ft=U.KEEP_CONTENT!==!1,Ti=U.IN_PLACE||!1,X=gW(U.ALLOWED_URI_REGEXP)?U.ALLOWED_URI_REGEXP:VR,Pt=typeof U.NAMESPACE=="string"?U.NAMESPACE:Rt,Rn=xn(U,"MATHML_TEXT_INTEGRATION_POINTS")&&U.MATHML_TEXT_INTEGRATION_POINTS&&typeof U.MATHML_TEXT_INTEGRATION_POINTS=="object"?Yi(U.MATHML_TEXT_INTEGRATION_POINTS):ht({},["mi","mo","mn","ms","mtext"]),vs=xn(U,"HTML_INTEGRATION_POINTS")&&U.HTML_INTEGRATION_POINTS&&typeof U.HTML_INTEGRATION_POINTS=="object"?Yi(U.HTML_INTEGRATION_POINTS):ht({},["annotation-xml"]);const ue=xn(U,"CUSTOM_ELEMENT_HANDLING")&&U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING=="object"?Yi(U.CUSTOM_ELEMENT_HANDLING):Ml(null);if(ie=Ml(null),xn(ue,"tagNameCheck")&&Nt(ue.tagNameCheck)&&(ie.tagNameCheck=ue.tagNameCheck),xn(ue,"attributeNameCheck")&&Nt(ue.attributeNameCheck)&&(ie.attributeNameCheck=ue.attributeNameCheck),xn(ue,"allowCustomizedBuiltInElements")&&typeof ue.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=ue.allowCustomizedBuiltInElements),xe&&(ct=!1),bt&&(it=!0),An&&(D=ht({},S2),J=Ml(null),An.html===!0&&(ht(D,b2),ht(J,w2)),An.svg===!0&&(ht(D,J_),ht(J,tv),ht(J,af)),An.svgFilters===!0&&(ht(D,Q_),ht(J,tv),ht(J,af)),An.mathMl===!0&&(ht(D,ev),ht(J,x2),ht(J,af))),Oe.tagCheck=null,Oe.attributeCheck=null,xn(U,"ADD_TAGS")&&(typeof U.ADD_TAGS=="function"?Oe.tagCheck=U.ADD_TAGS:Li(U.ADD_TAGS)&&(D===V&&(D=Yi(D)),ht(D,U.ADD_TAGS,be))),xn(U,"ADD_ATTR")&&(typeof U.ADD_ATTR=="function"?Oe.attributeCheck=U.ADD_ATTR:Li(U.ADD_ATTR)&&(J===ce&&(J=Yi(J)),ht(J,U.ADD_ATTR,be))),xn(U,"ADD_URI_SAFE_ATTR")&&Li(U.ADD_URI_SAFE_ATTR)&&ht(St,U.ADD_URI_SAFE_ATTR,be),xn(U,"FORBID_CONTENTS")&&Li(U.FORBID_CONTENTS)&&(re===de&&(re=Yi(re)),ht(re,U.FORBID_CONTENTS,be)),xn(U,"ADD_FORBID_CONTENTS")&&Li(U.ADD_FORBID_CONTENTS)&&(re===de&&(re=Yi(re)),ht(re,U.ADD_FORBID_CONTENTS,be)),ft&&(D["#text"]=!0),le&&ht(D,["html","head","body"]),D.table&&(ht(D,["tbody"]),delete ve.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw rf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw rf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=U.TRUSTED_TYPES_POLICY,j=T.createHTML("")}else T===void 0&&(T=AW(S,r)),T!==null&&typeof j=="string"&&(j=T.createHTML(""));Ii&&Ii(U),Ke=U},Me=ht({},[...J_,...Q_,..._W]),Ye=ht({},[...ev,...vW]),Jt=function(U){let ue=z(U);(!ue||!ue.tagName)&&(ue={namespaceURI:Pt,tagName:"template"});const Ae=Hu(U.tagName),rt=Hu(ue.tagName);return yn[U.namespaceURI]?U.namespaceURI===yt?ue.namespaceURI===Rt?Ae==="svg":ue.namespaceURI===Xn?Ae==="svg"&&(rt==="annotation-xml"||Rn[rt]):!!Me[Ae]:U.namespaceURI===Xn?ue.namespaceURI===Rt?Ae==="math":ue.namespaceURI===yt?Ae==="math"&&vs[rt]:!!Ye[Ae]:U.namespaceURI===Rt?ue.namespaceURI===yt&&!vs[rt]||ue.namespaceURI===Xn&&!Rn[rt]?!1:!Ye[Ae]&&($s[Ae]||!Me[Ae]):!!(qt==="application/xhtml+xml"&&yn[U.namespaceURI]):!1},pt=function(U){wu(t.removed,{element:U});try{z(U).removeChild(U)}catch{C(U)}},On=function(U,ue){try{wu(t.removed,{attribute:ue.getAttributeNode(U),from:ue})}catch{wu(t.removed,{attribute:null,from:ue})}if(ue.removeAttribute(U),U==="is")if(it||bt)try{pt(ue)}catch{}else try{ue.setAttribute(U,"")}catch{}},pe=function(U){let ue=null,Ae=null;if(Le)U="<remove></remove>"+U;else{const Ht=g2(U,/^[\r\n\t ]+/);Ae=Ht&&Ht[0]}qt==="application/xhtml+xml"&&Pt===Rt&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const rt=T?T.createHTML(U):U;if(Pt===Rt)try{ue=new b().parseFromString(rt,qt)}catch{}if(!ue||!ue.documentElement){ue=M.createDocument(Pt,"template",null);try{ue.documentElement.innerHTML=_s?j:rt}catch{}}const ot=ue.body||ue.documentElement;return U&&Ae&&ot.insertBefore(n.createTextNode(Ae),ot.childNodes[0]||null),Pt===Rt?ee.call(ue,le?"html":"body")[0]:le?ue.documentElement:ot},Ct=function(U){return H.call(U.ownerDocument||U,U,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Lt=function(U){return U instanceof _&&(typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||!(U.attributes instanceof g)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function")},Xe=function(U){return typeof d=="function"&&U instanceof d};function Ce(He,U,ue){Su(He,Ae=>{Ae.call(t,U,ue,Ke)})}const zt=function(U){let ue=null;if(Ce(K.beforeSanitizeElements,U,null),Lt(U))return pt(U),!0;const Ae=be(U.nodeName);if(Ce(K.uponSanitizeElement,U,{tagName:Ae,allowedTags:D}),ze&&U.hasChildNodes()&&!Xe(U.firstElementChild)&&mi(/<[/\w!]/g,U.innerHTML)&&mi(/<[/\w!]/g,U.textContent)||ze&&U.namespaceURI===Rt&&Ae==="style"&&Xe(U.firstElementChild)||U.nodeType===Cu.progressingInstruction||ze&&U.nodeType===Cu.comment&&mi(/<[/\w]/g,U.data))return pt(U),!0;if(ve[Ae]||!(Oe.tagCheck instanceof Function&&Oe.tagCheck(Ae))&&!D[Ae]){if(!ve[Ae]&&bi(Ae)&&(ie.tagNameCheck instanceof RegExp&&mi(ie.tagNameCheck,Ae)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ae)))return!1;if(ft&&!re[Ae]){const rt=z(U)||U.parentNode,ot=P(U)||U.childNodes;if(ot&&rt){const Ht=ot.length;for(let un=Ht-1;un>=0;--un){const hn=x(ot[un],!0);rt.insertBefore(hn,O(U))}}}return pt(U),!0}return U instanceof p&&!Jt(U)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&mi(/<\/no(script|embed|frames)/i,U.innerHTML)?(pt(U),!0):(xe&&U.nodeType===Cu.text&&(ue=U.textContent,Su([B,N,R],rt=>{ue=Tl(ue,rt," ")}),U.textContent!==ue&&(wu(t.removed,{element:U.cloneNode()}),U.textContent=ue)),Ce(K.afterSanitizeElements,U,null),!1)},Gt=function(U,ue,Ae){if(Se[ue]||dt&&(ue==="id"||ue==="name")&&(Ae in n||Ae in $t))return!1;const rt=J[ue]||Oe.attributeCheck instanceof Function&&Oe.attributeCheck(ue,U);if(!(ct&&!Se[ue]&&mi(A,ue))){if(!(Ne&&mi(E,ue))){if(!rt||Se[ue]){if(!(bi(U)&&(ie.tagNameCheck instanceof RegExp&&mi(ie.tagNameCheck,U)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(U))&&(ie.attributeNameCheck instanceof RegExp&&mi(ie.attributeNameCheck,ue)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(ue,U))||ue==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&mi(ie.tagNameCheck,Ae)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ae))))return!1}else if(!St[ue]){if(!mi(X,Tl(Ae,$,""))){if(!((ue==="src"||ue==="xlink:href"||ue==="href")&&U!=="script"&&_2(Ae,"data:")===0&&Ie[U])){if(!(Ze&&!mi(L,Tl(Ae,$,"")))){if(Ae)return!1}}}}}}return!0},li=ht({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),bi=function(U){return!li[Hu(U)]&&mi(q,U)},Qi=function(U){Ce(K.beforeSanitizeAttributes,U,null);const{attributes:ue}=U;if(!ue||Lt(U))return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let rt=ue.length;for(;rt--;){const ot=ue[rt],{name:Ht,namespaceURI:un,value:hn}=ot,ye=be(Ht),qe=hn;let Ge=Ht==="value"?qe:uW(qe);if(Ae.attrName=ye,Ae.attrValue=Ge,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,Ce(K.uponSanitizeAttribute,U,Ae),Ge=Ae.attrValue,we&&(ye==="id"||ye==="name")&&_2(Ge,$e)!==0&&(On(Ht,U),Ge=$e+Ge),ze&&mi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ge)){On(Ht,U);continue}if(ye==="attributename"&&g2(Ge,"href")){On(Ht,U);continue}if(Ae.forceKeepAttr)continue;if(!Ae.keepAttr){On(Ht,U);continue}if(!Re&&mi(/\/>/i,Ge)){On(Ht,U);continue}xe&&Su([B,N,R],dn=>{Ge=Tl(Ge,dn," ")});const Mt=be(U.nodeName);if(!Gt(Mt,ye,Ge)){On(Ht,U);continue}if(T&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!un)switch(S.getAttributeType(Mt,ye)){case"TrustedHTML":{Ge=T.createHTML(Ge);break}case"TrustedScriptURL":{Ge=T.createScriptURL(Ge);break}}if(Ge!==qe)try{un?U.setAttributeNS(un,Ht,Ge):U.setAttribute(Ht,Ge),Lt(U)?pt(U):m2(t.removed)}catch{On(Ht,U)}}Ce(K.afterSanitizeAttributes,U,null)},Si=function(U){let ue=null;const Ae=Ct(U);for(Ce(K.beforeSanitizeShadowDOM,U,null);ue=Ae.nextNode();)Ce(K.uponSanitizeShadowNode,ue,null),zt(ue),Qi(ue),ue.content instanceof o&&Si(ue.content);Ce(K.afterSanitizeShadowDOM,U,null)};return t.sanitize=function(He){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ue=null,Ae=null,rt=null,ot=null;if(_s=!He,_s&&(He="<!-->"),typeof He!="string"&&!Xe(He)&&(He=mW(He),typeof He!="string"))throw rf("dirty is not a string, aborting");if(!t.isSupported)return He;if(We||Be(U),t.removed=[],typeof He=="string"&&(Ti=!1),Ti){const hn=He.nodeName;if(typeof hn=="string"){const ye=be(hn);if(!D[ye]||ve[ye])throw rf("root node is forbidden and cannot be sanitized in-place")}}else if(He instanceof d)ue=pe("<!---->"),Ae=ue.ownerDocument.importNode(He,!0),Ae.nodeType===Cu.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?ue=Ae:ue.appendChild(Ae);else{if(!it&&!xe&&!le&&He.indexOf("<")===-1)return T&&je?T.createHTML(He):He;if(ue=pe(He),!ue)return it?null:je?j:""}ue&&Le&&pt(ue.firstChild);const Ht=Ct(Ti?He:ue);for(;rt=Ht.nextNode();)zt(rt),Qi(rt),rt.content instanceof o&&Si(rt.content);if(Ti)return He;if(it){if(xe){ue.normalize();let hn=ue.innerHTML;Su([B,N,R],ye=>{hn=Tl(hn,ye," ")}),ue.innerHTML=hn}if(bt)for(ot=F.call(ue.ownerDocument);ue.firstChild;)ot.appendChild(ue.firstChild);else ot=ue;return(J.shadowroot||J.shadowrootmode)&&(ot=ae.call(i,ot,!0)),ot}let un=le?ue.outerHTML:ue.innerHTML;return le&&D["!doctype"]&&ue.ownerDocument&&ue.ownerDocument.doctype&&ue.ownerDocument.doctype.name&&mi(YR,ue.ownerDocument.doctype.name)&&(un="<!DOCTYPE "+ue.ownerDocument.doctype.name+`>
|
|
173
|
-
`+un),xe&&Su([B,N,R],hn=>{un=Tl(un,hn," ")}),T&&je?T.createHTML(un):un},t.setConfig=function(){let He=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Be(He),We=!0},t.clearConfig=function(){Ke=null,We=!1},t.isValidAttribute=function(He,U,ue){Ke||Be({});const Ae=be(He),rt=be(U);return Gt(Ae,rt,ue)},t.addHook=function(He,U){typeof U=="function"&&wu(K[He],U)},t.removeHook=function(He,U){if(U!==void 0){const ue=lW(K[He],U);return ue===-1?void 0:cW(K[He],ue,1)[0]}return m2(K[He])},t.removeHooks=function(He){K[He]=[]},t.removeAllHooks=function(){K=k2()},t}var Yu=XR(),nv,E2;function RW(){if(E2)return nv;E2=1;function e(W){return W instanceof Map?W.clear=W.delete=W.set=function(){throw new Error("map is read-only")}:W instanceof Set&&(W.add=W.clear=W.delete=function(){throw new Error("set is read-only")}),Object.freeze(W),Object.getOwnPropertyNames(W).forEach(fe=>{const be=W[fe],Ke=typeof be;(Ke==="object"||Ke==="function")&&!Object.isFrozen(be)&&e(be)}),W}class t{constructor(fe){fe.data===void 0&&(fe.data={}),this.data=fe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(W){return W.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(W,...fe){const be=Object.create(null);for(const Ke in W)be[Ke]=W[Ke];return fe.forEach(function(Ke){for(const $t in Ke)be[$t]=Ke[$t]}),be}const r="</span>",o=W=>!!W.scope,c=(W,{prefix:fe})=>{if(W.startsWith("language:"))return W.replace("language:","language-");if(W.includes(".")){const be=W.split(".");return[`${fe}${be.shift()}`,...be.map((Ke,$t)=>`${Ke}${"_".repeat($t+1)}`)].join(" ")}return`${fe}${W}`};class d{constructor(fe,be){this.buffer="",this.classPrefix=be.classPrefix,fe.walk(this)}addText(fe){this.buffer+=n(fe)}openNode(fe){if(!o(fe))return;const be=c(fe.scope,{prefix:this.classPrefix});this.span(be)}closeNode(fe){o(fe)&&(this.buffer+=r)}value(){return this.buffer}span(fe){this.buffer+=`<span class="${fe}">`}}const p=(W={})=>{const fe={children:[]};return Object.assign(fe,W),fe};class f{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(fe){this.top.children.push(fe)}openNode(fe){const be=p({scope:fe});this.add(be),this.stack.push(be)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(fe){return this.constructor._walk(fe,this.rootNode)}static _walk(fe,be){return typeof be=="string"?fe.addText(be):be.children&&(fe.openNode(be),be.children.forEach(Ke=>this._walk(fe,Ke)),fe.closeNode(be)),fe}static _collapse(fe){typeof fe!="string"&&fe.children&&(fe.children.every(be=>typeof be=="string")?fe.children=[fe.children.join("")]:fe.children.forEach(be=>{f._collapse(be)}))}}class g extends f{constructor(fe){super(),this.options=fe}addText(fe){fe!==""&&this.add(fe)}startScope(fe){this.openNode(fe)}endScope(){this.closeNode()}__addSublanguage(fe,be){const Ke=fe.root;be&&(Ke.scope=`language:${be}`),this.add(Ke)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _(W){return W?typeof W=="string"?W:W.source:null}function b(W){return x("(?=",W,")")}function S(W){return x("(?:",W,")*")}function w(W){return x("(?:",W,")?")}function x(...W){return W.map(be=>_(be)).join("")}function C(W){const fe=W[W.length-1];return typeof fe=="object"&&fe.constructor===Object?(W.splice(W.length-1,1),fe):{}}function O(...W){return"("+(C(W).capture?"":"?:")+W.map(Ke=>_(Ke)).join("|")+")"}function P(W){return new RegExp(W.toString()+"|").exec("").length-1}function z(W,fe){const be=W&&W.exec(fe);return be&&be.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function j(W,{joinWith:fe}){let be=0;return W.map(Ke=>{be+=1;const $t=be;let Nt=_(Ke),Be="";for(;Nt.length>0;){const Me=T.exec(Nt);if(!Me){Be+=Nt;break}Be+=Nt.substring(0,Me.index),Nt=Nt.substring(Me.index+Me[0].length),Me[0][0]==="\\"&&Me[1]?Be+="\\"+String(Number(Me[1])+$t):(Be+=Me[0],Me[0]==="("&&be++)}return Be}).map(Ke=>`(${Ke})`).join(fe)}const M=/\b\B/,H="[a-zA-Z]\\w*",F="[a-zA-Z_]\\w*",ee="\\b\\d+(\\.\\d+)?",ae="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",K="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",N=(W={})=>{const fe=/^#![ ]*\//;return W.binary&&(W.begin=x(fe,/.*\b/,W.binary,/\b.*/)),i({scope:"meta",begin:fe,end:/$/,relevance:0,"on:begin":(be,Ke)=>{be.index!==0&&Ke.ignoreMatch()}},W)},R={begin:"\\\\[\\s\\S]",relevance:0},A={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[R]},E={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[R]},L={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/},$=function(W,fe,be={}){const Ke=i({scope:"comment",begin:W,end:fe,contains:[]},be);Ke.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 $t=O("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 Ke.contains.push({begin:x(/[ ]+/,"(",$t,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ke},q=$("//","$"),X=$("/\\*","\\*/"),D=$("#","$"),V={scope:"number",begin:ee,relevance:0},J={scope:"number",begin:ae,relevance:0},ce={scope:"number",begin:K,relevance:0},ie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[R,{begin:/\[/,end:/\]/,relevance:0,contains:[R]}]},ve={scope:"title",begin:H,relevance:0},Se={scope:"title",begin:F,relevance:0},Oe={begin:"\\.\\s*"+F,relevance:0};var ct=Object.freeze({__proto__:null,APOS_STRING_MODE:A,BACKSLASH_ESCAPE:R,BINARY_NUMBER_MODE:ce,BINARY_NUMBER_RE:K,COMMENT:$,C_BLOCK_COMMENT_MODE:X,C_LINE_COMMENT_MODE:q,C_NUMBER_MODE:J,C_NUMBER_RE:ae,END_SAME_AS_BEGIN:function(W){return Object.assign(W,{"on:begin":(fe,be)=>{be.data._beginMatch=fe[1]},"on:end":(fe,be)=>{be.data._beginMatch!==fe[1]&&be.ignoreMatch()}})},HASH_COMMENT_MODE:D,IDENT_RE:H,MATCH_NOTHING_RE:M,METHOD_GUARD:Oe,NUMBER_MODE:V,NUMBER_RE:ee,PHRASAL_WORDS_MODE:L,QUOTE_STRING_MODE:E,REGEXP_MODE:ie,RE_STARTERS_RE:B,SHEBANG:N,TITLE_MODE:ve,UNDERSCORE_IDENT_RE:F,UNDERSCORE_TITLE_MODE:Se});function Ze(W,fe){W.input[W.index-1]==="."&&fe.ignoreMatch()}function Re(W,fe){W.className!==void 0&&(W.scope=W.className,delete W.className)}function xe(W,fe){fe&&W.beginKeywords&&(W.begin="\\b("+W.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",W.__beforeBegin=Ze,W.keywords=W.keywords||W.beginKeywords,delete W.beginKeywords,W.relevance===void 0&&(W.relevance=0))}function ze(W,fe){Array.isArray(W.illegal)&&(W.illegal=O(...W.illegal))}function le(W,fe){if(W.match){if(W.begin||W.end)throw new Error("begin & end are not supported with match");W.begin=W.match,delete W.match}}function We(W,fe){W.relevance===void 0&&(W.relevance=1)}const Le=(W,fe)=>{if(!W.beforeMatch)return;if(W.starts)throw new Error("beforeMatch cannot be used with starts");const be=Object.assign({},W);Object.keys(W).forEach(Ke=>{delete W[Ke]}),W.keywords=be.keywords,W.begin=x(be.beforeMatch,b(be.begin)),W.starts={relevance:0,contains:[Object.assign(be,{endsParent:!0})]},W.relevance=0,delete be.beforeMatch},it=["of","and","for","in","not","or","if","then","parent","list","value"],bt="keyword";function je(W,fe,be=bt){const Ke=Object.create(null);return typeof W=="string"?$t(be,W.split(" ")):Array.isArray(W)?$t(be,W):Object.keys(W).forEach(function(Nt){Object.assign(Ke,je(W[Nt],fe,Nt))}),Ke;function $t(Nt,Be){fe&&(Be=Be.map(Me=>Me.toLowerCase())),Be.forEach(function(Me){const Ye=Me.split("|");Ke[Ye[0]]=[Nt,dt(Ye[0],Ye[1])]})}}function dt(W,fe){return fe?Number(fe):we(W)?0:1}function we(W){return it.includes(W.toLowerCase())}const $e={},ft=W=>{console.error(W)},Ti=(W,...fe)=>{console.log(`WARN: ${W}`,...fe)},An=(W,fe)=>{$e[`${W}/${fe}`]||(console.log(`Deprecated as of ${W}. ${fe}`),$e[`${W}/${fe}`]=!0)},re=new Error;function de(W,fe,{key:be}){let Ke=0;const $t=W[be],Nt={},Be={};for(let Me=1;Me<=fe.length;Me++)Be[Me+Ke]=$t[Me],Nt[Me+Ke]=!0,Ke+=P(fe[Me-1]);W[be]=Be,W[be]._emit=Nt,W[be]._multi=!0}function Ie(W){if(Array.isArray(W.begin)){if(W.skip||W.excludeBegin||W.returnBegin)throw ft("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),re;if(typeof W.beginScope!="object"||W.beginScope===null)throw ft("beginScope must be object"),re;de(W,W.begin,{key:"beginScope"}),W.begin=j(W.begin,{joinWith:""})}}function Te(W){if(Array.isArray(W.end)){if(W.skip||W.excludeEnd||W.returnEnd)throw ft("skip, excludeEnd, returnEnd not compatible with endScope: {}"),re;if(typeof W.endScope!="object"||W.endScope===null)throw ft("endScope must be object"),re;de(W,W.end,{key:"endScope"}),W.end=j(W.end,{joinWith:""})}}function St(W){W.scope&&typeof W.scope=="object"&&W.scope!==null&&(W.beginScope=W.scope,delete W.scope)}function Wn(W){St(W),typeof W.beginScope=="string"&&(W.beginScope={_wrap:W.beginScope}),typeof W.endScope=="string"&&(W.endScope={_wrap:W.endScope}),Ie(W),Te(W)}function Xn(W){function fe(Be,Me){return new RegExp(_(Be),"m"+(W.case_insensitive?"i":"")+(W.unicodeRegex?"u":"")+(Me?"g":""))}class be{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Me,Ye){Ye.position=this.position++,this.matchIndexes[this.matchAt]=Ye,this.regexes.push([Ye,Me]),this.matchAt+=P(Me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Me=this.regexes.map(Ye=>Ye[1]);this.matcherRe=fe(j(Me,{joinWith:"|"}),!0),this.lastIndex=0}exec(Me){this.matcherRe.lastIndex=this.lastIndex;const Ye=this.matcherRe.exec(Me);if(!Ye)return null;const Jt=Ye.findIndex((On,pe)=>pe>0&&On!==void 0),pt=this.matchIndexes[Jt];return Ye.splice(0,Jt),Object.assign(Ye,pt)}}class Ke{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Me){if(this.multiRegexes[Me])return this.multiRegexes[Me];const Ye=new be;return this.rules.slice(Me).forEach(([Jt,pt])=>Ye.addRule(Jt,pt)),Ye.compile(),this.multiRegexes[Me]=Ye,Ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Me,Ye){this.rules.push([Me,Ye]),Ye.type==="begin"&&this.count++}exec(Me){const Ye=this.getMatcher(this.regexIndex);Ye.lastIndex=this.lastIndex;let Jt=Ye.exec(Me);if(this.resumingScanAtSamePosition()&&!(Jt&&Jt.index===this.lastIndex)){const pt=this.getMatcher(0);pt.lastIndex=this.lastIndex+1,Jt=pt.exec(Me)}return Jt&&(this.regexIndex+=Jt.position+1,this.regexIndex===this.count&&this.considerAll()),Jt}}function $t(Be){const Me=new Ke;return Be.contains.forEach(Ye=>Me.addRule(Ye.begin,{rule:Ye,type:"begin"})),Be.terminatorEnd&&Me.addRule(Be.terminatorEnd,{type:"end"}),Be.illegal&&Me.addRule(Be.illegal,{type:"illegal"}),Me}function Nt(Be,Me){const Ye=Be;if(Be.isCompiled)return Ye;[Re,le,Wn,Le].forEach(pt=>pt(Be,Me)),W.compilerExtensions.forEach(pt=>pt(Be,Me)),Be.__beforeBegin=null,[xe,ze,We].forEach(pt=>pt(Be,Me)),Be.isCompiled=!0;let Jt=null;return typeof Be.keywords=="object"&&Be.keywords.$pattern&&(Be.keywords=Object.assign({},Be.keywords),Jt=Be.keywords.$pattern,delete Be.keywords.$pattern),Jt=Jt||/\w+/,Be.keywords&&(Be.keywords=je(Be.keywords,W.case_insensitive)),Ye.keywordPatternRe=fe(Jt,!0),Me&&(Be.begin||(Be.begin=/\B|\b/),Ye.beginRe=fe(Ye.begin),!Be.end&&!Be.endsWithParent&&(Be.end=/\B|\b/),Be.end&&(Ye.endRe=fe(Ye.end)),Ye.terminatorEnd=_(Ye.end)||"",Be.endsWithParent&&Me.terminatorEnd&&(Ye.terminatorEnd+=(Be.end?"|":"")+Me.terminatorEnd)),Be.illegal&&(Ye.illegalRe=fe(Be.illegal)),Be.contains||(Be.contains=[]),Be.contains=[].concat(...Be.contains.map(function(pt){return Rt(pt==="self"?Be:pt)})),Be.contains.forEach(function(pt){Nt(pt,Ye)}),Be.starts&&Nt(Be.starts,Me),Ye.matcher=$t(Ye),Ye}if(W.compilerExtensions||(W.compilerExtensions=[]),W.contains&&W.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return W.classNameAliases=i(W.classNameAliases||{}),Nt(W)}function yt(W){return W?W.endsWithParent||yt(W.starts):!1}function Rt(W){return W.variants&&!W.cachedVariants&&(W.cachedVariants=W.variants.map(function(fe){return i(W,{variants:null},fe)})),W.cachedVariants?W.cachedVariants:yt(W)?i(W,{starts:W.starts?i(W.starts):null}):Object.isFrozen(W)?i(W):W}var Pt="11.11.1";class _s extends Error{constructor(fe,be){super(fe),this.name="HTMLInjectionError",this.html=be}}const yn=n,yi=i,Rn=Symbol("nomatch"),vs=7,$s=function(W){const fe=Object.create(null),be=Object.create(null),Ke=[];let $t=!0;const Nt="Could not find the language '{}', did you forget to load/include a language module?",Be={disableAutodetect:!0,name:"Plain text",contains:[]};let Me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function Ye(ye){return Me.noHighlightRe.test(ye)}function Jt(ye){let qe=ye.className+" ";qe+=ye.parentNode?ye.parentNode.className:"";const Ge=Me.languageDetectRe.exec(qe);if(Ge){const Mt=U(Ge[1]);return Mt||(Ti(Nt.replace("{}",Ge[1])),Ti("Falling back to no-highlight mode for this block.",ye)),Mt?Ge[1]:"no-highlight"}return qe.split(/\s+/).find(Mt=>Ye(Mt)||U(Mt))}function pt(ye,qe,Ge){let Mt="",dn="";typeof qe=="object"?(Mt=ye,Ge=qe.ignoreIllegals,dn=qe.language):(An("10.7.0","highlight(lang, code, ...args) has been deprecated."),An("10.7.0",`Please use highlight(code, options) instead.
|
|
174
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),dn=ye,Mt=qe),Ge===void 0&&(Ge=!0);const wi={code:Mt,language:dn};un("before:highlight",wi);const es=wi.result?wi.result:On(wi.language,wi.code,Ge);return es.code=wi.code,un("after:highlight",es),es}function On(ye,qe,Ge,Mt){const dn=Object.create(null);function wi(Ee,Fe){return Ee.keywords[Fe]}function es(){if(!et.keywords){Dn.addText(Ft);return}let Ee=0;et.keywordPatternRe.lastIndex=0;let Fe=et.keywordPatternRe.exec(Ft),at="";for(;Fe;){at+=Ft.substring(Ee,Fe.index);const kt=ci.case_insensitive?Fe[0].toLowerCase():Fe[0],gn=wi(et,kt);if(gn){const[ys,mc]=gn;if(Dn.addText(at),at="",dn[kt]=(dn[kt]||0)+1,dn[kt]<=vs&&(ea+=mc),ys.startsWith("_"))at+=Fe[0];else{const Lh=ci.classNameAliases[ys]||ys;ts(Fe[0],Lh)}}else at+=Fe[0];Ee=et.keywordPatternRe.lastIndex,Fe=et.keywordPatternRe.exec(Ft)}at+=Ft.substring(Ee),Dn.addText(at)}function $i(){if(Ft==="")return;let Ee=null;if(typeof et.subLanguage=="string"){if(!fe[et.subLanguage]){Dn.addText(Ft);return}Ee=On(et.subLanguage,Ft,!0,Nh[et.subLanguage]),Nh[et.subLanguage]=Ee._top}else Ee=Ct(Ft,et.subLanguage.length?et.subLanguage:null);et.relevance>0&&(ea+=Ee.relevance),Dn.__addSublanguage(Ee._emitter,Ee.language)}function en(){et.subLanguage!=null?$i():es(),Ft=""}function ts(Ee,Fe){Ee!==""&&(Dn.startScope(Fe),Dn.addText(Ee),Dn.endScope())}function Ah(Ee,Fe){let at=1;const kt=Fe.length-1;for(;at<=kt;){if(!Ee._emit[at]){at++;continue}const gn=ci.classNameAliases[Ee[at]]||Ee[at],ys=Fe[at];gn?ts(ys,gn):(Ft=ys,es(),Ft=""),at++}}function Uo(Ee,Fe){return Ee.scope&&typeof Ee.scope=="string"&&Dn.openNode(ci.classNameAliases[Ee.scope]||Ee.scope),Ee.beginScope&&(Ee.beginScope._wrap?(ts(Ft,ci.classNameAliases[Ee.beginScope._wrap]||Ee.beginScope._wrap),Ft=""):Ee.beginScope._multi&&(Ah(Ee.beginScope,Fe),Ft="")),et=Object.create(Ee,{parent:{value:et}}),et}function dc(Ee,Fe,at){let kt=z(Ee.endRe,at);if(kt){if(Ee["on:end"]){const gn=new t(Ee);Ee["on:end"](Fe,gn),gn.isMatchIgnored&&(kt=!1)}if(kt){for(;Ee.endsParent&&Ee.parent;)Ee=Ee.parent;return Ee}}if(Ee.endsWithParent)return dc(Ee.parent,Fe,at)}function Wo(Ee){return et.matcher.regexIndex===0?(Ft+=Ee[0],1):(ta=!0,0)}function em(Ee){const Fe=Ee[0],at=Ee.rule,kt=new t(at),gn=[at.__beforeBegin,at["on:begin"]];for(const ys of gn)if(ys&&(ys(Ee,kt),kt.isMatchIgnored))return Wo(Fe);return at.skip?Ft+=Fe:(at.excludeBegin&&(Ft+=Fe),en(),!at.returnBegin&&!at.excludeBegin&&(Ft=Fe)),Uo(at,Ee),at.returnBegin?0:Fe.length}function zi(Ee){const Fe=Ee[0],at=qe.substring(Ee.index),kt=dc(et,Ee,at);if(!kt)return Rn;const gn=et;et.endScope&&et.endScope._wrap?(en(),ts(Fe,et.endScope._wrap)):et.endScope&&et.endScope._multi?(en(),Ah(et.endScope,Ee)):gn.skip?Ft+=Fe:(gn.returnEnd||gn.excludeEnd||(Ft+=Fe),en(),gn.excludeEnd&&(Ft=Fe));do et.scope&&Dn.closeNode(),!et.skip&&!et.subLanguage&&(ea+=et.relevance),et=et.parent;while(et!==kt.parent);return kt.starts&&Uo(kt.starts,Ee),gn.returnEnd?0:Fe.length}function fc(){const Ee=[];for(let Fe=et;Fe!==ci;Fe=Fe.parent)Fe.scope&&Ee.unshift(Fe.scope);Ee.forEach(Fe=>Dn.openNode(Fe))}let Ja={};function qo(Ee,Fe){const at=Fe&&Fe[0];if(Ft+=Ee,at==null)return en(),0;if(Ja.type==="begin"&&Fe.type==="end"&&Ja.index===Fe.index&&at===""){if(Ft+=qe.slice(Fe.index,Fe.index+1),!$t){const kt=new Error(`0 width match regex (${ye})`);throw kt.languageName=ye,kt.badRule=Ja.rule,kt}return 1}if(Ja=Fe,Fe.type==="begin")return em(Fe);if(Fe.type==="illegal"&&!Ge){const kt=new Error('Illegal lexeme "'+at+'" for mode "'+(et.scope||"<unnamed>")+'"');throw kt.mode=et,kt}else if(Fe.type==="end"){const kt=zi(Fe);if(kt!==Rn)return kt}if(Fe.type==="illegal"&&at==="")return Ft+=`
|
|
175
|
-
`,1;if(pc>1e5&&pc>Fe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ft+=at,at.length}const ci=U(ye);if(!ci)throw ft(Nt.replace("{}",ye)),new Error('Unknown language: "'+ye+'"');const Rh=Xn(ci);let Go="",et=Mt||Rh;const Nh={},Dn=new Me.__emitter(Me);fc();let Ft="",ea=0,vr=0,pc=0,ta=!1;try{if(ci.__emitTokens)ci.__emitTokens(qe,Dn);else{for(et.matcher.considerAll();;){pc++,ta?ta=!1:et.matcher.considerAll(),et.matcher.lastIndex=vr;const Ee=et.matcher.exec(qe);if(!Ee)break;const Fe=qe.substring(vr,Ee.index),at=qo(Fe,Ee);vr=Ee.index+at}qo(qe.substring(vr))}return Dn.finalize(),Go=Dn.toHTML(),{language:ye,value:Go,relevance:ea,illegal:!1,_emitter:Dn,_top:et}}catch(Ee){if(Ee.message&&Ee.message.includes("Illegal"))return{language:ye,value:yn(qe),illegal:!0,relevance:0,_illegalBy:{message:Ee.message,index:vr,context:qe.slice(vr-100,vr+100),mode:Ee.mode,resultSoFar:Go},_emitter:Dn};if($t)return{language:ye,value:yn(qe),illegal:!1,relevance:0,errorRaised:Ee,_emitter:Dn,_top:et};throw Ee}}function pe(ye){const qe={value:yn(ye),illegal:!1,relevance:0,_top:Be,_emitter:new Me.__emitter(Me)};return qe._emitter.addText(ye),qe}function Ct(ye,qe){qe=qe||Me.languages||Object.keys(fe);const Ge=pe(ye),Mt=qe.filter(U).filter(Ae).map(en=>On(en,ye,!1));Mt.unshift(Ge);const dn=Mt.sort((en,ts)=>{if(en.relevance!==ts.relevance)return ts.relevance-en.relevance;if(en.language&&ts.language){if(U(en.language).supersetOf===ts.language)return 1;if(U(ts.language).supersetOf===en.language)return-1}return 0}),[wi,es]=dn,$i=wi;return $i.secondBest=es,$i}function Lt(ye,qe,Ge){const Mt=qe&&be[qe]||Ge;ye.classList.add("hljs"),ye.classList.add(`language-${Mt}`)}function Xe(ye){let qe=null;const Ge=Jt(ye);if(Ye(Ge))return;if(un("before:highlightElement",{el:ye,language:Ge}),ye.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ye);return}if(ye.children.length>0&&(Me.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(ye)),Me.throwUnescapedHTML))throw new _s("One of your code blocks includes unescaped HTML.",ye.innerHTML);qe=ye;const Mt=qe.textContent,dn=Ge?pt(Mt,{language:Ge,ignoreIllegals:!0}):Ct(Mt);ye.innerHTML=dn.value,ye.dataset.highlighted="yes",Lt(ye,Ge,dn.language),ye.result={language:dn.language,re:dn.relevance,relevance:dn.relevance},dn.secondBest&&(ye.secondBest={language:dn.secondBest.language,relevance:dn.secondBest.relevance}),un("after:highlightElement",{el:ye,result:dn,text:Mt})}function Ce(ye){Me=yi(Me,ye)}const zt=()=>{bi(),An("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Gt(){bi(),An("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let li=!1;function bi(){function ye(){bi()}if(document.readyState==="loading"){li||window.addEventListener("DOMContentLoaded",ye,!1),li=!0;return}document.querySelectorAll(Me.cssSelector).forEach(Xe)}function Qi(ye,qe){let Ge=null;try{Ge=qe(W)}catch(Mt){if(ft("Language definition for '{}' could not be registered.".replace("{}",ye)),$t)ft(Mt);else throw Mt;Ge=Be}Ge.name||(Ge.name=ye),fe[ye]=Ge,Ge.rawDefinition=qe.bind(null,W),Ge.aliases&&ue(Ge.aliases,{languageName:ye})}function Si(ye){delete fe[ye];for(const qe of Object.keys(be))be[qe]===ye&&delete be[qe]}function He(){return Object.keys(fe)}function U(ye){return ye=(ye||"").toLowerCase(),fe[ye]||fe[be[ye]]}function ue(ye,{languageName:qe}){typeof ye=="string"&&(ye=[ye]),ye.forEach(Ge=>{be[Ge.toLowerCase()]=qe})}function Ae(ye){const qe=U(ye);return qe&&!qe.disableAutodetect}function rt(ye){ye["before:highlightBlock"]&&!ye["before:highlightElement"]&&(ye["before:highlightElement"]=qe=>{ye["before:highlightBlock"](Object.assign({block:qe.el},qe))}),ye["after:highlightBlock"]&&!ye["after:highlightElement"]&&(ye["after:highlightElement"]=qe=>{ye["after:highlightBlock"](Object.assign({block:qe.el},qe))})}function ot(ye){rt(ye),Ke.push(ye)}function Ht(ye){const qe=Ke.indexOf(ye);qe!==-1&&Ke.splice(qe,1)}function un(ye,qe){const Ge=ye;Ke.forEach(function(Mt){Mt[Ge]&&Mt[Ge](qe)})}function hn(ye){return An("10.7.0","highlightBlock will be removed entirely in v12.0"),An("10.7.0","Please use highlightElement now."),Xe(ye)}Object.assign(W,{highlight:pt,highlightAuto:Ct,highlightAll:bi,highlightElement:Xe,highlightBlock:hn,configure:Ce,initHighlighting:zt,initHighlightingOnLoad:Gt,registerLanguage:Qi,unregisterLanguage:Si,listLanguages:He,getLanguage:U,registerAliases:ue,autoDetection:Ae,inherit:yi,addPlugin:ot,removePlugin:Ht}),W.debugMode=function(){$t=!1},W.safeMode=function(){$t=!0},W.versionString=Pt,W.regex={concat:x,lookahead:b,either:O,optional:w,anyNumberOfTimes:S};for(const ye in ct)typeof ct[ye]=="object"&&e(ct[ye]);return Object.assign(W,ct),W},qt=$s({});return qt.newInstance=()=>$s({}),nv=qt,qt.HighlightJS=qt,qt.default=qt,nv}var NW=RW();const Rs=zb(NW);function T2(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(d);const p={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],O={match:/(\/[a-z._-]+)+/},P=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],z=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["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"],j=["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:x,literal:C,built_in:[...P,...z,"set","shopt",...T,...j]},contains:[S,e.SHEBANG(),w,_,o,c,O,d,p,f,g,n]}}const A2="[A-Za-z$_][0-9A-Za-z$_]*",LW=["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"],MW=["true","false","null","undefined","NaN","Infinity"],ZR=["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"],JR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],QR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],OW=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],DW=[].concat(QR,ZR,JR);function R2(e){const t=e.regex,n=($,{after:q})=>{const X="</"+$[0].slice(1);return $.input.indexOf(X,q)!==-1},i=A2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,q)=>{const X=$[0].length+$.index,D=$.input[X];if(D==="<"||D===","){q.ignoreMatch();return}D===">"&&(n($,{after:X})||q.ignoreMatch());let V;const J=$.input.substring(X);if(V=J.match(/^\s*=/)){q.ignoreMatch();return}if((V=J.match(/^\s+extends\s+/))&&V.index===0){q.ignoreMatch();return}}},d={$pattern:A2,keyword:LW,literal:MW,built_in:DW,"variable.language":OW},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},P={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},z=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,{match:/\$\d+/},_];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const T=[].concat(P,b.contains),j=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:j},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={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:{_:[...ZR,...JR]}},ee={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ae={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B($){return t.concat("(?!",$.join("|"),")")}const N={match:t.concat(/\b/,B([...QR,"super","import"].map($=>`${$}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},R={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:j,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ee,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,P,{match:/\$\d+/},_,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,e.REGEXP_MODE,{className:"function",begin:E,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:d,contains:j}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},ae,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},R,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},N,K,H,A,{match:/\$[(.]/}]}}function jW(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function N2(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},_=e.inherit(f,{contains:[]}),b=e.inherit(g,{contains:[]});f.contains.push(b),g.contains.push(_);let S=[n,p];return[f,g,_,b].forEach(O=>{O.contains=O.contains.concat(S)}),S=S.concat(f,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,o,f,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,p,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function L2(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},g={begin:/\{\{/,relevance:0},_={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},C={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},O={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,x,_,e.HASH_COMMENT_MODE]}]};return f.contains=[_,x,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[p,x,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,C,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[O]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,O,_]}]}}const gp="[A-Za-z$_][0-9A-Za-z$_]*",eN=["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"],tN=["true","false","null","undefined","NaN","Infinity"],nN=["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"],iN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],sN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],aN=[].concat(sN,nN,iN);function IW(e){const t=e.regex,n=($,{after:q})=>{const X="</"+$[0].slice(1);return $.input.indexOf(X,q)!==-1},i=gp,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,q)=>{const X=$[0].length+$.index,D=$.input[X];if(D==="<"||D===","){q.ignoreMatch();return}D===">"&&(n($,{after:X})||q.ignoreMatch());let V;const J=$.input.substring(X);if(V=J.match(/^\s*=/)){q.ignoreMatch();return}if((V=J.match(/^\s+extends\s+/))&&V.index===0){q.ignoreMatch();return}}},d={$pattern:gp,keyword:eN,literal:tN,built_in:aN,"variable.language":rN},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},P={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},z=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,{match:/\$\d+/},_];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const T=[].concat(P,b.contains),j=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:j},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={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:{_:[...nN,...iN]}},ee={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ae={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B($){return t.concat("(?!",$.join("|"),")")}const N={match:t.concat(/\b/,B([...sN,"super","import"].map($=>`${$}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},R={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:j,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ee,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,P,{match:/\$\d+/},_,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,e.REGEXP_MODE,{className:"function",begin:E,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:d,contains:j}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},ae,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},R,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},N,K,H,A,{match:/\$[(.]/}]}}function M2(e){const t=e.regex,n=IW(e),i=gp,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},c={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:gp,keyword:eN.concat(p),literal:tN,built_in:aN.concat(r),"variable.language":rN},g={className:"meta",begin:"@"+i},_=(x,C,O)=>{const P=x.contains.findIndex(z=>z.label===C);if(P===-1)throw new Error("can not find mode to replace");x.contains.splice(P,1,O)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(g);const b=n.contains.find(x=>x.scope==="attr"),S=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,S]),n.contains=n.contains.concat([g,o,c,S]),_(n,"shebang",e.SHEBANG()),_(n,"use_strict",d);const w=n.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const BW=/\[\[wiki:([^\]]+)\]\]/g,PW=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,$W=/^(\S[^:]*?):[ \t]*(.*)$/,zW=new GR({gfm:!0,breaks:!1}),O2={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},iv=eq();function Fa(e,t={}){const{entries:n,content:i}=UW(e),r=GW(i,t.resolveWikiLink),o=zW.parse(r,{async:!1}),c=qW(n),d=Yu.sanitize(c+o,O2),p=new DOMParser().parseFromString(d,"text/html");return VW(p,t.omitDuplicateTitle),KW(p),YW(p),ZW(p),{html:Yu.sanitize(p.body.innerHTML,O2),toc:JW(p)}}function HW(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function FW(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new TextDecoder().decode(n)}function UW(e){const t=PW.exec(e);return t?{entries:WW(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function WW(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=$W.exec(i);if(r){const[,d="",p=""]=r;t.push({key:d.trim(),value:p.trim()});continue}const o=t[t.length-1];if(!o)continue;const c=i.trim();o.value=o.value?`${o.value} ${c}`:c}return t}function qW(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${Xu(n.key)}</dt><dd>${Xu(n.value)}</dd>`).join("")}</dl>`}function GW(e,t){return e.replace(BW,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return Xu(`[[wiki:${r}]]`);const o=t(r);if(o===null)return Xu(`[[wiki:${r}]]`);const c=Xu(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${c}</a>`})}function KW(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=iq(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function VW(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||D2(n.textContent??"")===D2(t)&&n.remove()}function YW(e){for(const t of e.querySelectorAll("pre > code")){const n=tq(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const c=e.createElement("div");c.className="diagram-block",c.setAttribute("data-mermaid-source",HW(i)),c.setAttribute("data-diagram-state","pending"),r.replaceWith(c);continue}const o=QW(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(XW(e,n||"text"),r.firstChild)}}function XW(e,t){const n=e.createElement("div");n.className="code-block-toolbar";const i=e.createElement("span");i.className="code-block-dots",i.setAttribute("aria-hidden","true");for(let c=0;c<3;c++)i.append(e.createElement("span"));const r=e.createElement("span");r.className="code-block-language",r.textContent=t;const o=e.createElement("button");return o.className="copy-code",o.type="button",o.dataset.action="copy-code",o.setAttribute("aria-label",`Copy ${t} code`),o.textContent="Copy",n.append(i,r,o),n}function ZW(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";nq(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function JW(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 QW(e,t){return t&&iv.getLanguage(t)?iv.highlight(e,{language:t}).value:iv.highlightAuto(e).value}function eq(){return Rs.registerLanguage("bash",T2),Rs.registerLanguage("sh",T2),Rs.registerLanguage("javascript",R2),Rs.registerLanguage("js",R2),Rs.registerLanguage("json",jW),Rs.registerLanguage("markdown",N2),Rs.registerLanguage("md",N2),Rs.registerLanguage("python",L2),Rs.registerLanguage("py",L2),Rs.registerLanguage("typescript",M2),Rs.registerLanguage("ts",M2),Rs}function tq(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function nq(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function iq(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function D2(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Xu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const sq="modulepreload",rq=function(e){return"/console/"+e},j2={},aq=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");r=p(n.map(f=>{if(f=rq(f),f in j2)return;j2[f]=!0;const g=f.endsWith(".css"),_=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${_}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":sq,g||(b.as="script"),b.crossOrigin="",b.href=f,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return r.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},oq=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",lq=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),cq=/^on/i,uq={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},I2="diagramInteractionBound",hq=/^oklch\s*\(\s*([^)]+)\s*\)$/i,dq=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Os=[25,50,75,100,125,150,200],fq=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let sv=null;const B2=new WeakSet;let pq=0,mq=0,ph=null;function ja(e){const t=e.trim();if(!t)return t;const n=Bq(t);return n?Pq(n):t}function H0(e){if(B2.has(e))return;B2.add(e),P2(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){ph&&!ph.trigger.isConnected&&Fu(!1);for(const c of o.addedNodes)if(c instanceof Element&&(c.matches?.(".diagram-block[data-mermaid-source]")||c.querySelector?.(".diagram-block[data-mermaid-source]"))){r=!0;break}if(r)break}r&&P2(e)}).observe(t,{childList:!0,subtree:!0})}function P2(e){const t=e.querySelectorAll(oq);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",gq(n))}async function gq(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=FW(t)}catch{rv(e,"Invalid diagram source");return}if(!n.trim()){rv(e,"Empty diagram source");return}try{const i=await vq(),r=`mermaid-diagram-${++pq}`,{svg:o}=await i.render(r,n);e.innerHTML=_q(o),Sq(e,o),wq(e),xq(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);rv(e,r)}}function rv(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function _q(e){const t=(n,i)=>{cq.test(i.attrName)&&(i.keepAttr=!1)};Yu.addHook("uponSanitizeAttribute",t);try{return Yu.sanitize(e,uq)}finally{Yu.removeHook("uponSanitizeAttribute",t)}}async function vq(){return sv||(sv=(async()=>{const e=await aq(()=>import("./mermaid.core-BBFWA-zA.js").then(n=>n.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:yq(),themeCSS:bq(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),sv}function yq(){const e=getComputedStyle(document.documentElement),t=(x,C)=>{const O=e.getPropertyValue(x).trim();return ja(O||C)},n=(x,C)=>e.getPropertyValue(x).trim()||C,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),c=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),p=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),_=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,c,p,ja("oklch(70% 0.11 68)"),d,ja("oklch(76% 0.09 205)"),o,ja("oklch(68% 0.14 30)"),g,ja("oklch(62% 0.08 228)"),ja("oklch(52% 0.05 248)")],w=Object.fromEntries(fq.map((x,C)=>[x,S[C]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:_,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:_,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:d,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:_,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:_,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function bq(){const e=getComputedStyle(document.documentElement),t=(f,g)=>{const _=e.getPropertyValue(f).trim();return ja(_||g)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),c=ja("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
|
|
176
|
-
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
177
|
-
stroke: ${n};
|
|
178
|
-
fill: ${d};
|
|
179
|
-
}
|
|
180
|
-
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
181
|
-
stroke: ${r};
|
|
182
|
-
}
|
|
183
|
-
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
184
|
-
fill: ${p};
|
|
185
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
186
|
-
}
|
|
187
|
-
.pieCircle {
|
|
188
|
-
stroke: ${n};
|
|
189
|
-
stroke-width: 1.35px;
|
|
190
|
-
opacity: 0.96;
|
|
191
|
-
filter: drop-shadow(0 0 1.5px ${c});
|
|
192
|
-
}
|
|
193
|
-
.pieOuterCircle {
|
|
194
|
-
stroke: ${i};
|
|
195
|
-
opacity: 0.7;
|
|
196
|
-
}
|
|
197
|
-
.slice, .legend text, .pieTitleText {
|
|
198
|
-
fill: ${p};
|
|
199
|
-
paint-order: stroke;
|
|
200
|
-
stroke: ${o};
|
|
201
|
-
stroke-width: 3px;
|
|
202
|
-
stroke-linejoin: round;
|
|
203
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
204
|
-
}
|
|
205
|
-
.slice {
|
|
206
|
-
font-weight: 600;
|
|
207
|
-
letter-spacing: 0.04em;
|
|
208
|
-
font-style: italic;
|
|
209
|
-
}
|
|
210
|
-
.pieTitleText {
|
|
211
|
-
font-weight: 600;
|
|
212
|
-
letter-spacing: 0.12em;
|
|
213
|
-
font-style: italic;
|
|
214
|
-
}
|
|
215
|
-
.legend text {
|
|
216
|
-
font-weight: 500;
|
|
217
|
-
letter-spacing: 0.03em;
|
|
218
|
-
}
|
|
219
|
-
.legend rect {
|
|
220
|
-
rx: 999px;
|
|
221
|
-
ry: 999px;
|
|
222
|
-
opacity: 0.9;
|
|
223
|
-
stroke: ${o};
|
|
224
|
-
stroke-width: 1.5px;
|
|
225
|
-
paint-order: stroke;
|
|
226
|
-
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
|
|
227
|
-
}
|
|
228
|
-
`}function Sq(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,r.length);for(let c=0;c<o;c++){const d=i[c],p=r[c];if(!d||!p)continue;const f=d.getAttribute("href")??d.getAttribute("xlink:href")??"",g=lN(f);g&&p.setAttribute("href",g)}}function wq(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:r,width:o,height:c}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(c)||i<0||r<0||o<=0||c<=0||t.setAttribute("viewBox",`${Hl(i)} ${Hl(r)} ${Hl(o)} ${Hl(c)}`)}function xq(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),Dq(e),e.dataset[I2]!=="true"&&(e.dataset[I2]="true",e.addEventListener("click",Cq),e.addEventListener("keydown",kq))}function Cq(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||_p(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),oN(t))}function kq(e){if(e.key!=="Enter"&&e.key!==" "||_p(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),oN(t))}function oN(e){const t=e.querySelector("svg");if(!t)return;Fu(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++mq,o=`diagram-lightbox-title-${r}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const c=document.createElement("div");c.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const p=document.createElement("h2");p.id=o,p.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const _=of("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=of("+","Zoom in","in"),w=of("Fit","Fit diagram to viewport","fit"),x=of("Reset","Reset diagram zoom","reset");g.append(_,b,S,w,x);const C=document.createElement("div");C.className="diagram-lightbox__viewport";const O=Aq(t),P=t.cloneNode(!0);P.removeAttribute("style"),Nq(P,`diagram-lightbox-svg-${r}`),C.append(P),d.append(p,g,f),c.append(d,C),i.append(c),document.body.append(i);const z=new Eq(C,P,b,O);_.addEventListener("click",()=>z.zoomOut()),S.addEventListener("click",()=>z.zoomIn()),w.addEventListener("click",()=>z.fit()),x.addEventListener("click",()=>z.reset());const T=Lq(i),j=F=>{(F.target===i||F.target===f)&&Fu(!0)},M=F=>{if(F.key==="Escape"){F.preventDefault(),Fu(!0);return}z.handleKeyboard(F)||F.key==="Tab"&&Oq(F,i)},H={dialog:i,trigger:e,inertStates:T,onClick:j,onKeyDown:M,cleanupPanZoom:()=>z.destroy()};n&&(H.onCancel=F=>{F.preventDefault(),Fu(!0)},i.addEventListener("cancel",H.onCancel),i.showModal()),i.addEventListener("click",j),document.addEventListener("keydown",M,!0),ph=H,z.fit(),f.focus()}function of(e,t,n){const i=document.createElement("button");return i.className="diagram-lightbox__zoom-button",i.type="button",i.dataset.zoomAction=n,i.setAttribute("aria-label",t),i.textContent=e,i}class Eq{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Os.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,Os.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Os.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Os.findIndex(d=>d>r),c=o===-1?Os.length-1:Math.max(0,o-1);this.applyZoom(c),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-n)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(lf(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(lf(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=lf(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Hl(this.baseSize.width*i)),this.svg.setAttribute("height",Hl(this.baseSize.height*i)),this.readout.textContent=`${n}%`}zoomAroundViewportCenter(t){const n=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,n.left+n.width/2,n.top+n.height/2)}zoomAroundPoint(t,n,i){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,c=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+n-c.left,p=this.viewport.scrollTop+i-c.top;this.applyZoom(t),this.viewport.scrollLeft=d/r*this.svgWidth-(n-c.left),this.viewport.scrollTop=p/o*this.svgHeight-(i-c.top)}onPointerDown=t=>{if(t.button!==0||_p(t.target))return;const n=t.pointerId??1;if(this.pointers.set(n,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:n},this.viewport.setPointerCapture?.(n)};onPointerMove=t=>{const n=t.pointerId??1;if(this.pointers.has(n)&&this.pointers.set(n,t),this.pinchStart&&this.pointers.size>=2){const i=this.pointerDistance()/this.pinchStart.distance,r=lf(this.pinchStart.zoomIndex)*i;this.applyZoom(Rq(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Os.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{_p(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Os.indexOf(200)?Os.indexOf(100):Os.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function Tq(e){const t=$2(e.getAttribute("width")),n=$2(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=i[2],o=i[3],c=r!==void 0&&Number.isFinite(r)&&r>0?r:null,d=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??c??800,height:n??d??600}}function Aq(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:Tq(e)}function $2(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function Hl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Rq(e){let t=0,n=Number.POSITIVE_INFINITY;return Os.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function lf(e){return Os[e]??Os[0]}function Nq(e,t){const n=e.getAttribute("id")??"";e.setAttribute("id",t);const i=e.querySelector("style");!n||!i?.textContent||(i.textContent=i.textContent.split(`#${n}`).join(`#${t}`))}function Fu(e){const t=ph;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),Mq(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),ph=null,e&&t.trigger.isConnected&&t.trigger.focus())}function Lq(e){const t=[];for(const n of Array.from(document.body.children))!(n instanceof HTMLElement)||n===e||(t.push({element:n,ariaHidden:n.getAttribute("aria-hidden"),inert:n.inert}),n.inert=!0,n.setAttribute("aria-hidden","true"));return t}function Mq(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 Oq(e,t){const n=Array.from(t.querySelectorAll(lq)).filter(Iq);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function Dq(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function _p(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!jq(t)}function jq(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function Iq(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function lN(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let i;try{i=new URL(t)}catch{return null}return i.origin!==window.location.origin?null:lN(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let r;try{r=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(r)?`/entry/${encodeURIComponent(r)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function Bq(e){const t=hq.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",c=r.trim().split(/[\s,]+/).filter(Boolean);if(c.length!==3)return null;const[d,p,f]=c;if(!d||!p||!f)return null;const g=av(d,1),_=av(p,.4),b=$q(f);if(g===null||_===null||b===null)return null;let S=1;if(i>=0){const w=av(o,1);if(w===null)return null;S=w}return{L:g,C:_,h:b,alpha:S}}function Pq(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),r=e.L,o=r+.3963377774*n+.2158037573*i,c=r-.1055613458*n-.0638541728*i,d=r-.0894841775*n-1.291485548*i,p=o**3,f=c**3,g=d**3,_=4.0767416621*p-3.3077115913*f+.2309699292*g,b=-1.2684380046*p+2.6097574011*f-.3413193965*g,S=-.0041960863*p-.7034186147*f+1.707614701*g,w=cf(ov(_)),x=cf(ov(b)),C=cf(ov(S));if(e.alpha<1){const O=cf(e.alpha);return`#${vo(w)}${vo(x)}${vo(C)}${vo(O)}`}return`#${vo(w)}${vo(x)}${vo(C)}`}function av(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function $q(e){const t=dq.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function ov(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 cf(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function vo(e){return e.toString(16).padStart(2,"0")}const zq=new Set([".png",".jpg",".jpeg",".webp",".gif"]),Hq=new Set(["img.shields.io"]),Fq=/^[a-z][a-z0-9+.-]*:/i;function z2(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||Fq.test(n))return null;const i=cN(n);if(!i)return null;const r=qq(i);return r===null?null:Gq(r,t)}function Uq(e){const t=cN(e).toLowerCase();return[...zq].some(n=>t.endsWith(n))}function H2(e,t,n=null){const i=n?`${n.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${i}${t}`)}`}function Wq(e){try{const t=new URL(e);return t.protocol==="https:"&&Hq.has(t.hostname)}catch{return!1}}function cN(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function qq(e){try{return decodeURI(e)}catch{return null}}function Gq(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),r=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${r}/${n}`,c=[];for(const d of o.split("/"))if(!(!d||d===".")){if(d===".."){if(c.length===0)return null;c.pop();continue}c.push(d)}return c.length>0?c.join("/"):null}function Kq({content:e,onOpenPath:t,relativePath:n,theaterId:i,contextRelPath:r,truncated:o}){const c=y.useMemo(()=>{const b=Fa(e).html,S=new DOMParser().parseFromString(b,"text/html");return lv(S.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i,contextRelPath:r}),S.body.innerHTML},[e,n,i,r]),d=y.useRef(null);y.useEffect(()=>{const b=d.current;if(!b)return;H0(b),lv(b,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,contextRelPath:r});const S=new MutationObserver(()=>lv(b,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,contextRelPath:r}));return S.observe(b,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>S.disconnect()},[c,n,i,r]);const p=y.useCallback(b=>{const S=b.target.closest('[data-action="copy-code"]');if(!S)return;const w=S.closest("pre")?.getAttribute("data-code");if(!w)return;navigator.clipboard?.writeText(w);const x=S.textContent;S.textContent="Copied",window.setTimeout(()=>{S.textContent=x},1200)},[]),f=y.useCallback(b=>{const w=b.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(b.preventDefault(),t(x))},[t]),g=y.useCallback(b=>{if(b.key!=="Enter"&&b.key!==" ")return;const w=b.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(b.preventDefault(),t(x))},[t]),_=y.useCallback(b=>{p(b),f(b)},[p,f]);return u.jsxs("div",{className:"fexp-md-wrap",children:[o&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:d,className:"markdown-body",onClick:_,onKeyDown:g,dangerouslySetInnerHTML:{__html:c}})]})}function lv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=z2(i,t.currentRelativePath);r?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",r),n.removeAttribute("aria-disabled")):i&&!/^(https?:|mailto:|#)/i.test(i)&&(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const i=n.getAttribute("src")??"",r=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&i===H2(t.theaterId,r,t.contextRelPath)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&Wq(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=z2(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&Uq(o)){n.setAttribute("src",H2(t.theaterId,o,t.contextRelPath)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&Vq(n)}}function Vq(e){const t=e.getAttribute("alt")?.trim(),n=e.ownerDocument.createElement("span");n.className="fexp-md-blocked-image",n.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(n)}const Yq=360,F0=248,U0=200,vp=160,yp=4;function Xq(e){return e-U0-yp>=vp}function Zq(e,t,n){const i=n-U0-yp;return i<vp?e:Math.max(vp,Math.min(i,e-t))}function Jq(e){const t=U0+yp;return`minmax(0, 1fr) ${yp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Qq(e){return e?Yq:null}const uN="fleet-console.file-explorer.treePaneWidth",W0={selectedPath:null,viewState:{kind:"none"}},eG={...W0,treePaneWidth:F0},hN=new Map,F2=new Map,lb=new Set;let bp=rG();function tG(e){return y.useSyncExternalStore(sG,()=>iG(e),()=>eG)}function U2(e,t){e&&pN(e,{selectedPath:t})}function Ra(e,t){e&&pN(e,{viewState:t})}function nG(e){bp=mN(e);try{localStorage.setItem(uN,String(bp))}catch{}dN()}function dN(){for(const e of lb)e()}function fN(e){return hN.get(e)??W0}function iG(e){const t=e??"__none__",n=e!=null?fN(e):W0,i=F2.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===bp)return i;const r={...n,treePaneWidth:bp};return F2.set(t,r),r}function pN(e,t){hN.set(e,{...fN(e),...t}),dN()}function sG(e){return lb.add(e),()=>{lb.delete(e)}}function rG(){try{return mN(Number(localStorage.getItem(uN)))}catch{return F0}}function mN(e){return!Number.isFinite(e)||e<=0?F0:Math.max(vp,Math.round(e))}const aG=new Set([".png",".jpg",".jpeg",".webp",".gif"]),oG={id:"file-explorer",title:"Files",icon:uG,pathAware:!0,render:e=>u.jsx(cG,{...e})};function lG(e,t){return{listFolder:async n=>{if(!e)throw new Error("no_theater");const i=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:nb(t,n??"")})});if(!i.ok){const c=await i.json();throw new Error(c.error??"list_failed")}const r=await i.json(),o=LR(t,r);if(!o)throw new Error("context_boundary");return o}}}function cG(e){const{theaterId:t}=e,n=e.pathContext.relPath,i=tU(t,n),{selectedPath:r,viewState:o,treePaneWidth:c}=tG(i),d=y.useRef(c);d.current=c;const p=y.useRef(null),[f,g]=y.useState(!1),_=y.useMemo(()=>lG(t,n),[t,n]),b=y.useCallback(async(O,P)=>{if(!t){Ra(t,{kind:"error",message:"no_theater"});return}U2(i,O);const z=P??O.split("/").filter(Boolean).at(-1)??O,T=z.slice(z.lastIndexOf(".")).toLowerCase();if(aG.has(T)){const j=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(nb(n,O)??"")}`:"";Ra(i,{kind:"image",relativePath:O,name:z,src:j});return}Ra(i,{kind:"loading"});try{const j=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:nb(n,O)})});if(!j.ok){const F=await j.json();throw new Error(F.error??"read_failed")}const M=await j.json();if(M.binary){Ra(i,{kind:"binary",name:z});return}const H=LR(n,{relativePath:M.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(H===void 0)throw new Error("context_boundary");Ra(i,{kind:"code",relativePath:H,content:M.content,lang:M.lang,truncated:M.truncated})}catch(j){const M=j instanceof Error?j.message:"Unable to load file";M==="binary_file"?Ra(i,{kind:"binary",name:z}):Ra(i,{kind:"error",message:M})}},[n,i,t]),S=y.useCallback(async O=>{O.kind==="file"&&await b(O.relativePath,O.name)},[b]),w=y.useCallback(()=>{Ra(i,{kind:"none"}),U2(i,null)},[i]),x=y.useCallback(O=>{O.preventDefault();const P=p.current;if(!P)return;const z=P.getBoundingClientRect().width;if(!Xq(z))return;const T=O.clientX,j=d.current;g(!0);const M=F=>{const ee=F.clientX-T,ae=Zq(j,ee,z);d.current=ae,nG(ae)},H=()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",H),g(!1)};document.addEventListener("pointermove",M),document.addEventListener("pointerup",H)},[]),C=o.kind!=="none";return y.useLayoutEffect(()=>{e.requestExtraWidth?.(Qq(C))},[e,C]),u.jsxs("div",{ref:p,className:`fexp-root${C?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:C?{gridTemplateColumns:Jq(c)}:void 0,children:[C&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:o.kind!=="loading"&&o.kind!=="error"?"relativePath"in o?o.relativePath:o.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:w,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[o.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),o.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:o.message}),o.kind==="code"&&o.lang==="markdown"&&u.jsx(Kq,{content:o.content,onOpenPath:b,relativePath:o.relativePath,theaterId:t,truncated:o.truncated,contextRelPath:n}),o.kind==="code"&&o.lang!=="markdown"&&u.jsx(yU,{content:o.content,lang:o.lang,truncated:o.truncated}),o.kind==="image"&&u.jsx(wU,{src:o.src,name:o.name}),o.kind==="binary"&&u.jsx(lU,{name:o.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:x,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(rU,{files:_,theaterId:t,contextKey:i,contextRelPath:n,selectedPath:r,onSelect:S},i)})]})}function uG(){return u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const hG={id:"file-explorer",railPanels:[oG]},dG=[hG],fG={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function pG(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(n)}return t}function gN({files:e,selectedPath:t,onSelect:n}){const i=pG(e);return u.jsx(_N,{node:i,depth:0,selectedPath:t,onSelect:n})}function _N({node:e,depth:t,selectedPath:n,onSelect:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>u.jsx(mG,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>u.jsx(gG,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function mG({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(!1),d=y.useCallback(()=>c(_=>!_),[]);let p=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const _=Object.keys(f.dirs)[0];p+="/"+_,f=f.dirs[_]}const g=n*16+12;return u.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${g}px`},onClick:d,"aria-expanded":!o,children:[u.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-folder-name",children:p})]}),!o&&u.jsx(_N,{node:f,depth:n+1,selectedPath:i,onSelect:r})]})}function gG({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=y.useCallback(()=>i(e),[e,i]),c=t*16+12,d=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`repository-file-row${r?" is-cur":""}`,style:{paddingLeft:`${c}px`},title:e.path,onClick:o,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:fG[e.status]??e.status}),u.jsx("span",{className:"repository-file-name",children:u.jsx("span",{className:"repository-file-fn",children:d})}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const W2="fleet-console.diff.changesCollapsed",_G={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function vG(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function yG(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function bG({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[c,d]=y.useState(()=>yG(W2)),p=y.useCallback(()=>{d(_=>{const b=!_;try{localStorage.setItem(W2,b?"1":"0")}catch{}return b})},[]),f=y.useMemo(()=>e.kind==="ok"?vG(e.files,o):[],[o,e]);if(e.kind==="loading")return u.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const _=e.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=e.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return u.jsxs("div",{className:"repository-sections-notice",children:[u.jsx("strong",{className:"repository-notice-title",children:_}),u.jsx("span",{className:"repository-notice-body",children:b}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]})}if(e.kind==="error")return u.jsxs("div",{className:"repository-sections-error",children:[u.jsx("span",{children:e.message}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]});const g=o?`${f.length}/${e.files.length}`:String(e.files.length);return u.jsx("div",{className:"repository-sections",children:u.jsxs("div",{className:`repository-section${c?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-section-head",onClick:p,children:[u.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-section-name",children:"Changes"}),u.jsx("span",{className:"repository-count-badge",children:g})]}),!c&&u.jsx("div",{className:"repository-section-rows",children:f.length===0?u.jsx("div",{className:"repository-empty-row",children:o?"No matching items":"No changes"}):n==="tree"?u.jsx(gN,{files:f,selectedPath:i,onSelect:r}):f.map(_=>u.jsx(vN,{entry:_,isSelected:_.path===i,onSelect:r},_.path))})]})})}function vN({entry:e,isSelected:t,onSelect:n}){const i=y.useCallback(()=>n(e),[e,n]),r=e.path.endsWith("/")?e.path.slice(0,-1):e.path,o=r.lastIndexOf("/"),c=o>=0?r.slice(0,o+1):"",d=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return u.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":_G[e.status]??e.status,children:e.status}),u.jsxs("span",{className:"repository-file-name",children:[u.jsx("span",{className:"repository-file-fn",children:d}),c&&u.jsx("span",{className:"repository-file-dir",children:c})]}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}function yN(e,t){return JSON.stringify([e,t])}const cb=new Set;let q0={file:null};function bN(){for(const e of cb)e()}function SG(e){return cb.add(e),()=>{cb.delete(e)}}function q2(){return q0}function wG(e,t){const n=y.useSyncExternalStore(SG,q2,q2);return!n.file||n.file.theaterId!==e||n.file.subPath!==t?null:n.file}function xG(e,t,n){q0={file:{entry:e,subPath:t,theaterId:n}},bN()}function G2(){q0={file:null},bN()}const CG=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 kG(e){let t="",n=0;const i=(r,o)=>`<span class="repository-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,c=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(c,n));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[n-1]??"")){const o=n;for(;n<e.length&&/[0-9.xXa-fA-F]/.test(e[n]);)n++;t+=i("number",e.slice(o,n));continue}if(/[A-Za-z_$]/.test(r)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const c=e.slice(o,n);t+=CG.has(c)?i("keyword",c):/^[A-Z]/.test(c)?i("type",c):c;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const EG=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,TG=/^diff --git a\/(.+) b\/(.+)$/;function AG(e){if(!e)return[];const t=e.split(`
|
|
229
|
-
`);t[t.length-1]===""&&t.pop();const n=[];let i=0,r=0,o=!0;for(const c of t)if(!c.startsWith("\\")){if(c.startsWith("diff --git ")){const d=TG.exec(c),p=d?.[1],f=d?.[2]??c,g=p!==void 0&&p!==f?p:void 0;n.push({kind:"file-label",text:f,oldPath:g}),o=!0;continue}if(o){if(c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("rename from ")||c.startsWith("rename to ")||c.startsWith("similarity index")||c.startsWith("dissimilarity index")){n.push({kind:"meta",text:c});continue}if(c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ "))continue;if(!c.startsWith("@@")){c!==""&&n.push({kind:"ctx",text:` ${c}`});continue}}if(c.startsWith("@@")){o=!1;const d=EG.exec(c);if(d){i=parseInt(d[1]??"0",10),r=parseInt(d[2]??"0",10);const p=d[3]?.trimEnd()??"",f=`@@ -${d[1]??""} +${d[2]??""} @@${p?` ${p.trimStart()}`:""}`;n.push({kind:"hunk-label",text:f})}else n.push({kind:"hunk-label",text:c});continue}c.startsWith("+")?n.push({kind:"add",text:c,newLine:r++}):c.startsWith("-")?n.push({kind:"del",text:c,oldLine:i++}):n.push({kind:"ctx",text:c,oldLine:i++,newLine:r++})}return n}function uf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function SN({ctx:e,file:t,mode:n,subPath:i,commit:r}){const[o,c]=y.useState({kind:"loading"});if(y.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let g=!1;return c({kind:"loading"}),r?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,ref:r.fullHash,filePath:t.path,...t.oldPath??r.oldPath?{oldPath:t.oldPath??r.oldPath}:{},subPath:r.subPath})}).then(async _=>{if(!_.ok)throw new Error((await _.json()).error??"git_failed");const b=await _.json();g||c({kind:"ok",result:b})}).catch(_=>{g||c({kind:"error",message:_ instanceof Error?_.message:"unknown"})}):e.api.fetch("repository","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,filePath:t.path,mode:n,subPath:i})}).then(async _=>{if(!_.ok)throw new Error((await _.json()).error??"git_failed");const b=await _.json();g||c({kind:"ok",result:b})}).catch(_=>{g||c({kind:"error",message:_ instanceof Error?_.message:"unknown"})}),()=>{g=!0}},[e.api,e.theaterId,t.oldPath,t.path,n,i,r]),o.kind==="loading")return u.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(o.kind==="error")return u.jsx("div",{className:"repository-hunk-error",children:o.message});const{result:d}=o,f=AG(d.content).filter(g=>g.kind!=="file-label");return u.jsxs("div",{className:"repository-hunk-wrap",children:[d.truncated&&u.jsx("div",{className:"repository-truncated-badge",children:"Diff truncated"}),u.jsx("div",{className:"repository-hunk-scroll",children:u.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:f.map((g,_)=>u.jsx("tr",{className:`repository-line repository-line-${g.kind}`,children:g.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:uf(g.text)}}):g.kind==="meta"?u.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:uf(g.text)}}):g.kind==="file-label"?u.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:uf(g.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"repository-gutter repository-gutter-old",children:g.oldLine??""}),u.jsx("td",{className:"repository-gutter repository-gutter-new",children:g.newLine??""}),u.jsx("td",{className:"repository-marker",children:g.kind==="add"?"+":g.kind==="del"?"−":""}),u.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:kG(uf(g.text.length>0?g.text.slice(1):g.text))}})]})},_))})})})]})}const ub=12,Al=28,cv=3,RG=5,K2=["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 ku(e){return e*ub+6}function yo(e){return K2[e%K2.length]??"var(--ink-fog)"}function NG({node:e,laneCount:t,collapsed:n=!1}){const i=Math.max(t,1),r=n?10:0,o=i*ub+r,c=ku(e.lane),d=Al/2;return u.jsxs("svg",{width:o,height:Al,viewBox:`0 0 ${o} ${Al}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(p=>u.jsx("line",{x1:ku(p),y1:0,x2:ku(p),y2:Al,stroke:yo(p),strokeWidth:1.5},`pt-${p}`)),e.connectAbove&&u.jsx("line",{x1:c,y1:0,x2:c,y2:d-cv,stroke:yo(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:c,y1:d+cv,x2:c,y2:Al,stroke:yo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(p=>u.jsx("line",{x1:ku(p),y1:0,x2:c,y2:d,stroke:yo(p),strokeWidth:1.5,strokeLinecap:"round"},`mf-${p}`)),e.branchToLanes.map(p=>u.jsx("line",{x1:c,y1:d,x2:ku(p),y2:Al,stroke:yo(p),strokeWidth:1.5,strokeLinecap:"round"},`bt-${p}`)),e.isHead&&u.jsx("circle",{cx:c,cy:d,r:RG,fill:"none",stroke:yo(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:c,cy:d,r:cv,fill:yo(e.lane)}),n&&u.jsx("text",{x:i*ub+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const uv=8;function LG(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,r=0;for(let o=0;o<e.length;o++){const c=e[o],d=c.fullHash,p=[...c.parents],f=[];for(let x=0;x<t.length;x++)t[x]===d&&f.push(x);let g,_=!1;const b=[];if(f.length===0){const x=t.indexOf(null);x>=0?g=x:t.length<uv?(g=t.length,t.push(null)):(i=!0,g=uv-1,t[g]=null,_=!0)}else{g=Math.min(...f);for(const x of f)x!==g&&(b.push(x),t[x]=null)}const S=[];if(p.length===0)t[g]=null;else{t[g]=_?null:p[0]??null;for(const x of p.slice(1))if(!(t.indexOf(x)>=0)){const O=t.indexOf(null);if(O>=0)t[O]=x,S.push(O);else if(t.length<uv){const P=t.length;t.push(x),S.push(P)}else i=!0}}const w=t.map((x,C)=>({h:x,i:C})).filter(({h:x,i:C})=>x!==null&&C!==g).map(({i:x})=>x);r=Math.max(r,g,...S,...w),n.push({lane:g,isHead:c.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[g]===p[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function wN(e,t=new Date){const n=new Date(e*1e3);if(!Number.isFinite(n.getTime()))return"—";const i=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),c=Math.round((r-o)/864e5);return c===0?`Today ${i}`:c===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function G0(e){const t=[];for(const n of e.refs)if(n==="HEAD")t.push({label:"HEAD",kind:"head"});else if(n.startsWith("HEAD -> refs/heads/"))t.push({label:n.slice(19),kind:"branch"});else if(n.startsWith("HEAD -> "))t.push({label:n.slice(8),kind:"branch"});else if(n.startsWith("tag: refs/tags/"))t.push({label:n.slice(15),kind:"tag"});else if(n.startsWith("tag: "))t.push({label:n.slice(5),kind:"tag"});else if(n.startsWith("refs/remotes/")){const i=n.slice(13);i.endsWith("/HEAD")||t.push({label:i,kind:"remote"})}else n.startsWith("refs/worktrees/")?t.push({label:n.slice(15),kind:"worktree"}):n.startsWith("refs/heads/")?t.push({label:n.slice(11),kind:"branch"}):t.push({label:n,kind:"branch"});return t}const xN=140,CN=120,kN=160,Vr=4,EN=null;function MG({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const c=n-r-o;return c<i?EN:Math.max(i,Math.min(c,e-t))}function OG(e){const t=xN+Vr;return`minmax(0, 1fr) ${Vr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function DG(e){const t=kN+Vr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Vr}px minmax(0, 1fr)`}function TN(e,t,n,i,r,o=Vr){const c=n-r-o;return c<i?EN:Math.max(i,Math.min(c,e+t))}function jG(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Vr}px minmax(120px, 1fr)`}function IG(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Vr}px minmax(140px, 1fr)`}function AN({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",c),t.removeEventListener("blur",c)},c=()=>{r&&(r=!1,o(),i())},d=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),t.addEventListener("blur",c),d}const RN="fleet-console.history.logHeight",V2="fleet-console.history.headerHeight",Y2="fleet-console.history.fileListWidth",NN="fleet-console.history.filesView",BG=240,PG=214,$G=180;function zG(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function HG(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.subject.toLowerCase().includes(n)||i.authorName.toLowerCase().includes(n)||i.shortHash.toLowerCase().includes(n)||i.fullHash.toLowerCase().includes(n)||i.refs.some(r=>r.toLowerCase().includes(n))||G0(i).some(r=>r.label.toLowerCase().includes(n))):e}function FG(e){return e==="Escape"}function UG(e){return e.reduce((t,n)=>({files:t.files+1,additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{files:0,additions:0,deletions:0})}function WG(e,t,n){return e.files>0&&!t&&!n}function X2({current:e}){return e?u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.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 qG({entry:e,checkouts:t,selected:n,graphNode:i,laneCount:r,layoutCollapsed:o,onSelect:c}){const d=G0(e),p=zG(e,t);return u.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>c(e),children:[u.jsx("span",{className:"history-commit-subject",children:e.subject}),u.jsx("span",{className:"history-commit-sha",children:e.shortHash}),u.jsx("span",{className:"history-commit-time",children:wN(e.authorAt)}),u.jsxs("span",{className:"history-commit-badges",children:[d.map(f=>{const g=f.kind==="branch"?t.find(_=>_.branch===f.label):null;return u.jsxs("span",{className:`history-badge history-badge--${f.kind}`,children:[g&&u.jsx(X2,{current:g.isCurrent}),f.label]},`${f.kind}:${f.label}`)}),p&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(X2,{current:p.isCurrent}),"detached"]})]}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(NG,{node:i,laneCount:r,collapsed:o})})]})}function GG({ctx:e,target:t,onSelectCommit:n,onClose:i}){const[r,o]=y.useState({kind:"loading"}),[c,d]=y.useState("details"),[p,f]=y.useState(null),[g,_]=y.useState(!1),[b,S]=y.useState(()=>hb(V2,PG)),[w,x]=y.useState(()=>hb(Y2,$G)),[C,O]=y.useState(ZG),P=y.useRef(null),z=y.useRef(null),T=y.useRef(null),j=y.useRef(b),M=y.useRef(w),H=y.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??"",subPath:e.pathContext.relPath??""}),[t.fullHash,e.theaterId,e.pathContext.relPath]);y.useEffect(()=>{let ae=!1;return o({kind:"loading"}),e.api.fetch("repository","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,ref:t.fullHash,subPath:e.pathContext.relPath??""})}).then(async K=>{if(!K.ok)throw new Error((await K.json()).error??"git_failed");return K.json()}).then(K=>{ae||(o({kind:"ok",result:K}),f(K.files[0]?.path??null))}).catch(K=>{ae||o({kind:"error",message:K instanceof Error?K.message:"unknown"})}),()=>{ae=!0}},[e.api,e.pathContext.relPath,e.theaterId,t.fullHash]),y.useEffect(()=>()=>T.current?.(),[]);const F=y.useCallback((ae,K)=>{ae.preventDefault();const B=K==="y"?P.current:z.current;if(!B)return;const N=K==="y"?j.current:M.current,R=K==="y"?ae.clientY:ae.clientX,A=K==="y"?B.getBoundingClientRect().height:B.getBoundingClientRect().width;T.current?.(),T.current=AN({documentTarget:document,windowTarget:window,onMove:E=>{const L=E,$=TN(N,(K==="y"?L.clientY:L.clientX)-R,A,120,120);$!==null&&(K==="y"?(j.current=$,S($)):(M.current=$,x($)))},onFinish:()=>{const E=K==="y"?j.current:M.current;try{localStorage.setItem(K==="y"?V2:Y2,String(E))}catch{}T.current=null}})},[]),ee=r.kind==="loading"?u.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):r.kind==="error"?u.jsx("div",{className:"history-inspector-empty history-inspector-error",children:r.message}):(()=>{const{meta:ae,files:K}=r.result,B=K.find(q=>q.path===p)??K[0]??null,N=K.reduce((q,X)=>q+X.additions,0),R=K.reduce((q,X)=>q+X.deletions,0),A=t.entry,E=(q,X)=>{f(q.path),X&&d("changes")},L=q=>{O(q);try{localStorage.setItem(NN,q)}catch{}},$=()=>{const q=navigator.clipboard?.writeText(t.fullHash);q&&q.then(()=>{_(!0),window.setTimeout(()=>_(!1),1200)}).catch(()=>{})};return c==="details"?u.jsxs("div",{ref:P,className:"history-details-tab",style:{gridTemplateRows:jG(b)},children:[u.jsx(KG,{meta:ae,entry:A,fullHash:t.fullHash,copied:g,onCopy:$,onParent:q=>n({fullHash:q})}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:q=>F(q,"y")}),u.jsx(Z2,{files:K,selectedPath:p,additions:N,deletions:R,viewMode:C,onViewMode:L,onSelect:q=>E(q,!0)})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:z,className:"history-changes-columns",style:{gridTemplateColumns:IG(w)},children:[u.jsx(Z2,{files:K,selectedPath:p,additions:N,deletions:R,viewMode:C,onViewMode:L,onSelect:q=>E(q,!1)}),u.jsx("div",{className:"history-divider",onPointerDown:q=>F(q,"x")}),B?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-repository-head",children:[u.jsx("span",{title:B.path,children:B.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":"Previous file",disabled:K.indexOf(B)===0,onClick:()=>E(K[K.indexOf(B)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":"Next file",disabled:K.indexOf(B)===K.length-1,onClick:()=>E(K[K.indexOf(B)+1],!1),children:"›"})]})]}),u.jsx(SN,{ctx:e,file:B,mode:"unified",subPath:e.pathContext.relPath??"",commit:H})]}):u.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return u.jsxs("div",{className:"history-inspector",onKeyDown:ae=>{FG(ae.key)&&(ae.preventDefault(),i())},children:[u.jsxs("div",{className:"history-segmented",children:[u.jsx("button",{type:"button","aria-pressed":c==="details",onClick:()=>d("details"),children:"Details"}),u.jsxs("button",{type:"button","aria-pressed":c==="changes",onClick:()=>d("changes"),children:["Changes ",r.kind==="ok"&&u.jsx("span",{children:r.result.files.length})]}),u.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:i,children:"✕"})]}),ee]})}function KG({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return u.jsxs("div",{className:"history-inspector-head",children:[u.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&u.jsx("pre",{className:"history-inspector-message",children:e.body}),u.jsxs("div",{className:"history-author",children:[u.jsx("span",{className:"history-avatar",children:JG(e.authorName)}),u.jsxs("span",{children:[u.jsx("b",{children:e.authorName}),u.jsx("small",{children:e.authorEmail})]}),u.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??wN(e.authorAt)})]}),u.jsxs("div",{className:"history-inspector-ids",children:[u.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,u.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(c=>u.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(c.full),children:["parent ",c.short]},c.full))]}),t&&u.jsx("div",{className:"history-ref-chips",children:G0(t).map(c=>u.jsx("span",{className:`history-badge history-badge--${c.kind}`,children:c.label},`${c.kind}:${c.label}`))})]})}function Z2({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:c}){return u.jsxs("section",{className:"history-commit-files",children:[u.jsxs("div",{className:"history-files-title",children:[u.jsx("span",{className:"history-files-label",children:"Changed files"}),u.jsxs("span",{className:"history-files-stats",children:[e.length," ",u.jsxs("i",{children:["+",n]})," ",u.jsxs("em",{children:["−",i]})]}),u.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${r==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":r==="list",onClick:()=>o("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${r==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":r==="tree",onClick:()=>o("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx("div",{className:"history-files-scroll",children:r==="tree"?u.jsx(gN,{files:e,selectedPath:t,onSelect:c}):e.map(d=>u.jsx(vN,{entry:d,isSelected:d.path===t,onSelect:c},d.path))})]})}function VG({ctx:e,active:t=!0,refFilter:n=null,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c}){return u.jsx(YG,{ctx:e,active:t,refFilter:n,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c},yN(e.theaterId,e.pathContext.relPath))}function YG({ctx:e,active:t,refFilter:n,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c}){const[d,p]=y.useState({kind:"loading"}),[f,g]=y.useState(null),[_,b]=y.useState(""),[S,w]=y.useState(0),[x,C]=y.useState(XG),[O,P]=y.useState(!1),z=y.useRef(null),T=y.useRef(null),j=y.useRef(x),M=e.pathContext.relPath??"";y.useEffect(()=>{g(null)},[n]);const[H,F]=y.useState(t);y.useEffect(()=>{t&&F(!0)},[t]),y.useEffect(()=>{if(!H)return;if(!e.theaterId){p({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let R=!1;return p({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:M,...n?{ref:n}:{}})}).then(async A=>{if(!A.ok)throw new Error((await A.json()).error??"git_failed");return A.json()}).then(A=>{R||p({kind:"ok",commits:A.commits,checkouts:A.checkouts,truncated:A.truncated??!1})}).catch(A=>{R||p({kind:"error",message:A instanceof Error?A.message:"unknown"})}),()=>{R=!0}},[e.api,e.theaterId,H,S,M,n]),y.useEffect(()=>{r?.(t&&f!==null)},[t,r,f]),y.useEffect(()=>()=>T.current?.(),[]);const ee=y.useCallback(R=>{R.preventDefault();const A=z.current;if(!A)return;const E=j.current,L=R.clientY,$=A.getBoundingClientRect().height;T.current?.(),P(!0),T.current=AN({documentTarget:document,windowTarget:window,onMove:q=>{const X=TN(E,q.clientY-L,$,CN,kN,Vr);X!==null&&(j.current=X,C(X))},onFinish:()=>{try{localStorage.setItem(RN,String(j.current))}catch{}P(!1),T.current=null}})},[]),ae=y.useMemo(()=>d.kind==="ok"?HG(d.commits,_):[],[_,d]),K=d.kind==="ok"?LG(ae):null,B=y.useMemo(()=>UG(i),[i]),N=WG(B,_,n);return u.jsxs("div",{ref:z,className:`history-root${O?" is-dragging":""}`,style:f?{gridTemplateRows:DG(x)}:void 0,children:[u.jsxs("div",{className:"history-list-pane",children:[u.jsxs("div",{className:"history-toolbar",children:[u.jsxs("div",{className:"history-filter",children:[u.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:_,onChange:R=>b(R.target.value)}),_&&u.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>b(""),children:"✕"})]}),n&&u.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:o,children:[n," ✕"]}),d.kind==="ok"&&u.jsx("span",{className:"history-count",children:_?`${ae.length}/${d.commits.length}`:d.commits.length})]}),u.jsxs("div",{className:"history-list",children:[N&&u.jsxs("button",{type:"button",className:"repository-wip-row",onClick:c,children:["Uncommitted changes ",u.jsxs("span",{children:[B.files," files · +",B.additions," −",B.deletions]})]}),d.kind==="loading"&&u.jsx("div",{className:"history-empty",children:"Loading…"}),d.kind==="error"&&u.jsxs("div",{className:"history-error",children:[d.message,u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>w(R=>R+1),children:"Retry"})]}),d.kind==="ok"&&d.commits.length===0&&u.jsx("div",{className:"history-empty",children:"No history"}),d.kind==="ok"&&d.commits.length>0&&ae.length===0&&u.jsx("div",{className:"history-empty",children:"No matching items"}),d.kind==="ok"&&K&&ae.map((R,A)=>u.jsx(qG,{entry:R,checkouts:d.checkouts,selected:f?.fullHash===R.fullHash,graphNode:K.nodes[A],laneCount:K.activeLaneCount,layoutCollapsed:K.collapsed,onSelect:E=>g({fullHash:E.fullHash,entry:E})},R.fullHash)),d.kind==="ok"&&(d.truncated||d.commits.length>=200)&&u.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),f&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":"Resize commit log",onPointerDown:ee}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(GG,{ctx:e,target:f,onSelectCommit:g,onClose:()=>g(null)})})]})]})}function XG(){return hb(RN,BG,CN)}function ZG(){try{const e=localStorage.getItem(NN);if(e==="list"||e==="tree")return e}catch{}return"list"}function hb(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function JG(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const LN="fleet-console.diff.viewMode",MN="fleet-console.diff.listPaneWidth",ON="fleet-console.repository.source",QG=400,eK=248,DN=220;function tK(){try{const e=localStorage.getItem(LN);if(e==="list"||e==="tree")return e}catch{}return"list"}function nK(){try{const e=localStorage.getItem(ON);if(e==="changes"||e==="history"||e==="branches"||e==="tags"||e==="stashes"||e==="worktrees")return e}catch{}return"changes"}function iK(e){try{localStorage.setItem(ON,e)}catch{}}function sK(){try{const e=localStorage.getItem(MN),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(DN,t)}catch{}return eK}function rK(e){return e.entry.status==="U"?"untracked":"unified"}function aK({ctx:e}){const t=yN(e.theaterId,e.pathContext.relPath);return u.jsx(uK,{ctx:e},t)}function jN(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function oK(e,t){const n=(i,r)=>i.map(o=>({key:o.ref,source:r,primary:o.label,ref:o.ref,current:o.current}));return e==="branches"?[{label:"LOCAL",rows:n(t.branches,"branches")},{label:"REMOTES",rows:n(t.remotes.filter(i=>!jN(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:e==="stashes"?[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]:[{rows:t.worktrees.map(i=>({key:i.name,source:e,primary:i.branch??i.name,...i.branch&&i.branch!==i.name?{sub:i.name}:{},ref:null,current:i.current,contextRelPath:i.contextRelPath}))}]}function lK(e,t){return e!==void 0&&t!==null&&t!==void 0}function cK(e){return e===""?null:e}function uK({ctx:e}){const[t,n]=y.useState(nK),[i,r]=y.useState(null),[o,c]=y.useState({branches:[],remotes:[],tags:[],stashes:[],worktrees:[]}),[d,p]=y.useState(!1),[f,g]=y.useState(0),[_,b]=y.useState({kind:"loading"}),[S,w]=y.useState(0),[x,C]=y.useState(!1),[O,P]=y.useState(tK),[z,T]=y.useState(""),j=e.pathContext.relPath??"",M=wG(e.theaterId??null,j),[H,F]=y.useState(sK),ee=y.useRef(H),ae=y.useRef(null),[K,B]=y.useState(!1),N=y.useCallback(D=>{n(D),iK(D)},[]);y.useEffect(()=>{if(!e.theaterId)return;let D=!1;return p(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:j})}).then(V=>V.ok?V.json():Promise.reject()).then(V=>{D||c(V)}).catch(()=>{D||p(!0)}),()=>{D=!0}},[e.api,e.theaterId,j,f]),y.useEffect(()=>{if(!e.theaterId){b({kind:"error",message:"no_theater"});return}let D=!1;return b({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:j})}).then(async V=>{if(!V.ok){const ie=(await V.json()).error??"git_failed";D||b(ie==="no_git_repo"||ie==="git_unavailable"?{kind:"notice",reason:ie}:{kind:"error",message:ie});return}const J=await V.json();D||b({kind:"ok",files:J.files})}).catch(V=>{D||b({kind:"error",message:V instanceof Error?V.message:"unknown"})}),()=>{D=!0}},[S,e.theaterId,j]),y.useLayoutEffect(()=>()=>G2(),[]);const R=y.useCallback(D=>{e.theaterId&&xG(D,j,e.theaterId)},[e.theaterId,j]),A=y.useCallback(()=>G2(),[]),E=y.useCallback(D=>{P(D);try{localStorage.setItem(LN,D)}catch{}},[]),L=y.useCallback(D=>{D.preventDefault();const V=ae.current;if(!V)return;const J=V.getBoundingClientRect().width,ce=D.clientX,ie=ee.current;B(!0);const ve=Oe=>{const Ne=MG({startWidth:ie,dx:Oe.clientX-ce,containerWidth:J,listPaneMinWidth:DN,hunkPaneMinWidth:xN,dividerWidth:Vr});Ne!==null&&(ee.current=Ne,F(Ne))},Se=()=>{document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",Se),B(!1);try{localStorage.setItem(MN,String(ee.current))}catch{}};document.addEventListener("pointermove",ve),document.addEventListener("pointerup",Se)},[]);y.useLayoutEffect(()=>(e.requestExtraWidth?.(t==="changes"&&M||t==="history"&&x?QG:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,M,t,x]);const $=M?rK(M):null,q=y.useCallback(()=>w(D=>D+1),[]),X=_.kind==="ok"?_.files:[];return u.jsxs("div",{className:"repository-unified",children:[u.jsx(hK,{source:t,refs:o,onSource:N,onRef:D=>{r(D),N("history")}}),u.jsxs("div",{className:"repository-source-content",children:[u.jsx("div",{className:"repository-source-fill",hidden:t!=="history",children:u.jsx(VG,{ctx:e,active:t==="history",refFilter:i,wipFiles:X,onInspectorOpenChange:C,onClearRef:()=>r(null),onWip:()=>N("changes")})}),t!=="changes"&&t!=="history"?d?u.jsxs("div",{className:"history-error",children:["Unable to load refs",u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>g(D=>D+1),children:"Retry"})]}):u.jsx(dK,{source:t,refs:o,onRef:D=>{r(D),N("history")},selectPathContext:e.selectPathContext}):null,u.jsxs("div",{hidden:t!=="changes",ref:ae,className:`repository-root${M?" has-hunk":""}${K?" is-dragging":""}`,style:M?{gridTemplateColumns:OG(H)}:void 0,children:[M&&$?u.jsxs("div",{className:"repository-hunk-pane",children:[u.jsxs("div",{className:"repository-hunk-head",children:[u.jsx("span",{children:M.entry.path}),u.jsx("button",{type:"button",onClick:A,children:"✕"})]}),u.jsx(SN,{ctx:e,file:M.entry,mode:$,subPath:M.subPath})]}):null,M?u.jsx("div",{className:"repository-divider",onPointerDown:L,"aria-hidden":"true"}):null,u.jsxs("div",{className:"repository-list-pane",children:[u.jsxs("div",{className:"repository-toolbar",children:[u.jsxs("div",{className:"repository-filter",children:[u.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:z,onChange:D=>T(D.target.value)}),z?u.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>T(""),children:"✕"}):null]}),u.jsxs("div",{className:"repository-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${O==="list"?" is-active":""}`,title:"List view","aria-pressed":O==="list",onClick:()=>E("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${O==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":O==="tree",onClick:()=>E("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx(bG,{state:_,onRetry:q,viewMode:O,selectedPath:M?.entry.path??null,onSelect:R,filterText:z})]})]})]})]})}function IN({source:e}){const t=e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":e==="stashes"?"M4 5h10v9H4zM6 3h6":"M3 5h5l1 2h6v7H3z";return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function hK({source:e,refs:t,onSource:n}){const i=(r,o,c)=>u.jsxs("button",{type:"button","aria-label":o,"aria-current":e===r?"page":void 0,onClick:()=>n(r),children:[u.jsx(IN,{source:r}),u.jsx("span",{children:o}),c!==void 0&&u.jsx("i",{children:c})]},r);return u.jsxs("nav",{className:"repository-source-nav","aria-label":"Repository sources",children:[u.jsx("b",{children:"WORKING"}),i("changes","Changes"),i("history","History"),u.jsx("b",{children:"REFS"}),i("branches","Branches",t.branches.length+t.remotes.filter(r=>!jN(r.ref)).length),i("tags","Tags",t.tags.length),i("stashes","Stashes",t.stashes.length),i("worktrees","Worktrees",t.worktrees.length)]})}function dK({source:e,refs:t,onRef:n,selectPathContext:i}){return e==="changes"||e==="history"?null:u.jsx("div",{className:"repository-ref-list",children:oK(e,t).map(r=>u.jsxs("div",{className:"repository-ref-group",children:[r.label&&u.jsx("b",{className:"repository-ref-group-label",children:r.label}),r.rows.map(o=>{const c=o.source==="worktrees"&&lK(i,o.contextRelPath);return u.jsxs("button",{type:"button",className:`repository-ref-row${o.current?" is-current":""}`,disabled:o.source==="worktrees"?!c:o.ref===null,onClick:()=>{o.ref?n(o.ref):c&&i&&typeof o.contextRelPath=="string"&&i(cK(o.contextRelPath))},children:[u.jsx(IN,{source:o.source}),u.jsxs("span",{className:"repository-ref-name",children:[o.primary,o.current&&" ✓"]}),o.sub&&u.jsx("span",{className:"repository-ref-sub",children:o.sub})]},o.key)})]},r.label??e))})}function fK(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const pK={id:"repository",title:"Repository",icon:()=>u.jsx(fK,{}),pathAware:!0,render:e=>u.jsx(aK,{ctx:e})},mK={id:"repository",railPanels:[pK]},gK=[mK],hf=["claude-code","codex","cursor","opencode"],_K={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},vK="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function yK({source:e,skill:t,theaterId:n,relPath:i,onCancel:r,onStarted:o,jobLog:c}){const[d,p]=y.useState(n?"project":"global"),[f,g]=y.useState(!0),[_,b]=y.useState(new Set(hf)),{status:S,start:w}=c,x=S==="running",C=S==="done",O=S==="error",P=y.useCallback(()=>{g(!0),b(new Set(hf))},[]),z=y.useCallback(j=>{g(!1),b(M=>{const H=new Set(M);return H.has(j)?H.delete(j):H.add(j),H})},[]),T=y.useCallback(()=>{const j=f?hf:Array.from(_);if(j.length===0)return;const M={source:e,skill:t,scope:d,agents:j};d==="project"&&n&&(M.theaterId=n,M.relPath=i),w("/plugins/skills/install",M),o(d)},[f,_,e,t,d,n,i,w,o]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${d==="project"?" is-active":""}`,onClick:()=>p("project"),disabled:!n||x||C,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${d==="global"?" is-active":""}`,onClick:()=>p("global"),disabled:x||C,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:P,disabled:x||C,children:"All agents"}),hf.map(j=>u.jsx("button",{type:"button",className:`skills-agent-chip${!f&&_.has(j)?" is-active":""}`,onClick:()=>z(j),disabled:x||C,children:_K[j]},j))]}),u.jsx("p",{className:"skills-permission-warning",children:vK}),!x&&!C&&!O&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:r,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:T,disabled:!f&&_.size===0,children:"Install now"})]})]})}const bK=4e3;function BN({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:c}){const[d,p]=y.useState(!1),f=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{e==="running"&&p(!1)},[e]),y.useEffect(()=>{const C=f.current;C&&(C.scrollTop=C.scrollHeight)},[t]),y.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{p(!1),o()},bK),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,o]);const _=y.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),p(!1),o()},[o]),b=y.useCallback(()=>p(C=>!C),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",x=e==="running"?n:e==="done"?i:r;return u.jsxs("div",{className:"skills-dock",children:[d&&u.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((C,O)=>u.jsx("div",{className:"skills-dock-log-line",children:C},O)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${d?" is-open":""}`,"aria-expanded":d,onClick:b,onKeyDown:C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),b())},children:[u.jsx("span",{className:S,"aria-hidden":"true"}),u.jsx("span",{className:w,"aria-live":"polite",children:x}),e==="running"&&t.length>0&&u.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:C=>{C.stopPropagation(),_()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[c!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:C=>{C.stopPropagation(),c()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:C=>{C.stopPropagation(),_()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const SK={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},db=new Set;let ai=SK;function Ya(){for(const e of db)e()}function wK(e){return db.add(e),()=>{db.delete(e)}}function J2(){return ai}function K0(){return y.useSyncExternalStore(wK,J2,J2)}function df(e){ai={...ai,activeTab:e},Ya()}function Q2(e){ai={...ai,scope:e},Ya()}function xK(e){ai={...ai,filterText:e},Ya()}function CK(e){ai={...ai,searchQuery:e},Ya()}function Dl(e,t){ai={...ai,searchResults:e,searchLoading:t},Ya()}function Sp(e,t){return JSON.stringify([e,t])}function fb(e,t){return e.installedContextKey===t}function hv(e,t,n){ai.installedContextKey===e&&(ai={...ai,installedList:t,installedLoading:n},Ya())}function pb(e){ai={...ai,installFormOpenId:e},Ya()}function kK(e){ai={...ai,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ya()}const eE=750;function PN(){const[e,t]=y.useState({status:"idle",lines:[]}),n=y.useRef(null),i=y.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);y.useEffect(()=>()=>i(),[i]);const r=y.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=y.useCallback((c,d)=>{i(),t({status:"running",lines:[]}),(async()=>{const p=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).catch(()=>null);if(!p?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await p.json();let g=0;const _=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${g}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();g=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{_()},eE):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{_()},eE)})()},[i]);return{...e,start:o,reset:r}}const EK=300,jf=2;function TK(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function AK(e){if(e.length<jf){Dl([],!1);return}Dl([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Dl([],!1);return}const n=await t.json();Dl(n.skills??[],!1)}catch{Dl([],!1)}}function RK({result:e,theaterId:t,relPath:n,isFormOpen:i,onInstallClick:r,onReadMore:o,onInstallStarted:c,jobLog:d}){const p={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${i?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>o(p,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:TK(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:r,children:i?"Cancel":"Install"})}),i&&u.jsx(yK,{source:e.source,skill:e.name,theaterId:t,relPath:n,onCancel:r,onStarted:f=>c(e.name,f),jobLog:d})]})}function NK({theaterId:e,relPath:t,onReadMore:n,onInstallSuccess:i}){const{searchQuery:r,searchResults:o,searchLoading:c,installFormOpenId:d}=K0(),p=y.useRef(null),f=PN(),[g,_]=y.useState(null),b=y.useCallback(w=>{if(CK(w),p.current&&clearTimeout(p.current),w.length<jf){Dl([],!1);return}p.current=setTimeout(()=>{AK(w)},EK)},[]);y.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),y.useEffect(()=>{f.status!=="done"||!g||(i(g.name,g.scope),pb(null),_(null))},[f.status,g,i]);const S=g?`Installing ${g.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:r,onChange:w=>b(w.target.value),"aria-label":"Search skills registry"}),c&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!c&&r.length>=jf&&o.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',r,'".']}),!c&&r.length>0&&r.length<jf&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:o.map(w=>u.jsx(RK,{result:w,theaterId:e,relPath:t,isFormOpen:d===w.id,onInstallClick:()=>pb(d===w.id?null:w.id),onReadMore:n,onInstallStarted:(x,C)=>_({name:x,scope:C}),jobLog:f},w.id))})]}),u.jsx(BN,{status:f.status,lines:f.lines,runningLabel:S,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const LK=2600;function MK({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,c]=y.useState(!1),d=y.useRef(null),p=y.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),f=y.useCallback(()=>{o?(p(),c(!1),i?.(e.name,e.scope)):(c(!0),d.current=setTimeout(()=>c(!1),LK))},[o,p,i,e.name,e.scope]);return y.useEffect(()=>()=>p(),[p]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[n&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>n(e.scope),disabled:r,children:r?"Updating…":"Update all"}),i&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:f,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function OK(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",i=await fetch(`/plugins/skills/list${n}`);return i.ok?(await i.json()).skills??[]:[]}function DK({theaterId:e,relPath:t,onReadMore:n,refreshKey:i}){const r=K0(),{scope:o,filterText:c}=r,d=Sp(e,t),p=fb(r,d)?r.installedList:[],f=fb(r,d)&&r.installedLoading,g=PN(),_=y.useRef(null),b=y.useCallback((z,T)=>{const j=Sp(z,T);hv(j,[],!0),OK(z,T).then(M=>hv(j,M,!1)).catch(()=>hv(j,[],!1))},[]);y.useEffect(()=>{b(e,t)},[e,t,b,i]),y.useEffect(()=>{(g.status==="done"||g.status==="error")&&b(e,t)},[g.status,e,t,b]);const S=y.useCallback(z=>{const T=z;_.current=T;const j={scope:T};T==="project"&&e&&(j.theaterId=e,j.relPath=t),g.start("/plugins/skills/update",j)},[e,t,g]),w=y.useCallback((z,T)=>{const j={scope:T,skill:z};T==="project"&&e&&(j.theaterId=e,j.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}).then(()=>b(e,t)).catch(()=>null)},[e,t,b]),x=y.useCallback(()=>{_.current&&S(_.current)},[S]),C=o==="project"&&!e?"global":o,O=p.filter(z=>z.scope!==C?!1:c?z.name.toLowerCase().includes(c.toLowerCase()):!0),P=g.status==="running"&&_.current===C;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${C==="project"?" is-active":""}`,onClick:()=>Q2("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${C==="global"?" is-active":""}`,onClick:()=>Q2("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:c,onChange:z=>xK(z.target.value),"aria-label":"Filter installed skills"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&O.length===0&&u.jsx("div",{className:"skills-empty-state",children:c?"No skills match the filter.":`No ${C} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:O.map(z=>u.jsx(MK,{skill:z,onReadMore:n,onUpdate:S,onRemove:w,isUpdating:P},`${z.scope}:${z.name}`))})]}),u.jsx(BN,{status:g.status,lines:g.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:g.reset,onRetry:x})]})}function dv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";n&&!/^(https?:|mailto:|#)/i.test(n)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function jK({content:e}){const t=y.useMemo(()=>{const r=Fa(e).html,o=new DOMParser().parseFromString(r,"text/html");return dv(o.body),o.body.innerHTML},[e]),n=y.useRef(null);y.useEffect(()=>{const r=n.current;if(!r)return;dv(r);const o=new MutationObserver(()=>dv(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const i=y.useCallback(r=>{const o=r.target.closest('[data-action="copy-code"]');if(!o)return;const c=o.closest("pre")?.getAttribute("data-code");if(!c)return;navigator.clipboard?.writeText(c);const d=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=d},1200)},[]);return u.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const IK=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),BK="Skills run with full agent permissions. Review before use.";function PK(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(IK)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function $K({skill:e,isInstalled:t,theaterId:n,relPath:i,onClose:r,onInstall:o}){const[c,d]=y.useState(null),[p,f]=y.useState(!1),g=y.useRef(null),_=y.useRef(null),b=y.useRef(null);if(y.useEffect(()=>{e&&g.current===null&&(g.current=document.activeElement)},[e]),y.useEffect(()=>{if(!e){d(null);return}f(!0),d(null);let w=!1;return(async()=>{try{let C;if(t){const P={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(P.theaterId=n,P.relPath=i),C=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})}else C=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n,relPath:i})});if(w)return;if(!C.ok){f(!1);return}const O=await C.json();w||(d(O.markdown??""),f(!1))}catch{w||f(!1)}})(),()=>{w=!0}},[e,t,n,i]),y.useEffect(()=>{if(!e)return;const w=x=>{x.key==="Escape"?(x.preventDefault(),r()):x.key==="Tab"&&PK(x,b.current),x.stopImmediatePropagation()};return _.current?.focus(),window.addEventListener("keydown",w,!0),()=>{window.removeEventListener("keydown",w,!0);const x=g.current;g.current=null,x?.focus?.()}},[e,r]),y.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const S=e.displayPath||e.source||null;return Va.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:r,"aria-hidden":"true",children:u.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:w=>w.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&u.jsx("span",{className:"skills-overlay-meta",children:S}),u.jsx("button",{ref:_,type:"button",className:"skills-overlay-close",onClick:r,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[p&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!p&&c===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),c!==null&&u.jsx(jK,{content:c})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:BK}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{r(),o()},children:"Install"})]})]})}),document.body)}const zK=3200;function HK({message:e,onDismiss:t}){return y.useEffect(()=>{if(!e)return;const n=setTimeout(t,zK);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function FK({ctx:e}){const t=Sp(e.theaterId,e.pathContext.relPath);return u.jsx(UK,{ctx:e},t)}function UK({ctx:e}){const{theaterId:t}=e,n=K0(),{activeTab:i}=n,r=Sp(e.theaterId,e.pathContext.relPath),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(0),_=fb(n,r)?n.installedList.length:0;y.useLayoutEffect(()=>{kK(r)},[r]);const b=y.useCallback(C=>{c({skill:C,isInstalled:!0})},[]),S=y.useCallback((C,O)=>{c({skill:C,isInstalled:!1,registryId:O})},[]),w=y.useCallback((C,O)=>{p(`Installed ${C} to ${O}`),g(P=>P+1),df("installed")},[]),x=y.useCallback(()=>{o?.registryId&&(pb(o.registryId),df("find")),c(null)},[o]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>df("installed"),children:["Installed",_>0?` ${_}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>df("find"),children:"Find"})]}),i==="installed"?u.jsx(DK,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:b,refreshKey:f}):u.jsx(NK,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,onInstallSuccess:w}),u.jsx(HK,{message:d,onDismiss:()=>p(null)}),u.jsx($K,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>c(null),onInstall:x})]})}function WK(){return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const qK={id:"skills",title:"Skills",icon:WK,pathAware:!0,render:e=>u.jsx(FK,{ctx:e})},GK={id:"skills",railPanels:[qK]},KK=[GK],$N=[...KF,...dG,...gK,...KK],VK=HN($N),zN=y.createContext(VK),YK=zN.Provider;async function XK(){const e=[...$N],t=new Set(e.map(i=>i.id)),n=await ZK();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await JK(i);if(r){if(t.has(r.id)){console.warn(`Skipping external plugin with duplicate id: ${r.id}`);continue}t.add(r.id),e.push(r)}}return HN(e)}function hc(){return y.useContext(zN)}async function ZK(){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(eV):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function JK(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return QK(n)?n:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function HN(e){const t=new Set,n=[];for(const i of e)for(const r of i.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),n.push(r)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function QK(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function eV(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 tV=288,nV=520,Eu=12;function FN({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:c,onClose:d}){const p=y.useRef(null),f=y.useRef(null);return y.useEffect(()=>{const g=b=>{p.current?.contains(b.target)||d()},_=b=>{b.key==="Escape"&&d()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",_)}},[d]),y.useEffect(()=>{f.current?.focus()},[]),u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:sV(e,t,n),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:f,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(iV,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Canvas controls"})})]}),u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((g,_)=>u.jsxs("div",{children:[_>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:g.title}),g.kinds.map(b=>{const S=b.disabled===!0||!r;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>c(g.id,b),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(g.id,b)??u.jsx(rV,{})}),u.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${g.id}:${b.id}`)})]},g.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function iV(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function sV(e,t,n){const i=t?Math.max(Eu,Math.min(e.x,t.width-tV-Eu)):e.x;if(n==="above")return{left:i,bottom:Math.max(Eu,e.y)};const r=t?Math.max(Eu,Math.min(e.y,t.height-nV-Eu)):e.y;return{left:i,top:r}}function rV(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function UN(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const ff="directory-browser-sectors";function WN({open:e,onCancel:t,onConfirm:n}){const[i,r]=y.useState(null),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(""),[_,b]=y.useState(""),[S,w]=y.useState(0),x=y.useRef(null),C=y.useRef(null),O=async(A,E)=>{c(A),p(null),g(""),w(0);try{const L=await LO(A,E);r(L)}catch(L){if(L instanceof DOMException&&L.name==="AbortError")return;p(L instanceof tn?L.message:String(L))}finally{c(null)}};y.useEffect(()=>{if(!e)return;const A=new AbortController;return O(null,A.signal),()=>A.abort()},[e]),y.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const P=i?.entries??[],z=y.useMemo(()=>{const A=f.trim().toLowerCase();return A===""?P:P.filter(E=>E.name.toLowerCase().includes(A))},[P,f]),T=y.useMemo(()=>i?aV(i):[],[i]),j=i?tE(i.path):null,M=i?.roots??[],H=M.length>1,F=z.length===0?-1:Math.min(S,z.length-1);if(y.useEffect(()=>{if(F<0)return;C.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"nearest"})},[F,i?.path]),!e)return null;const ee=A=>{A.accessible&&o===null&&O(A.path)},ae=()=>{i?.parentPath!=null&&o===null&&O(i.parentPath)},K=()=>{const A=_.trim();A!==""&&o===null&&O(A)},B=i?.path??null,N=F>=0?`${ff}-${F}`:void 0,R=A=>{switch(A.key){case"Escape":f!==""?g(""):t();return;case"ArrowDown":A.preventDefault(),w(E=>Math.min(E+1,Math.max(z.length-1,0)));return;case"ArrowUp":A.preventDefault(),w(E=>Math.max(E-1,0));return;case"Enter":{A.preventDefault();const E=z[F];E&&ee(E);return}case"Backspace":f===""&&(A.preventDefault(),ae());return;default:return}};return Va.createPortal(u.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[u.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),u.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:R,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(cV,{})}),u.jsxs("div",{className:"directory-browser-heading",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),u.jsx("h2",{children:"Add Theater"})]}),u.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),H?u.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),u.jsx("div",{className:"directory-browser-root-chips",children:M.map(A=>{const E=j!=null&&tE(A)===j;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${E?"is-active":""}`,"aria-current":E?"location":void 0,disabled:o!==null,title:A,onClick:()=>{o===null&&O(A)},onKeyDown:L=>L.stopPropagation(),children:lV(A)},A)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:T.map((A,E)=>{const L=E===T.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[E>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${L?"is-current":""}`,"aria-current":L?"location":void 0,disabled:L||o!==null,title:A.path,onClick:()=>{O(A.path)},children:A.label})]},A.path)})}),u.jsxs("div",{className:"directory-browser-toolbar",children:[u.jsxs("div",{className:"directory-browser-filter",children:[u.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:u.jsx(hV,{})}),u.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":ff,value:f,spellCheck:!1,autoComplete:"off",onChange:A=>{g(A.target.value),w(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:ae,children:[u.jsx(dV,{}),u.jsx("span",{children:"Up"})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:_,spellCheck:!1,autoComplete:"off",onChange:A=>b(A.target.value),onKeyDown:A=>{A.stopPropagation(),A.key==="Enter"&&(A.preventDefault(),K())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:_.trim()===""||o!==null,onClick:K,onKeyDown:A=>A.stopPropagation(),children:"Go"})]}),d?u.jsx("p",{className:"directory-browser-error",role:"alert",children:d}):null,u.jsx("div",{className:"directory-browser-list",id:ff,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":N,ref:C,children:o!==null?u.jsxs("p",{className:"directory-browser-state is-live",children:[u.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):z.length===0?u.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):z.map((A,E)=>u.jsxs("div",{id:`${ff}-${E}`,"data-index":E,role:"option","aria-selected":E===F,"aria-disabled":!A.accessible,className:`directory-browser-sector ${E===F?"is-active":""} ${A.accessible?"":"is-locked"}`,title:A.path,onClick:()=>{w(E),ee(A)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(uV,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:A.name}),A.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(fV,{})," Locked"]})]},A.path))}),i?.truncated?u.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),u.jsx("span",{className:"directory-browser-target-path",title:B??"",children:B??"Loading…"})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:B===null||o!==null,onClick:()=>B&&n(B),children:"Add Theater"})]})]})]})]}),document.body)}function aV(e){if(oV(e)==="/"){const c=[{label:"/",path:"/"}];let d="";for(const p of e.path.split("/").filter(Boolean))d+=`/${p}`,c.push({label:p,path:d});return c}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",r=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const c of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${c}`,r.push({label:c,path:o});return r}function oV(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function tE(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function lV(e){return e.replace(/[\\/]+$/,"")||e}function cV(){return u.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),u.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function uV(){return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function hV(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function dV(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function fV(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}const V0=[{key:"crimson",label:"Crimson",color:"var(--id-crimson)"},{key:"amber",label:"Amber",color:"var(--id-amber)"},{key:"moss",label:"Moss",color:"var(--id-moss)"},{key:"teal",label:"Teal",color:"var(--id-teal)"},{key:"cerulean",label:"Cerulean",color:"var(--id-cerulean)"},{key:"indigo",label:"Indigo",color:"var(--id-indigo)"},{key:"plum",label:"Plum",color:"var(--id-plum)"},{key:"rose",label:"Rose",color:"var(--id-rose)"}],pV={red:"crimson",orange:"amber",yellow:"amber",lime:"moss",green:"moss",emerald:"teal",cyan:"teal",sky:"cerulean",blue:"cerulean",violet:"plum",purple:"plum",magenta:"rose"};function qN(e){return typeof e!="string"||e.length===0?null:V0.some(t=>t.key===e)?e:pV[e]??null}function qa(e){const t=qN(e);return t?V0.find(n=>n.key===t)?.color??null:null}function mb(e){return typeof e.accent=="string"?e.accent:null}const nE=8,mV=268;function Y0({accentKey:e,includeNone:t,onSelect:n}){const i=qN(e);return u.jsxs(u.Fragment,{children:[t?u.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>n(null),children:[u.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:"None"})]}):null,V0.map(r=>u.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","aria-label":r.label,"aria-pressed":i===r.key,onClick:()=>n(r.key),children:[u.jsx("span",{className:"accent-tone-flag",style:{background:r.color},"aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:r.label})]},r.key))]})}function gV({anchor:e,accentKey:t,onSelect:n,onClose:i}){const[r,o]=y.useState(void 0);y.useLayoutEffect(()=>{const d=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+nE,f=p+mV>window.innerHeight;o(f?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+nE)}:{position:"fixed",left:d,top:Math.round(p)})},[e]),y.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]);const c=d=>{n(d),i()};return Va.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:r?u.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:d=>d.stopPropagation(),children:u.jsx(Y0,{accentKey:t,includeNone:!0,onSelect:c})}):null}),document.body)}const iE=8,_V=320;function sE(e){const{anchor:t,onClose:n}=e,[i,r]=y.useState(void 0);return y.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),c=t.bottom+iE,d=c+_V>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+iE)}:{position:"fixed",left:o,top:Math.round(c)})},[t]),y.useEffect(()=>{const o=c=>{c.key==="Escape"&&(c.preventDefault(),n())};return window.addEventListener("keydown",o),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]),Va.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:i,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?u.jsx(vV,{...e}):u.jsx(yV,{...e})}):null}),document.body)}function vV({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,c]=y.useState(!1),[d,p]=y.useState(`Group ${t.length+1}`),f=y.useRef(!1),g=y.useRef(null);y.useEffect(()=>{o&&g.current?.select()},[o]);const _=()=>{const b=d.trim();b&&(i.onCreateGroup(b),r())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=qa(b.color),w=e.groupId===b.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{i.onSetGroupId(w?null:b.id),r()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?u.jsx(bV,{}):null]},b.id)}),o?u.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:d,onChange:b=>p(b.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:b=>{b.key==="Enter"&&!f.current&&(b.preventDefault(),_()),b.key==="Escape"&&(b.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>c(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),u.jsx(Y0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function yV({group:e,actions:t,onClose:n}){const[i,r]=y.useState(e.name),[o,c]=y.useState(!1),d=y.useRef(!1),p=()=>{const f=i.trim();if(!f||f===e.name){n();return}t.onRename(f),n()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx(Y0,{accentKey:e.color,includeNone:!1,onSelect:f=>{f&&t.onSetColor(f),n()}}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:i,onChange:f=>r(f.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:f=>{f.key==="Enter"&&!d.current&&(f.preventDefault(),p()),f.key==="Escape"&&(f.preventDefault(),n())},onBlur:p,"aria-label":"Group name"}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){c(!0);return}t.onUngroupAll(),n()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function bV(){return u.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:u.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const SV="fleet-console.canvas.",GN="fleet-console.formation-layout",wV=400,gb=640,_b=400,rE=40,xV=320,CV=200,kV=8,EV=0,aE=96,TV=.25,AV=1,fv=.2,oE=.5,RV=.001,Fl={x:0,y:0,zoom:1},Yl={viewport:Fl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},vb=new Set,yb=new Set,bb=new Set,Sb=new Set,Ga=new Map,Kp=new Map;let cn=null,Ua=null,tt=Yl,Zi=null,hr=!1,X0=ZV(),Pa=Fl,Oo=null,wp=0;function Z0(e){return vb.add(e),()=>{vb.delete(e)}}function tc(){return tt}function NV(e){return cn===e?tt:t1(e)}function Yr(){return Zi?.mode==="maximized"?Zi.operationId:null}function mh(){return Zi?.mode==="companion"?Zi.operationId:null}function xp(){return hr}function lE(){return X0}function LV(){return cn}function KN(){return y.useSyncExternalStore(Z0,tc,tc)}function VN(){return y.useSyncExternalStore(tL,Yr,Yr)}function MV(){return y.useSyncExternalStore(tL,mh,mh)}function Vp(){return y.useSyncExternalStore(UV,xp,xp)}function YN(){return y.useSyncExternalStore(WV,lE,lE)}function XN(){return y.useSyncExternalStore(Z0,uE,uE)}function Ji(e){tt={viewport:e.viewport??tt.viewport,operations:e.operations??tt.operations,operationOrder:e.operationOrder??tt.operationOrder,operationAccent:e.operationAccent??tt.operationAccent,minimized:e.minimized??tt.minimized,collapsedGroups:e.collapsedGroups??tt.collapsedGroups},VV(),Q0()}function ZN(e){const t=tt.collapsedGroups.includes(e)?tt.collapsedGroups.filter(n=>n!==e):[...tt.collapsedGroups,e];Ji({collapsedGroups:t})}function OV(e,t){if(cn===e){ZN(t);return}const n=t1(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];n1(e,{...n,collapsedGroups:i}),tt={...tt},Q0()}function DV(){return y.useSyncExternalStore(Z0,hE,hE)}function wb(e){e1();const t=i1(e);Pa=t,Ji({viewport:t})}function JN(e){const t=i1(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||KV()){wb(t);return}Pa=t,Oo===null&&(Oo=window.requestAnimationFrame(sL))}function xb(e,t){const n=zo();Ji({operations:{...tt.operations,[e]:{...s1(t,n),zIndex:n}}})}function jV(e,t,n=xV,i=CV,r=kV,o=EV,c="grid"){if(!Number.isFinite(t)||t<=0)return[];const d=Math.max(0,e.width-o*2),p=Math.max(0,e.height-o*2);if(c==="columns"){const x=Math.max(0,d-r*(t-1)),C=x/t,O=Math.min(n,C),P=Math.min(Math.max(O,C),x),z=p,T=Math.min(i,z),j=Math.min(Math.max(T,z),p);return Array.from({length:t},(M,H)=>({x:e.x+o+H*(P+r),y:e.y+o,width:P,height:j}))}if(c==="rows"){const x=d,C=Math.min(n,x),O=Math.min(Math.max(C,x),d),P=Math.max(0,p-r*(t-1)),z=P/t,T=Math.min(i,z),j=Math.min(Math.max(T,z),P);return Array.from({length:t},(M,H)=>({x:e.x+o,y:e.y+o+H*(j+r),width:O,height:j}))}const f=Math.ceil(Math.sqrt(t)),g=Math.ceil(t/f),_=Math.max(0,p-r*(g-1)),b=_/g,S=Math.min(i,b),w=Math.min(Math.max(S,b),_);return Array.from({length:t},(x,C)=>{const O=Math.floor(C/f),P=C%f,z=O===g-1?t-(g-1)*f:f,T=Math.max(0,d-r*(z-1)),j=T/z,M=Math.min(n,j),H=Math.min(Math.max(M,j),T);return{x:e.x+o+P*(H+r),y:e.y+o+O*(w+r),width:H,height:w}})}function QN(e){tt.minimized.includes(e)||(Yr()===e&&Xr(),mh()===e&&Ka(),Ji({minimized:[...tt.minimized,e]}))}function IV(e){const t=new Set,i=[...tt.minimized.filter(c=>t.has(c)||!(c in tt.operations)?!1:(t.add(c),!0)),...e.filter(c=>t.has(c)||!(c in tt.operations)?!1:(t.add(c),!0))];if(iL(tt.minimized,i))return;const r=Yr(),o=mh();r&&i.includes(r)&&Xr(),o&&i.includes(o)&&Ka(),Ji({minimized:i})}function Tu(e){if(!tt.minimized.includes(e))return;Yr()===e&&Xr();const t=tt.minimized.filter(r=>r!==e),n=tt.operations[e];if(!n){Ji({minimized:t});return}const i=zo();Ji({minimized:t,operations:{...tt.operations,[e]:{...n,zIndex:i}}})}function pv(e){Ji({operationOrder:aL(e)})}function zo(){return wp+=1,wp}function BV(e){const t=tt.operations[e];if(t)return t;const n=Object.keys(tt.operations).length,i={x:n*rE,y:n*rE,width:gb,height:_b,zIndex:zo()};return Ji({operations:{...tt.operations,[e]:i}}),i}function PV(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(tt.operations))t.has(b)?n[b]=S:i=!0;const r=tt.minimized.filter(b=>t.has(b)),o=r.length!==tt.minimized.length,c=tt.operationOrder.filter(b=>t.has(b)),d=c.length!==tt.operationOrder.length,p=Object.fromEntries(Object.entries(tt.operationAccent).filter(([b])=>t.has(b))),f=Object.keys(p).length!==Object.keys(tt.operationAccent).length,g=Yr(),_=mh();g&&(!t.has(g)||r.includes(g))&&Xr(),_&&r.includes(_)&&Ka(),(i||o||d||f)&&Ji({operations:n,minimized:r,operationOrder:c,operationAccent:p})}function $V(e){YV(),e1(),GV(),cn=e,tt=e?t1(e):Yl;const t=e?Ga.get(e)??null:null,n=!nL(Zi,t);Zi=t;const i=e?Kp.has(e):!1,r=hr!==i;hr=i,Pa=tt.viewport,wp=Math.max(wp,oL(tt.operations)),Q0(),n&&Xp(),r&&Yp()}function cE(e,t){const n=tt.operations[e];if(!n)return;const i=Math.max(TV,Math.min(AV,Math.min((t.width-aE)/n.width,(t.height-aE)/n.height))),r={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};e1(),Pa=r;const o=zo(),c=tt.minimized.includes(e);Ji({viewport:r,operations:{...tt.operations,[e]:{...s1(n,o),zIndex:o}},...c?{minimized:tt.minimized.filter(d=>d!==e)}:{}})}function Zu(e){const t={mode:"maximized",operationId:e};cn&&Ga.set(cn,t),eL(t)}function Xr(){cn&&Ga.get(cn)?.mode==="maximized"&&Ga.delete(cn),Zi?.mode==="maximized"&&(Zi=null,Xp())}function zV(e){cn&&Ga.get(cn)?.mode==="maximized"&&Ga.delete(cn),J0(),eL({mode:"companion",operationId:e})}function eL(e){const t=tt.minimized.filter(r=>r!==e.operationId),n=!iL(tt.minimized,t),i=!nL(Zi,e);i&&(Zi=e),n&&Ji({minimized:t}),i&&Xp()}function Ka(){Zi?.mode==="companion"&&(Zi=null,Xp())}function HV(){if(cn){if(hr){J0();return}Xr(),Ka(),Kp.set(cn,!0),hr=!0,Yp()}}function mv(e){if(cn){if(hr&&X0===e){J0();return}FV(e),hr||(Xr(),Ka(),Kp.set(cn,!0),hr=!0,Yp())}}function J0(){cn&&Kp.delete(cn),hr&&(hr=!1,Yp())}function FV(e){X0=e,JV(e),qV()}function UV(e){return bb.add(e),()=>{bb.delete(e)}}function WV(e){return Sb.add(e),()=>{Sb.delete(e)}}function Q0(){for(const e of vb)e()}function tL(e){return yb.add(e),()=>{yb.delete(e)}}function Yp(){for(const e of bb)e()}function qV(){for(const e of Sb)e()}function uE(){return tt.minimized}function hE(){return tt.collapsedGroups}function Xp(){for(const e of yb)e()}function GV(){cn&&(Zi?Ga.set(cn,Zi):Ga.delete(cn))}function nL(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId}function iL(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function sL(){const e=tt.viewport,t=Pa.x-e.x,n=Pa.y-e.y,i=Pa.zoom-e.zoom;if(Math.abs(t)<oE&&Math.abs(n)<oE&&Math.abs(i)<RV){Oo=null,Ji({viewport:Pa});return}Ji({viewport:{x:e.x+t*fv,y:e.y+n*fv,zoom:e.zoom+i*fv}}),Oo=typeof window<"u"?window.requestAnimationFrame(sL):null}function e1(){Oo===null||typeof window>"u"||(window.cancelAnimationFrame(Oo),Oo=null)}function KV(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function VV(){!cn||typeof window>"u"||(XV(),Ua=window.setTimeout(()=>{Ua=null,n1(cn,tt)},wV))}function YV(){!Ua||!cn||typeof window>"u"||(window.clearTimeout(Ua),Ua=null,n1(cn,tt))}function XV(){!Ua||typeof window>"u"||(window.clearTimeout(Ua),Ua=null)}function t1(e){if(typeof window>"u")return Yl;try{const t=window.localStorage.getItem(rL(e));if(!t)return Yl;const n=JSON.parse(t);return QV(n)}catch{return Yl}}function n1(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(rL(e),JSON.stringify(t))}catch{}}function ZV(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(GN);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function JV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GN,e)}catch{}}function rL(e){return`${SV}${e}`}function QV(e){if(!nc(e))return Yl;const t=nY(e.operations);return{viewport:i1(e.viewport),operations:t,operationOrder:aL(e.operationOrder),operationAccent:eY(e.operationAccent),minimized:tY(e.minimized,t),collapsedGroups:sY(e.collapsedGroups)}}function aL(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function eY(e){if(!nc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function tY(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const r of e)typeof r!="string"||n.has(r)||!(r in t)||(n.add(r),i.push(r));return i}function i1(e){if(!nc(e))return Fl;const t=Ju(e.x,Fl.x),n=Ju(e.y,Fl.y),i=Cb(e.zoom,Fl.zoom);return{x:t,y:n,zoom:i}}function nY(e){if(!nc(e))return{};const t={};for(const[n,i]of Object.entries(e))nc(i)&&(t[n]=s1(i,iY(t)));return t}function s1(e,t){return nc(e)?{x:Ju(e.x,0),y:Ju(e.y,0),width:Cb(e.width,gb),height:Cb(e.height,_b),zIndex:Ju(e.zIndex,t)}:{x:0,y:0,width:gb,height:_b,zIndex:t}}function iY(e){return oL(e)+1}function oL(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Ju(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Cb(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function nc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sY(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function rY(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const c=o.groupId??"__ungrouped__",d=n.querySelector(`[data-drop-zone-group-id="${c}"]`);if(!d)continue;const p=d.getBoundingClientRect();if(e<p.top||e>p.bottom)continue;const f=d.querySelector(`[data-group-section-id="${c}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const g=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const _ of g){const b=_.dataset.sideBarChipId;if(!b||b===i)continue;const S=_.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function aY(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const c=o.dataset.dropZoneGroupId;if(!c||c==="__ungrouped__"||c===i)continue;const d=t.indexOf(c);if(d===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return d}return t.length}function oY(e,t,n,i){const r=e.filter(g=>g!==t),o=new Set(i),c=r.filter(g=>o.has(g)),d=Math.max(0,Math.min(n,c.length));if(c.length===0)return[...r,t];if(d<c.length){const g=r.indexOf(c[d]),_=[...r];return _.splice(g,0,t),_}const p=r.indexOf(c[c.length-1]),f=[...r];return f.splice(p+1,0,t),f}function lY(e,t,n,i){const r=new Set(i),o=e.filter(_=>r.has(_)),c=o.indexOf(t),d=o.filter(_=>_!==t),p=n>c?n-1:n,f=Math.max(0,Math.min(p,d.length));d.splice(f,0,t);let g=0;return e.map(_=>r.has(_)?d[g++]??_:_)}function cY(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let r=0;return e.map(o=>i.has(o)?n[r++]??o:o)}function uY(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(d=>d!==t),o=n>i?n-1:n,c=Math.max(0,Math.min(o,r.length));return r.splice(c,0,t),r}function hY(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(c=>c!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function Zp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function dY(e){const t=Zp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function r1(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=y.useRef(null),o=y.useRef(!1),c=y.useRef(!1),[d,p]=y.useState(!1),[f,g]=y.useState("");y.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const _=()=>{i?.(),c.current=!1,g(t),p(!0)},b=()=>{c.current=!0,p(!1),g("")},S=()=>{if(!o.current){o.current=!0;try{n(f)}finally{o.current=!1,c.current=!0,p(!1)}}};return{renaming:d,draftTitle:f,inputRef:r,begin:_,cancel:b,commit:S,setDraftTitle:g,handleKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),S();return}C.key==="Escape"&&(C.preventDefault(),b())},handleBlur:()=>{if(c.current){c.current=!1;return}S()}}}function lL({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:c,preview:d=!1,onArmClose:p,onDisarmClose:f,onClose:g,onMinimize:_,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:C}){const O=y.useRef(!1),{operation:P,active:z,minimized:T,notificationCount:j,status:M}=e,H=fY(P),F=r1({currentTitle:H,onCommit:E=>C(P.id,E),onBegin:f}),ee=["side-bar-chip",z?"side-bar-chip--active":"",T?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",c?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),ae=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),K={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},B=()=>{if(f(),O.current){O.current=!1;return}b(P.id)},N=E=>{E.stopPropagation()},R=E=>{if(E.stopPropagation(),!n){p(P.id);return}f(),g(P.id)},A=E=>{E.preventDefault(),f(),x(P.id,E.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":P.id,className:ee,role:"button",tabIndex:0,"aria-label":z?`${H} (focused)`:`Focus operation ${H}`,"aria-current":z?"true":void 0,title:d?"Click to open in its Theater":z?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:K,onClick:B,onContextMenu:d?void 0:A,onFocus:()=>{n||f()},onPointerDown:E=>w(E,P.id),onPointerUp:()=>{r&&(O.current=!0)},onKeyDown:E=>{if(E.target===E.currentTarget){if(!d&&E.altKey&&E.shiftKey&&(E.key==="ArrowUp"||E.key==="ArrowDown")){E.preventDefault(),S(P.id,E.key==="ArrowUp"?-1:1);return}(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),B())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(_Y,{})})}),F.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:F.inputRef,value:F.draftTitle,"aria-label":`Rename operation ${H}`,onChange:E=>F.setDraftTitle(E.target.value),onKeyDown:F.handleKeyDown,onBlur:F.handleBlur,onPointerDown:E=>E.stopPropagation(),onClick:E=>E.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:F.begin,children:H}),j>0?u.jsx("span",{className:"side-bar-chip-count",children:j}):null,u.jsx("span",{className:`side-bar-chip-status ${pY(M)}`,role:"img","aria-label":dE(M),title:dE(M)}),!d&&!T?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:N,onClick:E=>{E.stopPropagation(),f(),_(P.id)},"aria-label":`Minimize operation ${H}`,title:"Minimize operation",children:u.jsx(gY,{})}):null,d?null:u.jsx("button",{type:"button",className:ae,onPointerDown:N,onClick:R,"aria-label":n?`Confirm close operation ${H}`:`Close operation ${H}`,title:n?"Confirm close":"Close operation",children:n?"Close?":u.jsx(mY,{})})]})}function fY(e){return e.title}function pY(e){const t=Zp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function dE(e){return dY(e)}function mY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function gY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function _Y(){return u.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function cL({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:c,onContextMenu:d,onPointerDragStart:p}){const f=y.useRef(!1),g=qa(e.color),_=["side-bar-group-header",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={...g?{"--grp-color":g}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=C=>{C.preventDefault(),d(e.id,C.currentTarget.getBoundingClientRect())},w=C=>{C.target instanceof Element&&C.target.closest("button")||p(C,e.id)},x=()=>{i&&(f.current=!0)};return u.jsxs("div",{className:_,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:x,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>c(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:u.jsx(vY,{collapsed:n})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function vY({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const uL="fleet-console.operations.side-width",hL="fleet-console.operations.side-collapsed",dL="fleet-console.operations.theater-collapsed",Jp=280,fE=Jp,kb=new Set,Eb=new Set;let Do={width:wY(),collapsed:xY()},If=CY();function fL(){return y.useSyncExternalStore(kY,Tb,Tb)}function yY(){return y.useSyncExternalStore(TY,pE,pE)}function bY(e){const t=Math.max(Jp,Math.min(pL(),e));if(Do.width!==t){Do={...Do,width:t};try{typeof window<"u"&&localStorage.setItem(uL,String(t))}catch{}mL()}}function a1(e){if(Do.collapsed!==e){Do={...Do,collapsed:e};try{typeof window<"u"&&localStorage.setItem(hL,e?"1":"0")}catch{}mL()}}function SY(e,t){const n=new Set(If);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==If.join("\0")){If=i;try{typeof window<"u"&&localStorage.setItem(dL,JSON.stringify(i))}catch{}EY()}}function pL(){return typeof window<"u"?Math.max(Jp,window.innerWidth-480):800}function wY(){try{if(typeof window>"u")return fE;const e=localStorage.getItem(uL);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Jp,Math.min(pL(),t))}}catch{}return fE}function xY(){try{return typeof window<"u"&&localStorage.getItem(hL)==="1"}catch{return!1}}function CY(){try{if(typeof window>"u")return[];const e=localStorage.getItem(dL),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function mL(){for(const e of kb)e()}function Tb(){return Do}function kY(e){return kb.add(e),()=>kb.delete(e)}function EY(){for(const e of Eb)e()}function pE(){return If}function TY(e){return Eb.add(e),()=>Eb.delete(e)}function gL(e,t){const n=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const r=n.find(o=>o.id===i);if(r)return r}return n.length===1?n[0]:null}const AY=1500,RY=6,mE=34,gE=18;function NY({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:c,catalog:d,canLaunch:p,addingTheater:f,theaterError:g,renderKindIcon:_,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:x,onFocus:C,onSetAccent:O,onRename:P,onSetGroupId:z,onCreateGroup:T,onSetGroupColor:j,onRenameGroup:M,onReorderGroups:H,onUngroupAll:F,onSelectTheater:ee,onAddTheater:ae,onCancelAddTheater:K,onForgetTheater:B}){const N=y.useRef(null),R=y.useRef(null),A=fL(),{width:E,collapsed:L}=A,$=y.useRef(L),q=KN(),X=YN(),D=Vp(),V=y.useRef(null),[J,ce]=y.useState(null),[ie,ve]=y.useState(null),Se=y.useRef(null),Oe=y.useRef([]),Ne=y.useRef([]),ct=y.useRef([]),Ze=y.useRef([]),Re=y.useRef(z),xe=y.useRef(H),[ze,le]=y.useState(null),[We,Le]=y.useState(null),[it,bt]=y.useState(!1),[je,dt]=y.useState(!1),we=DV(),$e=yY(),{operationStatus:ft}=Xs();y.useLayoutEffect(()=>{!$.current&&L&&UN(N.current,".command-band-sidebar-toggle"),$.current=L},[L]);const Ti=n.filter(pe=>pe.theaterId===t),An=i.filter(pe=>pe.theaterId===t),re=new Set(r),de=new Set(we),Ie=Zb(Ti,q.operationOrder).map(pe=>{const Ct=gL(d,pe),Lt=Ct?_(pe.pluginId,Ct):null;return{operation:pe,active:o===pe.id,minimized:re.has(pe.id),notificationCount:c[pe.id]?1:0,status:ft[pe.id],icon:Lt}}),Te=_L(Ie,An,q.operationOrder),St=Te.some(pe=>pe.group!==null),Wn=Te.flatMap(pe=>pe.groupId?[pe.groupId]:[]),Xn=Te.flatMap(pe=>de.has(pe.groupId??"")?[]:pe.entries),yt=Ie.map(pe=>pe.operation.id),Rt=y.useCallback(()=>{V.current!==null&&(window.clearTimeout(V.current),V.current=null)},[]),Pt=y.useCallback(()=>{Rt(),ce(null)},[Rt]),_s=y.useCallback(pe=>{Rt(),ce(pe),V.current=window.setTimeout(()=>{V.current=null,ce(null)},AY)},[Rt]);y.useEffect(()=>Rt,[Rt]),y.useEffect(()=>{J!==null&&(Ie.some(pe=>pe.operation.id===J)||Pt())},[J,Ie,Pt]);const yn=ze?.kind==="chip"?Ie.find(pe=>pe.operation.id===ze.operationId)?.operation??null:null,yi=ze?.kind==="group"?i.find(pe=>pe.id===ze.groupId)??null:null,Rn=ze?.kind==="theater"?e.find(pe=>pe.id===ze.theaterId)??null:null,vs=(pe,Ct)=>{const Lt=Xn.findIndex(Gt=>Gt.operation.id===pe);if(Lt===-1)return;const Xe=Math.max(0,Math.min(Xn.length-1,Lt+Ct));if(Xe===Lt)return;const Ce=Xn.map(Gt=>Gt.operation.id),zt=hY(Ce,pe,Xe);pv(cY(yt,Ce,zt))},$s=Te.map(pe=>({groupId:pe.groupId,entryIds:pe.entries.map(Ct=>Ct.operation.id)}));y.useEffect(()=>{Oe.current=Ie,Ne.current=yt,ct.current=$s,Ze.current=Wn,Re.current=z,xe.current=H});const qt=pe=>{Se.current=pe,ve(pe)},W=ie?.pointerId??null;y.useEffect(()=>{if(W===null)return;const pe=Xe=>{if(Xe.pointerId!==W)return;const Ce=Se.current;if(!Ce)return;if(Xe.buttons===0){qt(null);return}const zt=Math.hypot(Xe.clientX-Ce.startX,Xe.clientY-Ce.startY);if(!Ce.dragging&&zt<RY)return;if(Ce.dragging&&Xe.preventDefault(),PY(Xe.clientY,R.current),Ce.kind==="chip"){const li=rY(Xe.clientY,ct.current,R.current,Ce.sourceId);qt({...Ce,currentY:Xe.clientY,dragging:!0,dropIndex:li.index,dropGroupId:li.groupId});return}const Gt=aY(Xe.clientY,Ze.current,R.current,Ce.sourceGroupId);qt({...Ce,currentY:Xe.clientY,dragging:!0,dropIndex:Gt})},Ct=Xe=>{if(Xe.pointerId!==W)return;const Ce=Se.current;if(qt(null),!Ce?.dragging)return;if(Ce.kind==="group"){const rt=uY(Ze.current,Ce.sourceGroupId,Ce.dropIndex);if(rt.join("\0")===Ze.current.join("\0"))return;xe.current(rt);return}const{sourceId:zt,sourceGroupId:Gt,dropIndex:li,dropGroupId:bi}=Ce,Qi=ct.current,Si=Ne.current;if(bi!==Gt){const ot=Qi.find(Ht=>Ht.groupId===bi)?.entryIds??[];pv(oY(Si,zt,li,ot)),Re.current(zt,bi);return}const U=Qi.find(rt=>rt.groupId===Gt)?.entryIds??[],ue=U.indexOf(zt);if(ue===-1||li===ue)return;const Ae=lY(Si,zt,li,U);pv(Ae)},Lt=Xe=>{Xe.pointerId===W&&qt(null)};return window.addEventListener("pointermove",pe),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Lt),()=>{window.removeEventListener("pointermove",pe),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Lt)}},[W]);const fe=(pe,Ct)=>{if(pe.button!==0||pe.target instanceof Element&&pe.target.closest("button"))return;le(null),Pt();const Xe=Ie.find(Ce=>Ce.operation.id===Ct)?.operation.groupId??null;qt({kind:"chip",sourceId:Ct,sourceGroupId:Xe,pointerId:pe.pointerId,startX:pe.clientX,startY:pe.clientY,currentY:pe.clientY,dragging:!1,dropIndex:yt.indexOf(Ct),dropGroupId:Xe})},be=(pe,Ct)=>{pe.button===0&&(pe.target instanceof Element&&pe.target.closest("button")||Wn.includes(Ct)&&(le(null),Pt(),qt({kind:"group",sourceGroupId:Ct,pointerId:pe.pointerId,startX:pe.clientX,startY:pe.clientY,currentY:pe.clientY,dragging:!1,dropIndex:Wn.indexOf(Ct)})))},Ke=y.useCallback(pe=>{pe.preventDefault();const Ct=pe.clientX,Lt=A.width;dt(!0);const Xe=zt=>{const Gt=zt.clientX-Ct;bY(Lt+Gt)},Ce=()=>{dt(!1),document.removeEventListener("pointermove",Xe),document.removeEventListener("pointerup",Ce),document.removeEventListener("pointercancel",Ce)};document.addEventListener("pointermove",Xe),document.addEventListener("pointerup",Ce),document.addEventListener("pointercancel",Ce)},[A.width]),$t=()=>{a1(!L)},Nt=()=>{Le(null),le(null),bt(!0)},Be=()=>{bt(!1),K()},Me=pe=>{bt(!1),ae(pe)},Ye=pe=>{pe.defaultPrevented||(pe.preventDefault(),le(null),Le({anchor:{x:pe.clientX,y:pe.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Jt=y.useCallback(()=>{const pe=ze?.kind==="theater"?ze.returnFocus:null;le(null),pe?.focus()},[ze]),pt=(pe,Ct)=>{pe.stopPropagation(),Ct!==t&&ee(Ct),le(null);const Lt=pe.currentTarget.getBoundingClientRect();Le({anchor:{x:Lt.right+8,y:Lt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},On=pe=>{SY(pe,!$e.includes(pe))};return u.jsxs("aside",{className:`operations-side-bar ${L?"is-closed":"is-expanded"}`,ref:N,"data-sidebar-state":L?"closed":"expanded","data-resizing":je?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${E}px`},inert:L,onContextMenu:Ye,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Nt,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[u.jsx(o1,{}),u.jsx("span",{children:"Add Theater"})]}),u.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>S(),disabled:t===null,"aria-label":"Reset canvas view",title:"Reset canvas view",children:u.jsx(MY,{})}),u.jsx("span",{className:"side-bar-formation-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>mv("grid"),disabled:t===null,"aria-pressed":D&&X==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:u.jsx(LY,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>mv("columns"),disabled:t===null,"aria-pressed":D&&X==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:u.jsx(OY,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>mv("rows"),disabled:t===null,"aria-pressed":D&&X==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:u.jsx(DY,{})})]})]}),!L&&g?u.jsx("p",{className:"side-bar-theater-error",children:g}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:R,"aria-label":"Operations",children:e.map(pe=>{const Ct=pe.id===t,Lt=n.filter(Ce=>Ce.theaterId===pe.id).length,Xe=$e.includes(pe.id);if(!Ct){const Ce=NV(pe.id),zt=jY({theaterId:pe.id,operations:n,operationOrder:Ce.operationOrder,minimizedSet:new Set(Ce.minimized),activeOperationId:null,operationNotifications:c,operationStatus:ft,catalog:d,renderKindIcon:_});return u.jsx(IY,{theater:pe,entries:Xe?[]:zt,groups:i.filter(Gt=>Gt.theaterId===pe.id),collapsedGroups:new Set(Ce.collapsedGroups),operationAccent:Ce.operationAccent,operationCount:Lt,collapsed:Xe,onSelectTheater:ee,onFocus:C,onToggleCollapsed:On,onOpenActions:(Gt,li)=>{Le(null),le({kind:"theater",theaterId:pe.id,anchor:Gt,returnFocus:li})},onOpenLaunch:pt,onContextMenu:Gt=>{Le(null),le({kind:"theater",theaterId:pe.id,anchor:Gt})}},pe.id)}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":pe.id,children:[u.jsx(vL,{theater:pe,operationCount:Lt,active:!0,collapsed:Xe,onSelectTheater:ee,onToggleCollapsed:On,onOpenActions:(Ce,zt)=>{Le(null),le({kind:"theater",theaterId:pe.id,anchor:Ce,returnFocus:zt})},onOpenLaunch:pt,onContextMenu:Ce=>{Le(null),le({kind:"theater",theaterId:pe.id,anchor:Ce})}}),Xe?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${pe.label} operations`,children:Te.map(Ce=>{const zt=Ce.groupId!==null&&de.has(Ce.groupId),Gt=Ce.group?qa(Ce.group.color):null,li=Gt?{"--grp-color":Gt}:void 0,bi=Ce.groupId?Wn.indexOf(Ce.groupId):-1,Qi=ie?.kind==="group"&&ie.sourceGroupId===Ce.groupId&&ie.dragging,Si=ie?.kind==="group"&&ie.dragging&&Ce.groupId!==null&&ie.sourceGroupId!==Ce.groupId&&ie.dropIndex===bi,He=ie?.kind==="group"&&ie.dragging&&Ce.groupId!==null&&ie.sourceGroupId!==Ce.groupId&&bi===Wn.length-1&&ie.dropIndex===Wn.length,U=[Ce.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Si?"side-bar-group-section--drop-before":"",He?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":Ce.groupId??"__ungrouped__",className:U,style:li,children:[Ce.group?u.jsx(cL,{group:Ce.group,count:Ce.entries.length,collapsed:zt,dragging:Qi,dragOffsetY:Qi?ie.currentY-ie.startY:0,dropTarget:Si,onToggle:ZN,onContextMenu:(ue,Ae)=>le({kind:"group",groupId:ue,anchor:Ae}),onPointerDragStart:be}):St&&Ce.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,zt?null:u.jsx("ol",{className:["side-bar-group-chips",ie?.kind==="chip"&&ie.dragging&&ie.dropGroupId===Ce.groupId&&ie.dropGroupId!==ie.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ce.groupId??"__ungrouped__","aria-label":Ce.group?Ce.group.name:"Ungrouped",children:Ce.entries.map(ue=>{const Ae=Ie.indexOf(ue),rt=Ce.entries.indexOf(ue),ot=q.operationAccent[ue.operation.id]??mb(ue.operation),Ht=ot?qa(ot):null;return u.jsx(lL,{entry:ue,index:Ae,isCloseArmed:J===ue.operation.id,accentValue:Ht,dragging:ie?.kind==="chip"&&ie.sourceId===ue.operation.id&&ie.dragging,dragOffsetY:ie?.kind==="chip"&&ie.sourceId===ue.operation.id&&ie.dragging?ie.currentY-ie.startY:0,dropTarget:ie?.kind==="chip"&&ie.dragging===!0&&ie.dropGroupId===Ce.groupId&&ie.dropGroupId===ie.sourceGroupId&&ie.dropIndex===rt&&ie.sourceId!==ue.operation.id,onArmClose:_s,onDisarmClose:Pt,onClose:w,onMinimize:x,onFocus:C,onKeyboardMove:vs,onPointerDragStart:fe,onOpenAccent:(un,hn)=>le({kind:"chip",operationId:un,anchor:hn}),onRename:P},ue.operation.id)})})]},Ce.groupId??"__ungrouped__")})})]},pe.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Ke,onDoubleClick:$t,"aria-hidden":"true"}),We?Va.createPortal(u.jsx(FN,{anchor:We.anchor,viewportBounds:We.viewportBounds,placement:"cursor",catalog:d,canLaunch:p,renderKindIcon:_,onLaunchKind:(pe,Ct)=>{Le(null),b(pe,Ct)},onClose:()=>Le(null)},`${We.anchor.x}:${We.anchor.y}`),document.body):null,ze?.kind==="chip"&&yn?u.jsx(sE,{kind:"chip",operation:yn,groups:i.filter(pe=>pe.theaterId===yn.theaterId),accentKey:q.operationAccent[yn.id]??mb(yn),anchor:ze.anchor,actions:{onSetAccent:pe=>O(yn.id,pe),onSetGroupId:pe=>z(yn.id,pe),onCreateGroup:pe=>T(yn.theaterId,pe,yn.id)},onClose:()=>le(null)}):ze?.kind==="group"&&yi?u.jsx(sE,{kind:"group-header",group:yi,anchor:ze.anchor,actions:{onSetColor:pe=>j(yi.id,pe),onRename:pe=>M(yi.id,pe),onUngroupAll:()=>F(yi.id)},onClose:()=>le(null)}):ze?.kind==="theater"&&Rn?u.jsx(BY,{theater:Rn,groupCount:i.filter(pe=>pe.theaterId===Rn.id).length,anchor:ze.anchor,onCreateGroup:pe=>{T(Rn.id,pe),Jt()},onForgetTheater:()=>{B(Rn.id),Jt()},onClose:Jt}):null,u.jsx(WN,{open:it,onCancel:Be,onConfirm:Me}),L?null:u.jsx(nj,{})]})}function LY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function MY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function OY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function DY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function _L(e,t,n){const i=[...t].sort((d,p)=>d.order-p.order||d.createdAt-p.createdAt),r=i.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},c=new Map(i.map(d=>[d.id,d]));for(const d of e){const p=d.operation.groupId??null;p!==null&&c.has(p)?r.find(g=>g.groupId===p)?.entries.push(d):o.entries.push(d)}return[...r,o]}function jY({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:c,catalog:d,renderKindIcon:p}){return Zb(t.filter(f=>f.theaterId===e),n).map(f=>{const g=gL(d,f),_=g?p(f.pluginId,g):null;return{operation:f,active:r===f.id,minimized:i.has(f.id),notificationCount:o[f.id]?1:0,status:c[f.id],icon:_}})}function vL({theater:e,operationCount:t,active:n,collapsed:i,onSelectTheater:r,onToggleCollapsed:o,onOpenActions:c,onOpenLaunch:d,onContextMenu:p}){const f=_=>{_.preventDefault(),p(_.currentTarget.getBoundingClientRect())},g=_=>{_.target===_.currentTarget&&(_.key!=="Enter"&&_.key!==" "||(_.preventDefault(),r(e.id)))};return u.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${n?" is-active":""}`,onClick:()=>r(e.id),onKeyDown:g,onContextMenu:f,"aria-current":n?"true":void 0,"aria-expanded":!i,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:yL(e.label)}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx("span",{className:"side-bar-theater-count",children:t}),u.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":i?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!i,title:i?"Expand":"Collapse",onClick:_=>{_.stopPropagation(),o(e.id)},children:u.jsx($Y,{collapsed:i})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:_=>{_.stopPropagation(),c(_.currentTarget.getBoundingClientRect(),_.currentTarget)},children:u.jsx(zY,{})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:_=>d(_,e.id),children:u.jsx(o1,{})})]})]})}function IY({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:c,onSelectTheater:d,onFocus:p,onToggleCollapsed:f,onOpenActions:g,onOpenLaunch:_,onContextMenu:b}){const S=_L(t,n),w=S.some(x=>x.group!==null);return u.jsxs("li",{className:"side-bar-theater-section","data-theater-id":e.id,children:[u.jsx(vL,{theater:e,operationCount:o,active:!1,collapsed:c,onSelectTheater:d,onToggleCollapsed:f,onOpenActions:g,onOpenLaunch:_,onContextMenu:b}),!c&&S.length>0?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:S.map(x=>{const C=x.groupId!==null&&i.has(x.groupId),O=x.group?qa(x.group.color):null;return u.jsxs("li",{className:x.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:O?{"--grp-color":O}:void 0,children:[x.group?u.jsx(cL,{group:x.group,count:x.entries.length,collapsed:C,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:P=>OV(e.id,P),onContextMenu:()=>{},onPointerDragStart:()=>{}}):w&&x.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,C?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":x.group?x.group.name:"Ungrouped",children:x.entries.map((P,z)=>{const T=r[P.operation.id]??mb(P.operation),j=T?qa(T):null;return u.jsx(lL,{entry:P,index:z,isCloseArmed:!1,accentValue:j,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:p,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},P.operation.id)})})]},x.groupId??"__ungrouped__")})}):null]})}function BY({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[c,d]=y.useState(!1),[p,f]=y.useState(`Group ${t+1}`),g=y.useRef(!1),_=y.useRef(null),b=y.useRef(null),[S,w]=y.useState(n.bottom+6);y.useLayoutEffect(()=>{const C=b.current?.getBoundingClientRect().height??0,O=window.innerHeight-C-8;w(Math.max(8,Math.min(n.bottom+6,O)))},[n,c]),y.useEffect(()=>{c&&_.current?.select()},[c]),y.useEffect(()=>{const C=O=>{O.key==="Escape"&&(O.preventDefault(),o())};return window.addEventListener("keydown",C),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",C),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const C=p.trim();C&&i(C)};return Va.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:u.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:C=>C.stopPropagation(),children:[c?u.jsx("input",{ref:_,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:C=>f(C.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:C=>{C.key==="Enter"&&!g.current&&(C.preventDefault(),x()),C.key==="Escape"&&(C.preventDefault(),d(!1))},onBlur:()=>d(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>d(!0),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(o1,{})}),u.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),u.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:r,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(FY,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function PY(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+mE?t.scrollTop-=gE:e>n.bottom-mE&&(t.scrollTop+=gE)}function $Y({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?u.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):u.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function zY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function o1(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function yL(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>HY(i)):bL(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function HY(e){return bL(e).slice(0,1)}function bL(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function FY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}let SL=!1;const Ab=new Set;function UY(){return y.useSyncExternalStore(WY,_E,_E)}function _E(){return SL}function wL(e){SL=qY(e)?e.fullscreen:!1;for(const t of Ab)t()}function vE(){wL({fullscreen:!1})}function WY(e){return Ab.add(e),()=>Ab.delete(e)}function qY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Object.keys(t).length===1&&typeof t.fullscreen=="boolean"}const xL="(display-mode: fullscreen)",GY=480,KY=480,VY=()=>!0;function YY(){return typeof window<"u"&&window.matchMedia(xL).matches}function XY(e=VY){const t=UY(),[n,i]=y.useState(YY),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,c=y.useRef(o);c.current=o;const d=y.useRef(!1),p=y.useRef(null),[f,g]=y.useState(o),[_,b]=y.useState(!0),[S,w]=y.useState(!1),x=y.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]),C=y.useCallback(T=>{x(),!(!c.current||d.current)&&(p.current=setTimeout(()=>{p.current=null,c.current&&!d.current&&e()&&b(!1)},T))},[e,x]),O=y.useCallback(()=>{x(),c.current&&b(!0)},[x]),P=y.useCallback(()=>C(KY),[C]),z=y.useCallback(()=>{const T=!d.current;d.current=T,w(T),T&&(x(),b(!0))},[x]);return y.useEffect(()=>{const T=window.matchMedia(xL),j=()=>i(T.matches);return j(),T.addEventListener("change",j),()=>T.removeEventListener("change",j)},[]),y.useLayoutEffect(()=>(x(),g(o),b(!0),o&&!d.current&&C(GY),x),[x,o,C]),{isFullscreen:f,isVisible:_,isPinned:S,reveal:O,hideAfterLeave:P,togglePin:z}}function ZY({operationsViewVisible:e}){const t=Xs(),n=hc(),i=fL(),r=iT(),o=QY(),c=`${o}${o==="⌘"?"":"+"}B`,d=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,p=t.theaters.find(je=>je.id===t.activeTheaterId)??null,f=t.operations.find(je=>je.id===t.activeOperationId)??null,g=f?n.plugins.find(je=>je.id===f.pluginId):null,_=typeof f?.payload.cliId=="string"?f.payload.cliId:null,b=typeof f?.payload.cliLabel=="string"?f.payload.cliLabel:_,S=f?g?.operationKinds?.find(je=>je.type===f.type)??null:null,w=f&&g?.renderLaunchIcon?g.renderLaunchIcon({id:_??f.type,type:f.type,title:S?.title??f.type}):null,x=sT(),C=y.useRef(null),O=y.useRef(null),P=y.useRef(null),z=y.useRef(null),T=y.useRef(null),j=y.useRef(null),M=y.useRef({edge:!1,band:!1}),H=y.useRef(null),[F,ee]=y.useState(!1),[ae,K]=y.useState(!1),[B,N]=y.useState(null),[R,A]=y.useState(null),[E,L]=y.useState(!1),[$,q]=y.useState(null),[X,D]=y.useState(null),V=()=>{N(null),A(null),L(!1),q(null),D(null)},J=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",ce=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",ie=y.useCallback(()=>{const je=document.activeElement;return!(je instanceof Node&&(T.current?.contains(je)||j.current?.contains(je)))&&!M.current.edge&&!M.current.band},[]),ve=XY(ie),Se=r1({currentTitle:f?.title??"",onCommit:je=>{const dt=sC(H.current,t.activeOperationId);H.current=null,dt&&x5(dt,je).then(()=>Xi(null)).then(fs).catch(()=>{})}});y.useEffect(()=>{!Se.renaming||sC(H.current,t.activeOperationId)||(H.current=null,Se.cancel())},[Se,t.activeOperationId]),y.useEffect(()=>{if(!F)return;const je=dt=>{const we=dt.target;!(we instanceof Node)||C.current?.contains(we)||O.current?.contains(we)||ee(!1)};return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[F]),y.useEffect(()=>{if(!ae)return;const je=new AbortController;return N(null),A(null),L(!0),AO(je.signal).then(N).catch(dt=>{je.signal.aborted||A(dt instanceof Error?dt.message:"Unable to load environment details.")}).finally(()=>{je.signal.aborted||L(!1)}),()=>je.abort()},[ae]),y.useEffect(()=>{if(!ae)return;const je=we=>{const $e=we.target;!($e instanceof Node)||P.current?.contains($e)||z.current?.contains($e)||(K(!1),V())},dt=we=>{we.key==="Escape"&&(K(!1),V(),P.current?.focus())};return document.addEventListener("pointerdown",je),document.addEventListener("keydown",dt),()=>{document.removeEventListener("pointerdown",je),document.removeEventListener("keydown",dt)}},[ae]),y.useEffect(()=>{t.channel!=="local"&&(K(!1),N(null),A(null),L(!1),q(null),D(null))},[t.channel]),y.useEffect(()=>{KO(F,x.isPathContextDeckOpen)&&ee(!1)},[F,x.isPathContextDeckOpen]);const Oe=()=>{ee(!1),C.current?.focus()},Ne=je=>{navigator.clipboard.writeText(je).then(()=>{q(je),D(null)}).catch(()=>{D(je),q(null)})},ct=()=>{const je=!F;ee(je),wf(VO(je,x.isPathContextDeckOpen))},Ze=je=>{p&&tT(p.id,dt=>G5(p.id,je,dt))},Re=()=>{f&&(H.current=f.id,Se.begin())},xe=()=>{ie()&&ve.hideAfterLeave()},ze=je=>{const dt=je.relatedTarget;(!(dt instanceof Node)||!T.current?.contains(dt)&&!j.current?.contains(dt))&&!M.current.edge&&!M.current.band&&ve.hideAfterLeave()},le=()=>{M.current.edge=!0,ve.reveal()},We=()=>{M.current.edge=!1,xe()},Le=()=>{M.current.band=!0,ve.reveal()},it=()=>{M.current.band=!1,xe()},bt=ve.isFullscreen&&!ve.isVisible;return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:j,type:"button",className:`command-band-edge-reveal${ve.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:le,onPointerLeave:We,onFocus:ve.reveal,onBlur:ze,onKeyDown:je=>{je.key==="Tab"&&ve.reveal()}}),u.jsxs("header",{ref:T,className:`command-band${e?" is-operations":" is-utility"}${ve.isFullscreen?" is-fullscreen":""}${ve.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":bt||void 0,inert:bt||void 0,onPointerEnter:Le,onPointerLeave:it,onFocus:ve.reveal,onBlur:ze,children:[u.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[u.jsx(ij,{className:"command-band-brand"}),t.channel==="local"?u.jsxs("div",{className:"command-band-environment",children:[u.jsxs("button",{ref:P,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":ae,onClick:()=>{V(),K(je=>!je)},children:[u.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),u.jsx("span",{className:"command-band-local-chip-label",children:J?ce:"Local"})]}),ae?u.jsx("div",{ref:z,children:u.jsx(JY,{environment:B,error:R,loading:E,copiedValue:$,copyFailedValue:X,desktopShell:J,onCopy:Ne})}):null]}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>a1(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,children:u.jsx(yE,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:P5,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(eX,{})})]}),u.jsxs("div",{className:"command-band-center",children:[e&&p?u.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${p.label}`,children:[u.jsxs("span",{className:"command-band-theater-segment",children:[u.jsx("span",{className:"command-band-theater-mark",children:yL(p.label)}),p.label]}),f?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),Se.renaming?u.jsx("input",{ref:Se.inputRef,className:"command-band-rename-input",value:Se.draftTitle,"aria-label":`${f.title} 이름 변경`,onChange:je=>Se.setDraftTitle(je.target.value),onKeyDown:Se.handleKeyDown,onBlur:Se.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:Re,title:"Double-click to rename",children:f.title}),b?u.jsxs("span",{className:"command-band-operation-attribute",title:S?.title??b,children:[w?u.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:w}):null,b]}):null]}):null]}):null,e&&p&&x.pathContextHydrated&&x.pathContext?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-context-separator","aria-hidden":"true"}),u.jsxs("div",{className:"command-band-context",children:[u.jsxs("button",{ref:C,type:"button",className:"command-band-context-trigger",onClick:ct,"aria-expanded":F,"aria-haspopup":"dialog",title:x.pathContextError??"Path context — shared with the Activity Rail",children:[u.jsx(nX,{}),x.pathContext.label,u.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),F?u.jsx(Z5,{ref:O,className:"command-band-context-deck",theaterId:p.id,theaterLabel:p.label,context:x.pathContext,isMutating:x.pathContextMutationInProgress,onSelect:Ze,onClose:Oe}):null]})]}):null]}),u.jsxs("div",{className:"command-band-right",children:[ve.isFullscreen?u.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:ve.togglePin,"aria-label":"Pin command band","aria-pressed":ve.isPinned,title:ve.isPinned?"Unpin command band":"Pin command band",children:u.jsx(tX,{})}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:Q5,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,children:u.jsx(yE,{side:"right"})}):null]})]})]})}function JY({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:c}){if(n)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:t});if(!e)return null;const d=[["Channel",e.channel],["Version",e.version],["Reachable on",`127.0.0.1:${e.effectivePort}`],["Data root",e.dataDir],["Runtime lock",e.lockFile],...o?[["Desktop data",`${e.dataDir}/desktop`]]:[]];return u.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[u.jsx("div",{className:"command-band-environment-title",children:"Environment"}),d.map(([p,f])=>u.jsxs("div",{className:"command-band-environment-row",children:[u.jsx("span",{children:p}),u.jsx("code",{children:f}),u.jsx("button",{type:"button",onClick:()=>c(f),children:i===f?"Copied":r===f?"Copy failed":"Copy"})]},p)),u.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function QY(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function eX(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function yE({side:e}){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function tX(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function nX(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 iX=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function sX({state:e}){const[t,n]=y.useState(!1),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e.theaters.length>0;if(y.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const g=i.current;i.current=null,g?.focus?.()}},[e.onboardingOpen]),y.useEffect(()=>{if(!e.onboardingOpen)return;const g=_=>{t||(_.key==="Escape"?(_.preventDefault(),au()):_.key==="Tab"&&rX(_,o.current),_.stopImmediatePropagation())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const d=()=>{n(!0)},p=()=>{n(!1)},f=async g=>{n(!1),j5();try{const _=await w5(g),b=await S5(_);I5(b)}catch(_){Wv(_ instanceof Error?_.message:String(_))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:au,"aria-label":"Close setup guide"}),u.jsxs("section",{className:"commissioning-card",ref:o,children:[u.jsxs("header",{className:"commissioning-header",children:[u.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),u.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),u.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),u.jsxs("ol",{className:"commissioning-steps",children:[u.jsxs("li",{className:`commissioning-step commissioning-step--primary ${c?"is-complete":"is-current"}`,children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:c?"✓":"01"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Register a Theater"}),u.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),c?u.jsx(eh,{ref:g=>{r.current=g},className:"commissioning-primary-action",to:"/operations",onClick:au,children:"Go to Operations →"}):u.jsx("button",{ref:g=>{r.current=g},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:d,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Open an Operation"}),u.jsx("p",{children:"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session."}),u.jsx(eh,{className:"commissioning-secondary-link",to:"/operations",onClick:au,children:"Go to Operations"})]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Monitor Carriers"}),u.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),u.jsxs("footer",{className:"commissioning-footer",children:[u.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),u.jsx("button",{type:"button",className:"commissioning-skip",onClick:au,children:"Skip for now"})]})]}),u.jsx(WN,{open:t,onCancel:p,onConfirm:f})]})}function rX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(iX)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}const aX="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",bE="operation-search-listbox",CL="__unassigned__";function oX({state:e}){const t=oc(),[n,i]=y.useState(""),[r,o]=y.useState(0),c=y.useRef(null),d=y.useRef(null),p=y.useRef(null),f=y.useRef(new Map),g=y.useMemo(()=>ID(e),[e]),_=y.useMemo(()=>ZO(g,n),[g,n]),b=y.useMemo(()=>JO(_),[_]),S=y.useMemo(()=>E5(n),[n]),w=SE(r,_.length),x=_[w]?wE(_[w].operationId):void 0;if(y.useEffect(()=>{if(!e.operationSearchOpen)return;p.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const P=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>c.current?.focus(),0),()=>{document.body.style.overflow=P,p.current?.focus()}},[e.operationSearchOpen]),y.useEffect(()=>{if(!e.operationSearchOpen){i(""),o(0);return}o(0)},[e.operationSearchOpen,n]),y.useEffect(()=>{if(!e.operationSearchOpen)return;const P=_[w];P&&f.current.get(P.operationId)?.scrollIntoView({block:"nearest"})},[w,_,e.operationSearchOpen]),!e.operationSearchOpen)return null;const C=P=>{ih(P),t("/operations"),p_()},O=P=>{if(P.key==="Escape"){P.preventDefault(),p_();return}if(P.key==="ArrowDown"||P.key==="ArrowUp"){P.preventDefault(),o(z=>SE(z+(P.key==="ArrowDown"?1:-1),_.length));return}if(P.key==="Enter"){const z=_[w];if(!z)return;P.preventDefault(),C(z.operationId);return}P.key==="Tab"&&hX(P,d.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:P=>{P.target===P.currentTarget&&p_()},children:u.jsxs("section",{ref:d,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:O,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(dX,{}),u.jsx("input",{ref:c,id:"operation-search-input",type:"search",value:n,onChange:P=>i(P.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":bE,"aria-activedescendant":x,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:bE,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:b.length>0?b.map(P=>{const z=cX(P.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":z,children:[u.jsx("h2",{id:z,className:"operation-search-section-heading",children:gv(P.theaterLabel,S)}),P.entries.map(T=>{const j=_.indexOf(T),M=j===w;return u.jsxs("button",{id:wE(T.operationId),ref:H=>{H?f.current.set(T.operationId,H):f.current.delete(T.operationId)},type:"button",className:`operation-search-result ${M?"is-active":""}`,role:"option","aria-selected":M,onMouseEnter:()=>o(j),onClick:()=>C(T.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:gv(T.operationName,S)}),u.jsx("small",{children:lX(T)})]}),u.jsx("span",{className:"operation-search-theater",children:gv(T.theaterLabel,S)})]},T.operationId)})]},P.theaterId??CL)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function SE(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function lX(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function cX(e){return`operation-search-heading-${kL(e??CL)}`}function wE(e){return`operation-search-option-${kL(e)}`}function kL(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function gv(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=uX(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(u.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function uX(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const c=i.indexOf(o,n);c!==-1&&(!r||c<r.start)&&(r={start:c,end:c+o.length})}return r}function hX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(aX)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],r=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i?.focus())}function dX(){return u.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function fX({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),n?u.jsx("p",{className:"app-toast-message",children:n}):null]}),r?u.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function EL(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await TL(t),AL(await t.json(),t.status)}async function pX(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await TL(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new tn(n.status,"Invalid global settings mutation response");return{state:AL(i.state,n.status)}}async function TL(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new tn(e.status,t)}function AL(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!mX(n.consoleStaticPort)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!gX(n.language))throw new tn(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,theme:n.theme,uiFont:oD(n.uiFont),language:n.language}}function mX(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function gX(e){return e==="auto"||e==="en"||e==="ko"}const Rb=new Set;let gh={loading:!1,state:null,savingField:null,error:null};function l1(){return y.useSyncExternalStore(vX,Cp,Cp)}function Cp(){return gh}function _X(e){jo({loading:!1,state:e,error:null})}function vX(e){return Rb.add(e),()=>{Rb.delete(e)}}async function yX(e){jo({loading:!0,error:null});try{const t=await EL(e);jo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;jo({loading:!1,error:RL(t)})}}async function ic(e,t){if(gh.savingField!==null)return!1;const n=gh.state,i=n?{...n,[e]:t}:null;jo({state:i,savingField:e,error:null});try{const r=await pX({[e]:t});return jo({state:r.state,savingField:null,error:null}),!0}catch(r){return jo({state:n,savingField:null,error:RL(r)}),!1}}function jo(e){gh={...gh,...e};for(const t of Rb)t()}function RL(e){return e instanceof Error?e.message:String(e)}let Xl=null,Uu=0;function NL(e){Xl?.abort();const t=new AbortController,n=++Uu;return Xl=t,pD(),RO({...e,signal:t.signal}).then(i=>{n===Uu&&mD(i)}).catch(i=>{t.signal.aborted||n!==Uu||gD(i instanceof Error?i.message:String(i))}).finally(()=>{n===Uu&&(Xl=null)})}function bX(){Xl!==null&&(Xl.abort(),Xl=null,Uu+=1)}function LL(e,t=SX()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function SX(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const ML=[{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"}],_v={id:"overview",label:"Overview"},wX={id:"all-updates",label:"All updates"},xX={id:"other-updates",label:"Other updates"};function OL(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=ML.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[_v,wX]:t?[_v,...n,xX]:[_v,...n]}function CX(e,t){return t==="overview"?[]:e.sections.map(n=>({...n,items:n.items.filter(i=>t==="all-updates"||t==="other-updates"?i.product===void 0:i.product===t)})).filter(n=>n.items.length>0)}function kX(e){const t=ML.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(c=>c.product===i.id));return r.length===0?[]:[{id:i.id,label:i.label,count:r.length,summary:r[0].text}]}),n=e.sections.flatMap(i=>i.items.filter(r=>r.product===void 0));return n.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:n.length,summary:n[0].text}]}function EX(e,t){return OL(e).some(n=>n.id===t)}const TX=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Au=10;function AX({state:e}){const t=y.useRef(null),n=y.useRef([]),i=y.useRef(null),r=y.useRef(null),o=y.useRef(new Map),[c,d]=y.useState("overview"),p=l1(),f=LL(p.state?.language??"auto"),g=e.selectedReleaseNoteKey??Rl(e.releaseNotes[0]?.version??"",0),_=e.releaseNotes.findIndex((F,ee)=>Rl(F.version,ee)===g),b=e.releaseNotes[_]??e.releaseNotes[0],S=b?Rl(b.version,_>=0?_:0):"",w=b?OL(b):[];y.useEffect(()=>{d("overview")},[S]),y.useEffect(()=>{b&&!EX(b,c)&&d("overview")},[c,b]),y.useEffect(()=>{const F=ee=>{const ae=ee.target instanceof HTMLElement?ee.target:null;if(!ae||ae.closest(".whatsnew-card"))return;const K=n.current.filter(B=>B!==ae&&B.isConnected);n.current=[...K.slice(-4),ae]};return document.addEventListener("focusin",F,!0),()=>document.removeEventListener("focusin",F,!0)},[]);const x=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!x&&t.current===null&&(t.current=document.activeElement),y.useEffect(()=>{if(!e.whatsNewOpen||x)return;const F=ee=>{ee.key==="Escape"?(ee.preventDefault(),Fd()):MX(ee,r.current,d)?ee.preventDefault():ee.key==="Tab"&&LX(ee,r.current),ee.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",F,!0),()=>{window.removeEventListener("keydown",F,!0);const ee=t.current?.isConnected?t.current:[...n.current].reverse().find(ae=>ae.isConnected);t.current=null,ee?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const C=()=>{NL({force:!0,locale:f})},O=async F=>{await ic("language",F)},P=Math.max(1,Math.ceil(e.releaseNotes.length/Au)),z=Math.min(P-1,Math.floor((_>=0?_:0)/Au)),T=z*Au,j=e.releaseNotes.slice(T,T+Au),M=F=>{const ee=z+F;if(ee<0||ee>=P)return;const ae=ee*Au,K=e.releaseNotes[ae];K&&oC(Rl(K.version,ae))},H=F=>{d(F),requestAnimationFrame(()=>o.current.get(F)?.focus())};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Fd,"aria-label":"Close What's new"}),u.jsxs("section",{className:"whatsnew-card",ref:r,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:"What's new"}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?u.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:Fd,"aria-label":"Close What's new",children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx("select",{"aria-label":"Release version",value:S,onChange:F=>oC(F.currentTarget.value),children:j.map((F,ee)=>{const ae=T+ee;return u.jsxs("option",{value:Rl(F.version,ae),children:[F.version==="Unreleased"?"Unreleased":`v${F.version}`,F.date?` · ${F.date}`:""]},Rl(F.version,ae))})}),P>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(-1),disabled:z===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[z+1," / ",P]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(1),disabled:z>=P-1,"aria-label":"Older versions",children:"›"})]}):null,u.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(F=>u.jsx("button",{type:"button",className:f===F?"is-active":"","aria-pressed":f===F,disabled:p.savingField==="language",onClick:()=>{O(F)},children:F==="en"?"EN":"한국어"},F))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:C,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),u.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(F=>u.jsx("button",{ref:ee=>{ee?o.current.set(F.id,ee):o.current.delete(F.id)},id:`whatsnew-tab-${F.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":F.id,"aria-selected":c===F.id,"aria-controls":"whatsnew-tab-panel",tabIndex:c===F.id?0:-1,onClick:()=>d(F.id),children:F.label},F.id))}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,u.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${c}`,children:c==="overview"?u.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:kX(b).map(F=>u.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>H(F.id),children:[u.jsx("span",{className:"whatsnew-overview-label",children:F.label}),u.jsxs("span",{className:"whatsnew-overview-count",children:[F.count," ",F.count===1?"update":"updates"]}),u.jsx("span",{className:"whatsnew-overview-summary",children:F.summary})]},F.id))}):CX(b,c).map((F,ee)=>u.jsx(RX,{section:F,index:ee},F.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Fd,children:"Close"})})]})]})}function RX({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((r,o)=>u.jsx("li",{children:u.jsx(NX,{item:r})},`${r.text}:${o}`))})]})}function NX({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,n)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),u.jsx("span",{children:e.text})]})}function Rl(e,t){return`${e}:${t}`}function LX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(TX)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function MX(e,t,n){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const i=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!i||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(i);if(o<0||r.length===0)return!1;const c=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,d=r[c],p=d.dataset.tabId;return p?(n(p),d.focus(),!0):!1}function DL(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function OX(e,t=window){const n=i=>{if(!(W5()||DL(t.document))){if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),i.stopImmediatePropagation(),e.toggleOperationSearch();return}if((i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&i.altKey&&!i.shiftKey&&(i.metaKey||i.key.toLowerCase()==="b")){i.preventDefault(),i.stopImmediatePropagation(),e.toggleRailChrome();return}(i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&!i.altKey&&!i.shiftKey&&(i.preventDefault(),i.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)}function Qp(e=()=>{}){return{...e5(e),notifications:{emit:n=>ED(n),dismiss:n=>MD(n)},status:{set:(n,i)=>kD(n,i),clear:n=>D5(n)}}}async function DX(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await jX(t),IX(await t.json(),t.status).routes}async function jX(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new tn(e.status,t)}function IX(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new tn(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>BX(i,t))}}function BX(e,t){const n=e;if(!n||typeof n!="object"||typeof n.method!="string"||typeof n.path!="string"||typeof n.summary!="string"||typeof n.category!="string"||typeof n.gate!="string")throw new tn(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const Nb=new Set;let Lb={loading:!1,state:null,error:null};function PX(){return y.useSyncExternalStore($X,xE,xE)}function xE(){return Lb}function $X(e){return Nb.add(e),()=>{Nb.delete(e)}}async function zX(e){vv({loading:!0,error:null});try{const t=await DX(e);vv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;vv({loading:!1,error:HX(t)})}}function vv(e){Lb={...Lb,...e};for(const t of Nb)t()}function HX(e){return e instanceof Error?e.message:String(e)}function FX(){const e=PX(),[t,n]=y.useState(!0),i=y.useMemo(()=>qX(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return y.useEffect(()=>{const c=new AbortController;return zX(c.signal),()=>c.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[u.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"settings-disclosure-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children:r>0?`${r} loopback route${r===1?"":"s"} across ${o} categor${o===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),u.jsx("div",{className:"settings-disclosure-actions",children:u.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(c=>!c),children:t?"Hide":"Show"})})]})}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?u.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(c=>u.jsx(UX,{group:c},c.category)):null,e.state&&i.length===0?u.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,u.jsx("p",{className:"global-settings-foot",children:"Console backend routes are fetched from GET /api/v1/settings/api-catalog, so newly registered routes appear here automatically. The Codex/Fleet Wiki API surface is not included."})]})}function UX({group:e}){return u.jsxs("div",{className:"backend-api-group",children:[u.jsxs("div",{className:"backend-api-group-head",children:[u.jsx("span",{children:e.category}),u.jsx("span",{children:e.entries.length})]}),u.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>u.jsx(WX,{entry:t},`${t.method}:${t.path}`))})]})}function WX({entry:e}){return u.jsxs("div",{className:"backend-api-row",children:[u.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),u.jsx("code",{className:"backend-api-path",children:e.path}),u.jsx("span",{className:"backend-api-summary",children:e.summary}),u.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function qX(e){const t=new Map;for(const n of e){const i=n.category.trim()||"Uncategorized",r=t.get(i);r?r.push(n):t.set(i,[n])}return Array.from(t.entries()).map(([n,i])=>({category:n,entries:i}))}const GX=[{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)"]}],KX=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],VX=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],YX=1024,XX=65535,CE=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function ZX(){const e=l1(),t=e.state,n=e.savingField!==null,[i,r]=y.useState("general"),o=Ps(),c=oc(),d=hc(),p=eZ(d.plugins),f=tZ(p),g=_=>{r(_),c({pathname:"/settings",search:_==="general"?"":`?section=${encodeURIComponent(_)}`})};return y.useEffect(()=>{const _=new AbortController;return yX(_.signal),()=>_.abort()},[]),y.useEffect(()=>{const _=new URLSearchParams(o.search).get("section"),b=new Set([...CE.map(w=>w.id),...p.map(w=>w.id)]),S=_&&b.has(_)?_:"general";r(S),_&&_!==S&&c({pathname:"/settings",search:""},{replace:!0})},[o.search,c,p]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Console"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),CE.map(_=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${_.id===i?"is-active":""}`,"aria-pressed":_.id===i,onClick:()=>g(_.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:_.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:_.eyebrow})]},_.id)),p.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),f.map(_=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:_.pluginLabel}),_.sections.map(b=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>g(b.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},_.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:QX(i,t,n,p)},i)]})]})}function JX({render:e}){return u.jsx(u.Fragment,{children:e()})}function QX(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?u.jsx(Uf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:u.jsx(JX,{render:r.render})}):u.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(iZ,{state:t,saving:n}),u.jsx(sZ,{state:t,saving:n}),u.jsx(rZ,{state:t,saving:n})]});case"backend-api":return u.jsx(FX,{})}}function eZ(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:nZ(t.id),sectionTitle:n.title,render:n.render})))}function tZ(e){const t=[];for(const n of e){const i=t.at(-1);if(i?.pluginId===n.pluginId){t[t.length-1]={...i,sections:[...i.sections,n]};continue}t.push({pluginId:n.pluginId,pluginLabel:n.pluginLabel,sections:[n]})}return t}function nZ(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function iZ({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(Cp().savingField!==null)return;const o=n;Vf(r),ic("theme",r).then(c=>{c||Vf(o)})};return u.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),u.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),u.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:GX.map(r=>{const o=r.id===n;return u.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(c=>u.jsx("i",{style:{background:c}},c))}),u.jsx("span",{className:"theme-card-label",children:r.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?u.jsx(lZ,{}):null})]},r.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function sZ({state:e,saving:t}){const n=e?.uiFont??Wu,[i,r]=y.useState([]),[o,c]=y.useState(!0),[d,p]=y.useState(null);y.useEffect(()=>{const _=new AbortController;return cT({signal:_.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(b=>{_.signal.aborted||(r([]),p(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{_.signal.aborted||c(!1)}),()=>_.abort()},[]);const f=_=>{if(Cp().savingField!==null)return;const b=n;Uv(_),ic("uiFont",_).then(S=>{S||Uv(b)})},g=_=>{const b=_.source==="builtin"?{source:"builtin",id:_.id,size:n.size}:{source:"system",familyName:_.familyName,size:n.size};f(b)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),u.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),u.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===Ul.defaultValue,onClick:()=>f(Wu),children:"Reset to Fleet default"})]}),u.jsx(oT,{builtIns:Kf.map(({id:_,label:b,family:S,aliases:w,description:x})=>({id:_,label:b,family:S,aliases:w,description:x})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:A5(Wu),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:Ul,loading:o,error:d,disabled:!e||t,onSelectionChange:g,onSizeCommit:_=>f({...n,size:_})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function rZ({state:e,saving:t}){const n=Xs();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(oZ,{state:e,saving:t,consoleState:n}),u.jsx(aZ,{state:e,saving:t})]}):u.jsx("p",{className:"global-settings-help",children:"Loading settings."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function aZ({state:e,saving:t}){return u.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),u.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),u.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:VX.map(n=>{const i=e.language===n.id;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{ic("language",n.id)},children:n.label},n.id)})}),u.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function oZ({state:e,saving:t,consoleState:n}){const[i,r]=y.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,c=n.portMode==="static"&&!n.portHonored,d=n.requestedPort,p=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=i.trim(),g=Number(f),_=f.length>0,b=_&&kE(g),S=e.consolePortMode==="static"&&_&&!b;return y.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",children:"Dynamic lets the OS pick a free loopback port each time the console starts. Static pins a port you choose so the console URL stays the same across restarts."})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:KX.map(w=>{const x=e.consolePortMode===w.id;return u.jsx("button",{type:"button","aria-pressed":x,className:`segmented-option ${x?"is-active":""}`,disabled:t,onClick:()=>{ic("consolePortMode",w.id)},children:w.label},w.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const x=w.target.value;r(x);const C=Number(x.trim());kE(C)&&ic("consoleStaticPort",C)}}),u.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${S?"is-invalid":""}`,children:"1024–65535"})]})}),u.jsxs("div",{className:`console-port-effective ${c?"is-fallback":""}`,"aria-live":"polite",children:[u.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),u.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",u.jsx("span",{children:o||"..."}),c?" · Dynamic":""]})]})]}),c&&d?u.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",u.jsx("strong",{children:d})," was unavailable — the console fell back to a ",u.jsx("strong",{children:"Dynamic"})," port and is running on ",u.jsxs("strong",{children:["127.0.0.1:",o||"..."]}),"."," ",p?u.jsxs(u.Fragment,{children:["Next restart will try ",u.jsx("strong",{children:e.consoleStaticPort}),"."]}):u.jsx(u.Fragment,{children:"Next restart will use a dynamic port."})]}):null,u.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function kE(e){return Number.isInteger(e)&&e>=YX&&e<=XX}function lZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function cZ(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function _h(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function uZ(e,t){return{...cZ(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const EE=256,TE=176,yv=12,pf=220,jL="fleet-console.map.radarCollapsed";function hZ({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:r,onJump:o}){const c=y.useRef(null),d=y.useRef(!1),p=y.useRef(null),[f,g]=y.useState(dZ),_=Vp();if(y.useEffect(()=>{if(_){p.current===null&&(p.current=f,g(!0));return}p.current!==null&&(g(p.current),p.current=null)},[f,_]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([E,L])=>({id:E,x:L.x,y:L.y,width:L.width,height:L.height})),...Object.entries(t).map(([E,L])=>({id:E,x:L.geometry.x,y:L.geometry.y,width:L.geometry.width,height:L.geometry.height}))];if(b.length===0)return null;const S=()=>{g(E=>{const L=!E;return _||fZ(L),L})};if(f)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:u.jsx(mZ,{})});const w=EE-yv*2,x=TE-yv*2,C={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let O=Math.min(C.x,...b.map(E=>E.x)),P=Math.min(C.y,...b.map(E=>E.y)),z=Math.max(C.x+C.width,...b.map(E=>E.x+E.width)),T=Math.max(C.y+C.height,...b.map(E=>E.y+E.height));O-=pf,P-=pf,z+=pf,T+=pf;const j=z-O,M=T-P,H=Math.min(w/j,x/M),F=(w-j*H)/2,ee=(x-M*H)/2,ae=E=>F+(E-O)*H,K=E=>ee+(E-P)*H,B=E=>{const L=c.current?.getBoundingClientRect();if(!L)return;const $=E.clientX-L.left,q=E.clientY-L.top;o({x:O+($-F)/H,y:P+(q-ee)/H})},N=E=>{E.stopPropagation(),d.current=!0,E.currentTarget.setPointerCapture(E.pointerId),B(E)},R=E=>{d.current&&(E.stopPropagation(),B(E))},A=E=>{d.current=!1;try{E.currentTarget.releasePointerCapture(E.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:EE,height:TE},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:u.jsx(pZ,{})}),u.jsxs("div",{ref:c,className:"canvas-minimap-inner",style:{inset:yv},onPointerDown:N,onPointerMove:R,onPointerUp:A,onPointerCancel:A,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(E=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:ae(E.x),top:K(E.y),width:Math.max(2,E.width*H),height:Math.max(2,E.height*H),...n?.[E.id]?{"--user-accent":n[E.id]}:{}}},E.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:ae(C.x),top:K(C.y),width:C.width*H,height:C.height*H}})]})]})}function dZ(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(jL)==="true"}catch{return!1}}function fZ(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jL,String(e))}catch{}}function pZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function mZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),u.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function gZ({viewport:e}){return u.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[u.jsx("div",{className:"operations-canvas-sea"}),u.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const _Z=["n","ne","e","se","s","sw","w","nw"],bv=320,Sv=200,vZ=1500;function yZ({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:c=!1,renderHidden:d=!1,focusLayerTarget:p=!1,topEdge:f=!1,interactionDisabled:g=!1,accentKey:_=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:C,onRename:O,onSetAccent:P,onGeometryChange:z,onGeometryCommit:T,onRenderHiddenFocus:j}){const M=y.useRef(null),H=y.useRef(null),F=y.useRef(null),ee=y.useRef(null),ae=y.useRef(null),K=y.useRef(!1),[B,N]=y.useState(null),[R,A]=y.useState(!1),E=e.title,L=r1({currentTitle:e.title,onBegin:()=>{D()},onCommit:we=>{O(we),K.current=!0}}),$=_?qa(_):null,q=["canvas-operation",t?"is-active":"",o?"is-minimized":"",c?"is-maximized":"",f?"is-top-edge":"",SZ(r)].filter(Boolean).join(" ");y.useEffect(()=>()=>{ae.current!==null&&window.clearTimeout(ae.current)},[]),y.useEffect(()=>{if(L.renaming||!K.current)return;K.current=!1;const we=window.requestAnimationFrame(()=>H.current?.focus());return()=>window.cancelAnimationFrame(we)},[L.renaming]),y.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const we=B!==null;we&&N(null),(we||M.current?.contains(document.activeElement))&&j?.()},[B,d,j]);const X=()=>{ae.current!==null&&(window.clearTimeout(ae.current),ae.current=null)},D=()=>{X(),A(!1)},V=()=>{X(),A(!0),ae.current=window.setTimeout(()=>{ae.current=null,A(!1)},vZ)},J=we=>{D(),!(c||g)&&we.button===0&&(we.preventDefault(),we.stopPropagation(),S(),F.current={pointerId:we.pointerId,startX:we.clientX,startY:we.clientY,geometry:n,latest:n},we.currentTarget.setPointerCapture(we.pointerId))},ce=we=>{if(c||g)return;const $e=F.current;if(!$e||$e.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const ft={...$e.geometry,x:$e.geometry.x+(we.clientX-$e.startX)/i,y:$e.geometry.y+(we.clientY-$e.startY)/i};$e.latest=ft,z(ft)},ie=we=>{if(c||g){F.current=null;return}const $e=F.current;!$e||$e.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),F.current=null,we.currentTarget.releasePointerCapture(we.pointerId),T($e.latest))},ve=(we,$e)=>{c||g||($e.preventDefault(),$e.stopPropagation(),S(),ee.current={direction:we,pointerId:$e.pointerId,startX:$e.clientX,startY:$e.clientY,geometry:n,latest:n},$e.currentTarget.setPointerCapture($e.pointerId))},Se=we=>{if(c||g)return;const $e=ee.current;if(!$e||$e.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const ft=bZ($e.geometry,$e.direction,(we.clientX-$e.startX)/i,(we.clientY-$e.startY)/i);$e.latest=ft,z(ft)},Oe=we=>{if(c||g){ee.current=null;return}const $e=ee.current;!$e||$e.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),ee.current=null,we.currentTarget.releasePointerCapture(we.pointerId),T($e.latest))},Ne=we=>{we.stopPropagation()},ct=we=>{we.stopPropagation(),D()},Ze=we=>{we.stopPropagation(),S()},Re=we=>{we.stopPropagation()},xe=()=>{D();const we=typeof document<"u"?document.activeElement:null;we instanceof HTMLElement&&M.current?.contains(we)&&we.blur(),x()},ze=()=>{D(),C?.()},le=we=>{D(),S(),N(we)},We=we=>{we.stopPropagation(),D(),S()},Le=()=>{if(!R){V();return}D(),w()},it=we=>{we.stopPropagation(),L.begin()},bt=we=>{we.key!=="Enter"&&we.key!=="F2"||(we.preventDefault(),we.stopPropagation(),L.begin())},je=we=>{we.key==="Escape"&&(K.current=!0),L.handleKeyDown(we)},dt={left:Math.round(n.x),top:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height),zIndex:n.zIndex,...d?{visibility:"hidden",pointerEvents:"none"}:{},...$?{"--user-accent":$}:{}};return u.jsxs("article",{ref:M,className:q,style:dt,onPointerDown:S,"data-canvas-operation":!0,"data-focus-layer-target":p?"true":void 0,"aria-label":`Operation ${E}`,"aria-hidden":d||void 0,tabIndex:p?-1:void 0,inert:o||d?!0:void 0,children:[$?u.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!c&&!g?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:J,onPointerMove:ce,onPointerUp:ie,onPointerCancel:ie,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:J,onPointerMove:ce,onPointerUp:ie,onPointerCancel:ie,"data-canvas-blocker":!0,children:[$?u.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,L.renaming?u.jsx("input",{ref:L.inputRef,className:"canvas-operation-identity-input",value:L.draftTitle,"aria-label":`Rename operation ${E}`,onChange:we=>L.setDraftTitle(we.target.value),onKeyDown:je,onBlur:L.handleBlur,onPointerDown:ct}):u.jsx("button",{ref:H,type:"button",className:"canvas-operation-identity-name",onPointerDown:ct,onDoubleClick:it,onKeyDown:bt,"aria-label":`Rename operation ${E}`,title:`${E} — Double-click, Enter, or F2 to rename`,children:E}),P?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:Ne,onClick:we=>le(we.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${E}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:AE(r),"aria-hidden":"true"})}):u.jsx("span",{className:AE(r),onPointerDown:We,"aria-hidden":"true"}),u.jsxs("div",{className:"canvas-operation-window-controls",children:[u.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:Ne,onClick:xe,"aria-label":`Minimize operation ${E}`,title:"Minimize operation",children:u.jsx(wZ,{})}),C?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:Ne,onClick:ze,"aria-label":c?`Restore operation ${E}`:`Maximize operation ${E}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(CZ,{}):u.jsx(xZ,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${R?"is-armed-close":""}`,onPointerDown:Ne,onClick:Le,"aria-label":R?`Confirm close operation ${E}`:`Close operation ${E}`,title:R?"Confirm close":"Close operation",children:R?"Close?":u.jsx(kZ,{})})]})]}),u.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:E}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:Ze,onWheel:Re,"data-canvas-blocker":!0,children:b}),!c&&!g&&_Z.map(we=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${we}`,onPointerDown:$e=>ve(we,$e),onPointerMove:Se,onPointerUp:Oe,onPointerCancel:Oe,"data-canvas-blocker":!0,"aria-hidden":"true"},we)),B&&P?u.jsx(gV,{anchor:B,accentKey:_,onSelect:P,onClose:()=>N(null)}):null]})}function bZ(e,t,n,i){let{x:r,y:o,width:c,height:d}=e;return t.includes("e")&&(c+=n),t.includes("s")&&(d+=i),t.includes("w")&&(r+=n,c-=n),t.includes("n")&&(o+=i,d-=i),c<bv&&(t.includes("w")&&(r-=bv-c),c=bv),d<Sv&&(t.includes("n")&&(o-=Sv-d),d=Sv),{...e,x:r,y:o,width:c,height:d}}function SZ(e){const t=Zp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function AE(e){const t=Zp(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 wZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function xZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function CZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function kZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function EZ({rect:e,viewport:t}){const n=uZ(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const TZ=.25,AZ=2,RZ=200,NZ=150,RE=5,LZ=.0018;function MZ({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:c,onClick:d}){const p=y.useRef(null),f=y.useRef(e),[g,_]=y.useState(null),[b,S]=y.useState(!1),[w,x]=y.useState(!1);y.useEffect(()=>{f.current=e},[e]),y.useEffect(()=>{const M=F=>{F.key==="Shift"&&x(!0),!OZ(F.target)&&F.code==="Space"&&(F.preventDefault(),S(!0))},H=F=>{F.key==="Shift"&&x(!1),F.code==="Space"&&S(!1)};return window.addEventListener("keydown",M),window.addEventListener("keyup",H),()=>{window.removeEventListener("keydown",M),window.removeEventListener("keyup",H)}},[]);const C=M=>{if(t||NE(M.target)||M.button!==0&&M.button!==1)return;if(M.preventDefault(),n){c?.();return}const H=xv(M),F=M.shiftKey&&M.button===0&&!b?"create":"pan";p.current={pointerId:M.pointerId,mode:F,startScreen:H,currentScreen:H,startViewport:f.current},M.currentTarget.setPointerCapture(M.pointerId),F==="create"&&_(wv(H,H,f.current))},O=M=>{const H=p.current;if(!H||H.pointerId!==M.pointerId)return;M.preventDefault();const F=xv(M);if(p.current={...H,currentScreen:F},H.mode==="pan"){i({...H.startViewport,x:H.startViewport.x+F.x-H.startScreen.x,y:H.startViewport.y+F.y-H.startScreen.y});return}_(wv(H.startScreen,F,f.current))},P=M=>{j(M,!0)},z=M=>{j(M,!1)},T=M=>{if(t||NE(M.target))return;M.preventDefault();const H=xv(M),F=f.current,ee=DZ(F.zoom*Math.exp(-M.deltaY*LZ),TZ,AZ),ae=_h(H,F);r({x:H.x-ae.x*ee,y:H.y-ae.y*ee,zoom:ee})},j=(M,H)=>{const F=p.current;if(!F||F.pointerId!==M.pointerId||(p.current=null,M.currentTarget.releasePointerCapture(M.pointerId),_(null),!H))return;const ee=Math.abs(F.currentScreen.x-F.startScreen.x),ae=Math.abs(F.currentScreen.y-F.startScreen.y);if(ee<RE&&ae<RE){d?.();return}if(F.mode!=="create")return;const K=wv(F.startScreen,F.currentScreen,f.current),B={x:K.x,y:K.y,width:Math.max(K.width,RZ),height:Math.max(K.height,NZ)};o(B,F.currentScreen)};return{rubberBand:g,spaceActive:b,shiftActive:w,onPointerDown:C,onPointerMove:O,onPointerUp:P,onPointerCancel:z,onWheel:T}}function wv(e,t,n){const i=_h(e,n),r=_h(t,n),o=Math.min(i.x,r.x),c=Math.min(i.y,r.y);return{x:o,y:c,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function xv(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function NE(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function OZ(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function DZ(e,t,n){return Math.min(n,Math.max(t,e))}const jZ="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",IZ=560,BZ=360,PZ=12;function $Z({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:c,onFocus:d,onRename:p,onSetAccent:f}){const g=y.useRef(null),_=KN(),b=YN(),S=Vp(),w=VN(),x=MV(),C=y.useRef(null),O=XN(),P=e.activeOperationId,[z,T]=y.useState(null),j=hc(),[M,H]=y.useState({width:0,height:0}),F=qZ(),ee=!e.activeTheaterId||e.addingTheater;y.useEffect(()=>{const le=g.current;if(!le||typeof ResizeObserver>"u")return;const We=()=>H({width:le.clientWidth,height:le.clientHeight});We();const Le=new ResizeObserver(We);return Le.observe(le),()=>Le.disconnect()},[]);const ae=MZ({viewport:_.viewport,disabled:ee||S||x!==null,onViewportChange:wb,onZoom:JN,onCreate:le=>{if(T(null),e.activeTheaterId&&n){const We=GZ(t);if(!We)return;const Le={...FZ(le),zIndex:zo()};o(We.pluginId,We.kind,Le)}},consumePointerDown:z!==null,onConsumePointerDown:()=>{T(null)},onClick:HZ}),K=(le,We)=>{const Le=z?.canvasPoint;T(null),Le&&r(le,We,Le)},B=le=>{if(le.target instanceof Element&&le.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;le.preventDefault();const We=g.current?.getBoundingClientRect();if(!We)return;const Le={x:le.clientX-We.left,y:le.clientY-We.top};T({anchor:Le,canvasPoint:_h(Le,_.viewport)})},N=new Set(O);y.useEffect(()=>{e.activeOperationId&&N.has(e.activeOperationId)&&Mi(null)},[O,e.activeOperationId]);const R=Object.fromEntries(Object.entries(_.operations).filter(([le])=>!N.has(le))),A=(e.operations??[]).filter(le=>le.theaterId===e.activeTheaterId),E=j.operationKinds,$=w!==null&&A.some(le=>le.id===w&&!N.has(le.id))?w:null,q=x===null?void 0:A.find(le=>le.id===x&&!N.has(le.id)),X=q?E.find(le=>le.pluginId===q.pluginId&&le.type===q.type):void 0;x===null&&(C.current=null),q&&X?.companions?.length&&(C.current={operation:q,descriptor:X});const D=!q&&C.current?.operation.id===x?C.current:null,V=q??D?.operation,ce=(X??D?.descriptor)?.companions??[],ie=V&&ce.length>0?V.id:null,ve=q&&X?.companions?.length?q.id:null,Se=V&&!A.some(le=>le.id===V.id)?[...A,V]:A,Oe=Se.length>0;y.useEffect(()=>{if(x===null||ve!==null)return;const le=setTimeout(()=>{C.current=null,Ka()},1500);return()=>clearTimeout(le)},[x,ve]);const Ne=B5(A,e.groups.filter(le=>le.theaterId===e.activeTheaterId),_.operationOrder,[]).filter(le=>!N.has(le.id)).map(le=>le.id),ct=S?jV({x:0,y:0,width:M.width,height:M.height},Ne.length,void 0,void 0,void 0,void 0,b):[],Ze=new Map(Ne.map((le,We)=>[le,ct[We]])),Re=$||ie||S?1:_.viewport.zoom,xe=WZ(_.operations)+1,ze=ce.length+1;return u.jsxs("main",{className:`operations-canvas ${ae.spaceActive?"is-panning":""} ${ae.shiftActive?"is-creating":""} ${F?"is-glance":""} ${$?"is-panel-maximized":""} ${ie?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:ae.onPointerDown,onPointerMove:ae.onPointerMove,onPointerUp:ae.onPointerUp,onPointerCancel:ae.onPointerCancel,onWheel:ae.onWheel,onContextMenu:B,ref:g,tabIndex:-1,children:[u.jsx(gZ,{viewport:_.viewport}),u.jsx("div",{style:{transform:$||ie||S?"none":`translate(${Math.round(_.viewport.x)}px, ${Math.round(_.viewport.y)}px) scale(${_.viewport.zoom})`},className:"operations-canvas-world",children:Se.map(le=>{const We=_.operations[le.id]??le.geometry??Cv(le),Le=$===le.id,it=ie===le.id,bt=($!==null||ie!==null)&&!Le&&!it,je=Ze.get(le.id),dt=Le?UZ(M,xe):it?LE(M,0,ze,xe):je?{...We,...je}:We,we=!Le&&!it&&!je&&_.viewport.y+dt.y*Re<PZ*Re;return KZ(le,{active:P===le.id,geometry:dt,topEdge:we,operationKindRegistry:E,status:e.operationStatus[le.id],theme:e.activeTheme,viewportZoom:Re,minimized:N.has(le.id),maximized:Le,companion:it,companions:it?ce:[],companionGeometries:it?ce.map(($e,ft)=>LE(M,ft+1,ze,xe)):[],formation:S,focusLayerHidden:bt,onRenderHiddenFocus:()=>{const $e=g.current?.querySelector("[data-focus-layer-target='true']");if($e){$e.focus();return}g.current?.focus()},accentKey:_.operationAccent[le.id]??OE(le),onActivate:()=>{Mi(le.id),!Le&&!it&&!S&&xb(le.id,_.operations[le.id]??le.geometry??Cv(le))},onClose:()=>{e.activeOperationId===le.id&&Mi(null),$===le.id&&Xr(),ie===le.id&&Ka(),c(le.id)},onMinimize:()=>{e.activeOperationId===le.id&&Mi(null),QN(le.id)},onMaximize:()=>{Le?Xr():(Mi(le.id),Zu(le.id))},onRename:$e=>{p(le.id,$e)},onSetAccent:$e=>{f(le.id,$e)},onGeometryChange:$e=>{!Le&&!it&&!S&&xb(le.id,$e)},onGeometryCommit:$e=>{!Le&&!it&&!S&&YZ(le.id,tc().operations[le.id]??$e)}})})}),Oe?null:u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[u.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),u.jsx("p",{children:e.activeTheaterId?jZ:"Add a Theater from the top bar to start operations."})]}),ae.rubberBand?u.jsx(EZ,{rect:ae.rubberBand,viewport:_.viewport}):null,z?u.jsx(FN,{anchor:z.anchor,viewportBounds:zZ(g.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:K,onClose:()=>T(null)},`${z.anchor.x}:${z.anchor.y}`):null,u.jsx(hZ,{operations:R,pluginOperations:Object.fromEntries(A.filter(le=>!N.has(le.id)).map(le=>[le.id,{theaterId:le.theaterId,geometry:_.operations[le.id]??le.geometry??Cv(le)}])),accents:Object.fromEntries(A.flatMap(le=>{const We=_.operationAccent[le.id]??OE(le),Le=We?qa(We):null;return Le?[[le.id,Le]]:[]})),viewport:_.viewport,canvasSize:M,onJump:le=>wb({x:M.width/2-le.x*_.viewport.zoom,y:M.height/2-le.y*_.viewport.zoom,zoom:_.viewport.zoom})})]})}function zZ(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function HZ(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Mi(null)}function FZ(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Cv(e){return e.geometry??{x:0,y:0,width:IZ,height:BZ,zIndex:0}}function UZ(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function LE(e,t,n,i){const r=Math.max(1,n),o=8,c=Math.max(0,(e.width-o*(r-1))/r);return{x:t*(c+o),y:0,width:c,height:Math.max(0,e.height),zIndex:i}}function WZ(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function qZ(){const[e,t]=y.useState(!1),n=y.useRef(new Set);return y.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=d=>{!ME(d)||d.repeat||d.ctrlKey||d.metaKey||DL()||(n.current.add(d.code),t(!0))},o=d=>{ME(d)&&(n.current.delete(d.code),t(n.current.size>0))},c=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",c)}},[]),e}function ME(e){return e.code==="AltLeft"||e.code==="AltRight"}function GZ(e){const t=e.flatMap(n=>n.kinds.filter(i=>i.disabled!==!0).map(i=>({pluginId:n.id,kind:i})));return t.find(({kind:n})=>n.type==="shell")??t[0]??null}function OE(e){return typeof e.accent=="string"?e.accent:null}function KZ(e,t){const n=t.operationKindRegistry.find(c=>c.pluginId===e.pluginId&&c.type===e.type),i=t.geometry;if(!n?.render)return null;const r=Qp(()=>{Xi(null).then(fs).catch(()=>{})}),o=c=>{c?(Mi(e.id),zV(e.id)):Ka()};return u.jsxs(y.Fragment,{children:[u.jsx(yZ,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:u.jsx(Uf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(DE,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,render:n.render})})}),t.companions.map((c,d)=>u.jsx(VZ,{descriptor:c,geometry:t.companionGeometries[d],children:u.jsx(Uf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:u.jsx(DE,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,render:c.render})})},c.id))]},e.id)}function DE({active:e,capabilities:t,geometry:n,operation:i,theme:r,viewportZoom:o,onActivate:c,onClose:d,onGeometryChange:p,onRequestCompanions:f,companionsOpen:g,render:_}){return _({operationId:i.id,theaterId:i.theaterId,pluginId:i.pluginId,type:i.type,operation:i,geometry:n,active:e,zoom:o,theme:r,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:d,onGeometryChange:p,onRequestCompanions:f,companionsOpen:g})}function VZ({descriptor:e,geometry:t,children:n}){const i={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return u.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:i,"data-canvas-operation":!0,"aria-label":`Companion ${e.title}`,children:[e.hideCaption?null:u.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[u.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),u.jsx("span",{className:"canvas-companion-caption-title",children:e.title})]}),u.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:r=>r.stopPropagation(),onWheel:r=>r.stopPropagation(),"data-canvas-blocker":!0,children:n})]})}async function YZ(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function IL(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(n=>n.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function BL(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function PL(e,t){const n=[],i=[];for(const r of e)t.has(r.operationId)?i.push(r):n.push(r);return{hidden:n,visible:i}}function Mb(e){const t=new Map;for(const n of[...e].sort((i,r)=>r.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",r=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};r.notifications.push(n),t.set(i,r)}return[...t.values()].sort((n,i)=>{const r=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-r})}function $L(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const XZ={ended:"Ended","input-waiting":"Waiting for input"},ZZ={id:"alerts",title:"Alerts",icon:()=>u.jsx(QZ,{}),render:()=>u.jsx(JZ,{})};function JZ(){const e=Xs(),t=oc(),[n,i]=y.useState(!1),r=y.useMemo(()=>BL(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=IL(e),c=PL(r,o).hidden,d=$L(c,e.notificationPreferences),p=Mb(d),f=Mb(c),g=Ob(p,"input-waiting"),_=Ob(p,"ended"),b=p.length===0,S=y.useCallback(w=>{ih(w.operationId),t("/operations")},[t]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[g>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:g}):null,_>0?u.jsx("span",{className:"notification-tally is-ended",children:_}):null,b?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${n?" is-active":""}`,onClick:()=>i(w=>!w),"aria-expanded":n,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(iJ,{})})]}),n?u.jsx(eJ,{groups:f}):null,b?u.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):u.jsx("div",{className:"notification-dock-deck",children:p.map(w=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(x=>u.jsxs("li",{className:`notification-row is-${x.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:x.operationLabel}),u.jsx("span",{className:"notification-row-state",children:XZ[x.kind]})]}),u.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>S(x),"aria-label":`Open ${w.theaterLabel} ${x.operationLabel}`,children:"Open"})]},x.operationId))})]},w.theaterId??"__unknown__"))})]})}function QZ(){const e=Xs();nT();const t=y.useMemo(()=>BL(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=IL(e),i=PL(t,n).hidden,r=$L(i,e.notificationPreferences),o=Mb(r),c=o.reduce((f,g)=>f+g.notifications.length,0),d=Ob(o,"input-waiting"),p=c===0?"muted":d>0?"awaiting":"ended";return u.jsxs("span",{className:`alerts-icon is-${p}`,"aria-hidden":"true",children:[u.jsx(nJ,{}),c>0?u.jsx("span",{className:"alerts-icon-badge",children:c}):null]})}function eJ({groups:e}){const t=Xs(),n=tJ(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>OD(i.currentTarget.checked)}),u.jsx("span",{children:"Mute all"})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>DD(i.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),n.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&jD(i.theaterId)}}),u.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function tJ(e,t,n){const i=new Map;for(const r of e)r.theaterId&&i.set(r.theaterId,r);for(const r of Object.keys(t))i.has(r)||i.set(r,{theaterId:r,theaterLabel:n.find(o=>o.id===r)?.label??r,notifications:[]});return[...i.values()]}function Ob(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function nJ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[u.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function iJ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class c1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function sJ(e,t){const i=new URLSearchParams().toString();return Xa(Un(e,`/search${i?`?${i}`:""}`))}async function rJ(e,t,n){return Xa(Un(e,`/entry/${encodeURIComponent(t)}`))}async function zL(e,t="pending"){return Xa(Un(e,`/drydock?status=${encodeURIComponent(t)}`))}async function aJ(e,t){return Xa(Un(e,`/drydock/${encodeURIComponent(t)}`))}async function oJ(e){return Xa(Un(e,"/schema"))}async function lJ(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Xa(Un(e,n))}async function cJ(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),bJ(Un(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function uJ(e){return Xa(Un(e,"/conflicts"))}async function hJ(e,t){return Xa(Un(e,`/conflicts/${encodeURIComponent(t)}`))}async function dJ(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),HL(Un(e,`/cowork/options?${i}`))}async function jE(e,t,n){return Za(Un(e,"/cowork/sessions"),{entryId:t,...n})}async function fJ(e,t){try{return await HL(Un(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof c1&&n.status===404)return null;throw n}}async function kv(e,t,n){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function pJ(e,t,n){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function IE(e,t,n){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function mJ(e,t,n){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function gJ(e,t){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function _J(e,t,n){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function vJ(e,t){return Za(Un(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function yJ(e,t,n,i){const r=new EventSource(`${Un(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=c=>{try{const d=JSON.parse(c.data);if(!SJ(d))return;i(d,Number(c.lastEventId)||0)}catch{}};for(const c of["session","transcript","tool","done","error"])r.addEventListener(c,o);return()=>r.close()}function Un(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function Xa(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await UL(e,t));return t.json()}async function bJ(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await UL(e,n));return n.json()}async function HL(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await FL(t);return t.json()}async function Za(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await FL(n);return n.json()}async function FL(e){const t=await e.json().catch(()=>null);return new c1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function SJ(e){if(!e||typeof e!="object")return!1;const t=e;return["session","transcript","tool","done","error"].includes(t.type??"")&&(t.session===void 0||t.session!==null&&typeof t.session=="object")}async function UL(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Db=new Set;let Bf=0;const Zl={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function jl(){return Zl}function WL(e){return Db.add(e),()=>Db.delete(e)}function BE(e){Bf+=1,Pf({currentWorkspaceId:e,schemaCatalog:null})}async function kp(){const e=Zl.currentWorkspaceId,t=Bf;Pf({loading:!0,error:null});try{const[n,i,r]=await Promise.all([sJ(e),zL(e,"pending").catch(()=>null),oJ(e).catch(()=>null)]);if(Zl.currentWorkspaceId!==e||Bf!==t)return;Pf({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(Zl.currentWorkspaceId!==e||Bf!==t)return;Pf({loading:!1,error:wJ(n)})}}function Pf(e){Object.assign(Zl,e);for(const t of Db)t(Zl)}function wJ(e){return e instanceof Error?e.message:String(e)}const xJ=120;function Di(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function CJ(e,t){if(!t)return Di(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?Di(e):Di(e.slice(0,n))+`<mark>${Di(e.slice(n,n+t.length))}</mark>`+Di(e.slice(n+t.length))}function kJ(e){return`<span class="codex-nav-tag">${Di(e)}</span>`}function EJ(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(kJ).join(""),o=Di(e.status??"current"),c=Di(e.updated??"");return`<button
|
|
230
|
-
class="codex-nav-entry${n?" is-current":""}"
|
|
231
|
-
data-entry-id="${Di(e.id)}"
|
|
232
|
-
type="button"
|
|
233
|
-
${n?'aria-current="page"':""}
|
|
234
|
-
title="${Di(e.title)}"
|
|
235
|
-
>
|
|
236
|
-
<span class="t">${CJ(e.title,i?"":t)}</span>
|
|
237
|
-
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
-
<span class="meta">${o} · ${c}</span>
|
|
239
|
-
</button>`}function TJ(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(r=>r.toLowerCase().includes(n)))}function AJ(e,t){let n="",i=null,r="entries",o=null;e.innerHTML=`
|
|
240
|
-
<div class="codex-navigator">
|
|
241
|
-
<div class="codex-nav-modes" role="tablist" aria-label="Codex catalog">
|
|
242
|
-
<button type="button" role="tab" data-mode="entries" aria-selected="true">Entries</button>
|
|
243
|
-
<button type="button" role="tab" data-mode="schema" aria-selected="false">Schema</button>
|
|
244
|
-
</div>
|
|
245
|
-
<div class="codex-nav-search">
|
|
246
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
|
|
247
|
-
<input
|
|
248
|
-
class="codex-nav-search-input"
|
|
249
|
-
type="search"
|
|
250
|
-
placeholder="Search entries"
|
|
251
|
-
autocomplete="off"
|
|
252
|
-
spellcheck="false"
|
|
253
|
-
aria-label="Search Codex entries"
|
|
254
|
-
/>
|
|
255
|
-
</div>
|
|
256
|
-
<div class="codex-nav-quick-row">
|
|
257
|
-
<button class="codex-nav-quick" data-action="drydock" type="button">
|
|
258
|
-
Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
|
|
259
|
-
</button>
|
|
260
|
-
<button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
|
|
263
|
-
<div class="codex-navigator-scroll">
|
|
264
|
-
<div class="codex-nav-list" id="codex-nav-list"></div>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
`;const c=e.querySelector(".codex-nav-search-input"),d=e.querySelector("#codex-nav-list"),p=e.querySelector("#codex-nav-eyebrow"),f=e.querySelector("#codex-nav-drydock-badge");function g(w){if(e.querySelectorAll("[data-mode]").forEach(C=>C.setAttribute("aria-selected",String(C.dataset.mode===r))),c.hidden=r==="schema",r==="schema"){const C=w.schemaCatalog;p.textContent=`Schema · ${C?.templates.length??0} templates`,d.innerHTML=C?`
|
|
268
|
-
<button class="codex-nav-entry" type="button" ${C.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${C.schema.exists?Di(C.schema.ref):"Unavailable"}</span></button>
|
|
269
|
-
${C.templates.map(O=>`<button class="codex-nav-entry" type="button" data-template-id="${Di(O.id)}"><span class="t">${Di(O.id)}</span><span class="meta">${Di(O.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',f.textContent=String(w.pendingPatchCount);return}const x=TJ(w.index,n);if(p.textContent=`Entries · ${x.length}`,f.textContent=String(w.pendingPatchCount),f.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){d.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){d.innerHTML=`<div class="codex-nav-error" role="alert">${Di(w.error)}</div>`;return}if(x.length===0){d.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}d.innerHTML=x.map(C=>EJ(C,n,C.id===i)).join("")}function _(w){const x=w.target;if(!(x instanceof Element))return;const C=x.closest("[data-mode]");if(C?.dataset.mode==="entries"||C?.dataset.mode==="schema"){r=C.dataset.mode,g(jl());return}if(x.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const P=x.closest("[data-template-id]");if(P?.dataset.templateId){t.onRequest({kind:"schema",templateId:P.dataset.templateId});return}const z=x.closest("[data-entry-id]");if(z?.dataset.entryId){i=z.dataset.entryId,g(jl()),t.onRequest({kind:"entry",id:i});return}const T=x.closest("[data-action]");if(T?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(T?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=c.value,g(jl())},xJ)}e.addEventListener("click",_),c.addEventListener("input",b);const S=WL(w=>g(w));return g(jl()),{destroy(){S(),e.removeEventListener("click",_),c.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,c&&(c.value=""),g(jl())}}}function RJ(e,t){t.initialTheaterId&&BE(t.initialTheaterId);const n=AJ(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=WL(()=>{});kp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){BE(o),kp(),n.setTheater(o)}}}function gt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function dr(e){return gt(e).replace(/"/g,""")}function NJ(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${gt(i)}</span>`).join(""),n=MJ(e);return`
|
|
270
|
-
<div class="meta-chips">
|
|
271
|
-
${t}
|
|
272
|
-
${n}
|
|
273
|
-
<span class="chip">Updated ${gt(LJ(e.updated))}</span>
|
|
274
|
-
</div>
|
|
275
|
-
`}function qL(e){return e.map(t=>`<span class="chip chip-muted">${gt(t)}</span>`).join("")}function LJ(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function MJ(e){const t=OJ(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${dr(t.title)}">${gt(t.label)}</span>`:""}function OJ(e,t=new Date){const n=e.status,i=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return n==="deprecated"||n==="superseded"?{label:n,tone:"deprecated",title:i?`${n} · stale`:n}:i?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:n==="current"||n==="draft"?{label:n,tone:"neutral",title:n}:null}const DJ="active";function Ev(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${dr(t.id)}" data-toc-id="${dr(t.id)}">${gt(t.text)}</a>`).join("")}function PE(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(f=>f.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>r.has(f.id));if(i.length===0||o.length===0)return()=>{};const c=e.closest(".codex-reading-sheet-read"),d=new Set,p=new IntersectionObserver(f=>{for(const _ of f){const b=_.target instanceof HTMLElement?_.target.id:"";b&&(_.isIntersecting?d.add(b):d.delete(b))}const g=jJ(o,d)??IJ(o,c)??o[0]?.id??null;$E(i,g)},{root:c,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return $E(i,o[0]?.id??null),()=>p.disconnect()}function jJ(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function IJ(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const r of e)if(r.getBoundingClientRect().top-n<=80)i=r.id;else break;return i}function $E(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(DJ,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function Ep(e){return`/entry/${encodeURIComponent(e)}`}const GL=1<<20;function BJ(e,t){const n=e.replace(/\r\n/g,`
|
|
276
|
-
`).split(`
|
|
277
|
-
`),i=t.replace(/\r\n/g,`
|
|
278
|
-
`).split(`
|
|
279
|
-
`),r=n.length+1,o=i.length+1;if(r*o>GL)return i.map((g,_)=>({text:g,changed:n[_]!==g}));const c=Array.from({length:r},()=>new Uint16Array(o));for(let g=n.length-1;g>=0;g-=1)for(let _=i.length-1;_>=0;_-=1)c[g][_]=n[g]===i[_]?c[g+1][_+1]+1:Math.max(c[g+1][_],c[g][_+1]);const d=[];let p=0,f=0;for(;f<i.length;)p<n.length&&n[p]===i[f]?(d.push({text:i[f],changed:!1}),p+=1,f+=1):p<n.length&&c[p+1][f]>=c[p][f+1]?p+=1:(d.push({text:i[f],changed:!0}),f+=1);return d}function PJ(e,t){const n=zE(e),i=zE(t),r=n.length+1,o=i.length+1,c=[];if(r*o>GL){const g=Math.max(n.length,i.length);for(let _=0;_<g;_+=1){const b=n[_],S=i[_];S!==void 0&&S===b?c.push({markdown:S,kind:"same"}):(b!==void 0&&c.push({markdown:b,kind:"removed"}),S!==void 0&&c.push({markdown:S,kind:"added"}))}return HE(c)}const d=Array.from({length:r},()=>new Uint16Array(o));for(let g=n.length-1;g>=0;g-=1)for(let _=i.length-1;_>=0;_-=1)d[g][_]=n[g]===i[_]?d[g+1][_+1]+1:Math.max(d[g+1][_],d[g][_+1]);let p=0,f=0;for(;p<n.length||f<i.length;)p<n.length&&f<i.length&&n[p]===i[f]?(c.push({markdown:i[f],kind:"same"}),p+=1,f+=1):p<n.length&&(f>=i.length||d[p+1][f]>=d[p][f+1])?(c.push({markdown:n[p],kind:"removed"}),p+=1):(c.push({markdown:i[f],kind:"added"}),f+=1);return HE(c)}function zE(e){const t=[];let n=[],i=null;for(const r of e.replace(/\r\n/g,`
|
|
280
|
-
`).split(`
|
|
281
|
-
`)){const o=r.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
|
|
282
|
-
`)),n=[]);continue}if(n.push(r),i)o.startsWith(i)&&(i=null);else{const c=o.match(/^(`{3,}|~{3,})/);c&&(i=c[1])}}return n.length&&t.push(n.join(`
|
|
283
|
-
`)),t}function HE(e){const t=[];for(const n of e){const i=t[t.length-1];i&&i.kind===n.kind?t[t.length-1]={markdown:`${i.markdown}
|
|
284
|
-
|
|
285
|
-
${n.markdown}`,kind:i.kind}:t.push(n)}return t}const KL="fleet.codex.cowork.settings",$J="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.";function zJ(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},c=WJ(),d=[],p="",f="",g="idle",_=!1,b=null,S=!1,w=!1,x=!1,C=null,O=!1,P=!1,z=!1,T=null,j="",M="",H="published",F=null,ee=null;const ae=()=>n?((!ee||ee.base!==n.baseDraft||ee.draft!==n.draft)&&(ee={base:n.baseDraft,draft:n.draft,lines:BJ(n.baseDraft,n.draft)}),ee.lines):[],K=e.body.innerHTML,B=document.createElement("div");B.className="cowork-anchor";const N=document.createElement("div");N.className="cowork-dock-zone";const R=document.createElement("div");R.className="cowork-tip",R.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(B,N,R);const A=()=>{if(t)return;const re=!!n&&n.state!=="closed",de=re?O?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(de!==H){if(H=de,!re){e.body.innerHTML=K;return}e.body.innerHTML=O?`<div class="cowork-rendered-diff" aria-label="Draft changes">${HJ(Av(n.baseDraft),Av(n.draft))}</div>`:Fa(Av(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:Ie=>Ep(Ie)}).html}},E=()=>{if(t)return;if(!b){B.innerHTML="";return}const re=e.article.getBoundingClientRect().width||0,de=S?Math.min(340,re*.86)/2+8:56,Ie=Math.min(Math.max(b.left,de),Math.max(re-de,de)),Te=`style="top:${b.top}px;left:${Ie}px"`;B.innerHTML=S?`<div class="cowork-composer" ${Te} role="dialog" aria-label="Add a comment">
|
|
286
|
-
<blockquote>${gt(UE(b.quote,140))}</blockquote>
|
|
287
|
-
<textarea class="cowork-composer-input" rows="2" placeholder="What should change here?" aria-label="Comment"></textarea>
|
|
288
|
-
<div class="cowork-composer-actions">
|
|
289
|
-
<button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">Cancel</button>
|
|
290
|
-
<button type="button" class="cowork-solid" data-cowork-action="add-comment">Add</button>
|
|
291
|
-
</div>
|
|
292
|
-
</div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${Te}><span aria-hidden="true">✦</span>Comment</button>`,S&&B.querySelector(".cowork-composer-input")?.focus()},L=()=>{if(t)return;const re=!!n&&n.state!=="closed"&&n.state!=="applied";N.classList.add("is-open");const de=z||re&&n.state==="running"&&g!=="complete"&&g!=="stopped";e.body.classList.toggle("is-cowork-running",de);const Ie=re&&n.baseDraft!==n.draft,Te=Ie?ae().filter(St=>St.changed).length:0;X(`
|
|
293
|
-
${$(de)}
|
|
294
|
-
${w?D():""}
|
|
295
|
-
${x?V():""}
|
|
296
|
-
${Ie&&!de?J(Te):""}
|
|
297
|
-
<div class="cowork-bar${de?" is-running":""}" data-cowork-form>
|
|
298
|
-
${de?'<span class="cowork-glow" aria-hidden="true"></span>':""}
|
|
299
|
-
<button type="button" class="cowork-chip${w?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${w}" aria-label="Annotations" ${de?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
|
|
300
|
-
<input class="cowork-dock-input" name="prompt" value="${dr(j)}" placeholder="${d.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${de?"disabled":""}>
|
|
301
|
-
<button type="button" class="cowork-chip cowork-chip--config${x?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${x}" aria-label="Agent settings" ${de?"disabled":""}>${gt(c.cli||"agent")}</button>
|
|
302
|
-
${de?'<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="Stop"><span aria-hidden="true"></span></button>':'<button type="button" class="cowork-send" data-cowork-action="send" aria-label="Send to AI">↑</button>'}
|
|
303
|
-
</div>
|
|
304
|
-
${M?`<p class="cowork-error" role="alert">${gt(M)}</p>`:""}`)},$=re=>{if(!(re||g!=="idle"))return"";const Ie=re?"running":g,Te=re?"Editing entry":g==="complete"?"Revision complete":"Revision stopped",St=!!(f||p||re);return`<section class="cowork-revision-stream is-${Ie}${_?" is-collapsed":""}" aria-label="Cowork revision stream">
|
|
305
|
-
${re?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
|
|
306
|
-
<header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${Te}</small></span>${St?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!_}" aria-label="${_?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
|
|
307
|
-
${St?`<div class="cowork-revision-content" aria-hidden="${_}"><div class="cowork-revision-content-inner">
|
|
308
|
-
${f||p?`<div class="cowork-revision-body">
|
|
309
|
-
${f?`<p class="cowork-revision-instruction">${gt(f)}</p>`:""}
|
|
310
|
-
${p?`<div class="cowork-revision-output-scroll"><p class="cowork-revision-output">${gt(p)}</p></div>`:""}
|
|
311
|
-
</div>`:""}
|
|
312
|
-
${re?'<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>Writing revision</strong></span></footer>':""}
|
|
313
|
-
</div></div>`:""}
|
|
314
|
-
</section>`},q=()=>{const re=N.querySelector(".cowork-revision-output");if(!re){L();return}re.textContent=p;const de=re.closest(".cowork-revision-output-scroll");de&&(de.scrollTop=de.scrollHeight)},X=re=>{if(re===F)return;F=re;const de=document.activeElement,Ie=de instanceof HTMLInputElement&&de.name==="prompt"&&N.contains(de)?"prompt":de instanceof HTMLTextAreaElement&&de.dataset.coworkComment&&N.contains(de)?`comment:${de.dataset.coworkComment}`:null;if(N.innerHTML=re,Ie==="prompt"){const Te=N.querySelector(".cowork-dock-input");Te?.focus(),Te?.setSelectionRange(Te.value.length,Te.value.length)}else if(Ie?.startsWith("comment:")){const Te=N.querySelector(`[data-cowork-comment="${CSS.escape(Ie.slice(8))}"]`);Te?.focus(),Te?.setSelectionRange(Te.value.length,Te.value.length)}},D=()=>`
|
|
315
|
-
<div class="cowork-popover cowork-panel" role="region" aria-label="Annotations">
|
|
316
|
-
${d.length===0?'<p class="cowork-empty">Select text in the document to add a comment.</p>':d.map(re=>`
|
|
317
|
-
<article class="cowork-card is-${re.status}">
|
|
318
|
-
<blockquote>${gt(UE(re.quote,160))}</blockquote>
|
|
319
|
-
<textarea data-cowork-comment="${dr(re.id)}" aria-label="Comment" placeholder="Add a comment" ${re.status==="sent"?"disabled":""}>${gt(re.comment)}</textarea>
|
|
320
|
-
<footer><span class="cowork-card-status">${re.status==="sent"?"Sent":re.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${dr(re.id)}" aria-label="Delete annotation">×</button></footer>
|
|
321
|
-
</article>`).join("")}
|
|
322
|
-
</div>`,V=()=>`
|
|
323
|
-
<div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
|
|
324
|
-
${Tv("CLI","cli",o.clis,c.cli)}${Tv("Model","model",o.models,c.model)}${Tv("Effort","effort",o.efforts,c.effort)}
|
|
325
|
-
</div>`,J=re=>C?`<div class="cowork-review is-confirm"><span>${C==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${C==="discard"?" cowork-solid--danger":""}" data-cowork-action="${C==="apply"?"apply-confirm":"discard-confirm"}">${C==="apply"?"Apply":"Discard"}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">Back</button></div>`:`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${re>0?`${re} changed line${re===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${O?"View draft":"View diff"}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">Apply</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">Discard</button></div>`,ce=()=>{if(!t){for(const re of[...e.body.querySelectorAll("mark.cowork-mark")]){const de=re.parentNode;if(de){for(;re.firstChild;)de.insertBefore(re.firstChild,re);de.removeChild(re)}}if(e.body.normalize(),!O)for(const re of d)re.quote&&ie(re)}},ie=re=>{const de=[],Ie=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let yt=Ie.nextNode();yt;yt=Ie.nextNode())de.push(yt);let Te="";const St=[];for(const yt of de)St.push(Te.length),Te+=yt.data;const Wn=Te.indexOf(re.quote);if(Wn<0)return;const Xn=Wn+re.quote.length;for(let yt=0;yt<de.length;yt+=1){const Rt=St[yt],Pt=Rt+de[yt].data.length,_s=Math.max(Wn,Rt),yn=Math.min(Xn,Pt);if(_s>=yn)continue;const yi=document.createRange();yi.setStart(de[yt],_s-Rt),yi.setEnd(de[yt],yn-Rt);const Rn=document.createElement("mark");Rn.className="cowork-mark",Rn.dataset.annotationId=re.id;try{yi.surroundContents(Rn)}catch{}}},ve=re=>{const de=d.find(Wn=>Wn.id===re.dataset.annotationId);if(!de){R.hidden=!0;return}R.textContent=de.comment.trim()||"No comment yet",R.hidden=!1;const Ie=re.getBoundingClientRect(),Te=e.article.getBoundingClientRect(),St=R.offsetWidth/2+8;R.style.top=`${Math.max(Ie.top-Te.top-6,0)}px`,R.style.left=`${Math.min(Math.max(Ie.left+Ie.width/2-Te.left,St),Math.max(Te.width-St,St))}px`},Se=()=>{A(),L(),ce()},Oe=async()=>{o=await dJ(e.theaterId,c.cli,c.model||void 0);const re=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",de=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";c={cli:o.clis.includes(c.cli)?c.cli:o.clis[0]??"",model:o.models.includes(c.model)?c.model:re,effort:o.efforts.includes(c.effort)?c.effort:de},Rv(c)},Ne=async re=>{n=re;const de=re.annotations.map(FJ),Ie=new Set(de.map(Te=>Te.id));d=[...de,...d.filter(Te=>!Ie.has(Te.id))],(re.cli||re.model||re.effort)&&(c={cli:re.cli??c.cli,model:re.model??c.model,effort:re.effort??c.effort},Rv(c));try{await Oe()}catch{}if(!t){if(n&&(n.cli!==c.cli||n.model!==c.model||n.effort!==c.effort))try{n=await kv(e.theaterId,n.id,c)}catch{}t||(Ze(),Se())}},ct=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const re=await jE(e.theaterId,e.entryId,c);return await Ne(re),re};L(),Oe().then(L).catch(()=>{}),(async()=>{try{const re=await fJ(e.theaterId,e.entryId);!t&&re&&await Ne(re)}catch{}})();function Ze(){n&&(i?.(),i=yJ(e.theaterId,n.id,r,(re,de)=>{if(de&&de<=r)return;r=Math.max(r,de);const Ie=n?.state==="running";if(re.session&&(n=re.session),re.type==="transcript"&&re.text&&n?.state==="running"){p=g==="running"?p+re.text:re.text,g="running",q();return}re.type==="done"&&(!T?.cancelled||T.submitted)&&(g=Ie||P||g==="stopped"||!!p||!!f?"complete":"idle",d=d.map(St=>St.status==="sent"?{...St,status:"done"}:St),P&&(P=!1,n&&n.baseDraft!==n.draft&&(O=!0))),(re.type==="error"||re.type==="session"&&Ie&&n?.state!=="running")&&(g="stopped",P=!1,d=d.map(Te=>Te.status==="sent"?{...Te,status:"pending"}:Te)),re.type==="error"&&re.text&&(M=re.text),Se()}))}async function Re(re,de){d=[...d,{id:UJ(),quote:re,comment:de,status:"pending"}],b=null,S=!1,E(),L(),ce();try{await ct(),await Le(()=>pJ(e.theaterId,n.id,re)),await ze()}catch{}}async function xe(re){d=d.filter(de=>de.id!==re),L(),ce(),R.hidden=!0;try{await ze()}catch{}}async function ze(){n&&await Le(()=>IE(e.theaterId,n.id,d.map(FE)))}async function le(){if(z||n?.state==="running")return;const re=d.filter(St=>St.status!=="done"),de=j.trim(),Ie=de||(re.length?$J:"");if(!Ie)return;const Te={cancelled:!1,submitted:!1};T=Te,z=!0,d=re.map(St=>({...St,status:"sent"})),p="",f=de,g="running",_=!1,j="",w=!1,x=!1,L(),ce();try{if(await ct(),Te.cancelled||T!==Te||(await Le(()=>IE(e.theaterId,n.id,d.map(FE))),Te.cancelled||T!==Te))return;Te.submitted=!0,await Le(()=>mJ(e.theaterId,n.id,Ie)),P=!0}catch{!Te.cancelled&&T===Te&&(P=!1,g="idle",d=d.map(St=>St.status==="sent"?{...St,status:"pending"}:St))}finally{!Te.cancelled&&T===Te&&(z=!1,T=null,L())}}async function We(){if(!n)return;const re=n.id;try{M="",await vJ(e.theaterId,re)}catch(de){M=de instanceof Error?de.message:"Cowork request failed.",L();return}i?.(),i=null,r=0,d=[],p="",f="",g="idle",_=!1,C=null,O=!1;try{await Ne(await jE(e.theaterId,e.entryId,c))}catch{n=null,Se()}}async function Le(re){try{M="",n=await re(),Se()}catch(de){throw M=de instanceof c1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(de.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":de instanceof Error?de.message:"Cowork request failed.",Se(),de}}const it=re=>{if(S||n?.state==="running"||re.target instanceof Node&&B.contains(re.target))return;const de=window.getSelection(),Ie=de?.toString().trim()??"";if(!Ie||!de||de.rangeCount===0||!e.body.contains(de.anchorNode))return;const Te=de.getRangeAt(0).getBoundingClientRect(),St=e.article.getBoundingClientRect();b={quote:Ie,top:Te.bottom-St.top+8,left:Math.min(Math.max(Te.left+Te.width/2-St.left,0),Math.max(St.width,0))},E()},bt=re=>{if(re.target instanceof Element){if(re.target.closest(".cowork-pill")){re.preventDefault();return}!B.contains(re.target)&&b&&(b=null,S=!1,E())}},je=re=>{if(re.key==="Escape"){b||S?(b=null,S=!1,E()):(w||x||C)&&(w=!1,x=!1,C=null,L());return}const de=re.target;re.key==="Enter"&&!re.shiftKey&&de instanceof HTMLTextAreaElement&&de.classList.contains("cowork-composer-input")&&(re.preventDefault(),dt()),re.key==="Enter"&&de instanceof HTMLInputElement&&de.name==="prompt"&&(re.preventDefault(),le())},dt=()=>{const re=B.querySelector(".cowork-composer-input")?.value.trim()??"";b&&Re(b.quote,re)},we=re=>{const de=re.target instanceof Element?re.target.closest("[data-cowork-action]"):null;if(!de)return;const Ie=de.dataset.coworkAction;if(Ie==="comment"&&(S=!0,E()),Ie==="cancel-comment"&&(b=null,S=!1,E()),Ie==="add-comment"&&dt(),Ie==="toggle-panel"&&(w=!w,x=!1,L()),Ie==="toggle-config"&&(x=!x,w=!1,L()),Ie==="toggle-revision"){_=!_;const Te=de.closest(".cowork-revision-stream");Te?.classList.toggle("is-collapsed",_),de.setAttribute("aria-expanded",String(!_)),de.setAttribute("aria-label",`${_?"Expand":"Collapse"} Cowork stream`),Te?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(_))}if(Ie==="send"&&le(),Ie==="cancel-run"&&z&&T&&!T.submitted){T.cancelled=!0,z=!1,P=!1,g="stopped",d=d.map(Te=>Te.status==="sent"?{...Te,status:"pending"}:Te),L(),ce();return}Ie==="toggle-diff"&&(O=!O,Se()),Ie==="delete-annotation"&&de.dataset.annotationId&&xe(de.dataset.annotationId),Ie==="apply-arm"&&(C="apply",L()),Ie==="discard-arm"&&(C="discard",L()),Ie==="confirm-back"&&(C=null,L()),Ie==="apply-confirm"&&n&&(C=null,Le(()=>_J(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Ie==="discard-confirm"&&We(),Ie==="cancel-run"&&n&&Le(()=>gJ(e.theaterId,n.id)).then(()=>{g="stopped",d=d.map(Te=>Te.status==="sent"?{...Te,status:"pending"}:Te),L()}).catch(()=>{})},$e=re=>{const de=re.target instanceof Element?re.target.closest("mark.cowork-mark"):null;de?ve(de):R.hidden||(R.hidden=!0)},ft=()=>{R.hidden=!0},Ti=re=>{const de=re.target;if(de instanceof HTMLInputElement&&de.name==="prompt"){j=de.value;return}if(de instanceof HTMLTextAreaElement&&de.dataset.coworkComment){const Ie=de.dataset.coworkComment;d=d.map(Te=>Te.id===Ie?{...Te,comment:de.value,status:"pending"}:Te)}},An=re=>{const de=re.target;if(de instanceof HTMLSelectElement&&["cli","model","effort"].includes(de.name)){if(c=de.name==="cli"?{cli:de.value,model:"",effort:""}:{...c,[de.name]:de.value},Rv(c),!n){de.name!=="effort"&&Oe().then(L).catch(()=>{});return}de.name!=="effort"?Oe().then(()=>Le(()=>kv(e.theaterId,n.id,c))).then(L).catch(Ie=>{M=Ie instanceof Error?Ie.message:"Cowork request failed.",L()}):Le(()=>kv(e.theaterId,n.id,c)).catch(()=>{});return}de instanceof HTMLTextAreaElement&&de.dataset.coworkComment&&ze().catch(()=>{})};return e.article.addEventListener("mouseup",it),e.article.addEventListener("mousedown",bt),e.article.addEventListener("keydown",je),e.article.addEventListener("click",we),e.article.addEventListener("input",Ti),e.article.addEventListener("change",An),e.article.addEventListener("mouseover",$e),e.article.addEventListener("mouseleave",ft),{destroy(){t=!0,i?.(),e.article.removeEventListener("mouseup",it),e.article.removeEventListener("mousedown",bt),e.article.removeEventListener("keydown",je),e.article.removeEventListener("click",we),e.article.removeEventListener("input",Ti),e.article.removeEventListener("change",An),e.article.removeEventListener("mouseover",$e),e.article.removeEventListener("mouseleave",ft),B.remove(),N.remove(),R.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Tv(e,t,n,i){return`<label class="cowork-selector"><span>${e}</span><select name="${t}" ${n.length?"":"disabled"}>${n.map(r=>`<option value="${dr(r)}" ${r===i?"selected":""}>${gt(r)}</option>`).join("")}</select></label>`}function HJ(e,t){return PJ(e,t).map(n=>{const i=Fa(n.markdown,{resolveWikiLink:r=>Ep(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function FE(e){return{id:e.id,text:`[${e.quote}]
|
|
326
|
-
${e.comment.trim()||"Please revise this passage."}`}}function FJ(e){const t=e.text.indexOf(`]
|
|
327
|
-
`);return t>0&&e.text.startsWith("[")?{id:e.id,quote:e.text.slice(1,t),comment:e.text.slice(t+2),status:"pending"}:{id:e.id,quote:"",comment:e.text,status:"pending"}}function Av(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function UE(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function UJ(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function WJ(){try{const e=JSON.parse(localStorage.getItem(KL)??"{}");return{cli:typeof e.cli=="string"?e.cli:"claude",model:typeof e.model=="string"?e.model:"",effort:typeof e.effort=="string"?e.effort:"medium"}}catch{return{cli:"claude",model:"",effort:"medium"}}}function Rv(e){try{localStorage.setItem(KL,JSON.stringify(e))}catch{}}const VL={create_wiki:"+",update_wiki:"↻"},YL={create_wiki:"Create",update_wiki:"Update"};function qJ(e,t){let n=!1,i=0,r=null,o=null,c=t,d="idle",p=null,f=null,g=null;H0(e);function _(T){const j=T.target;if(!(j instanceof Element))return;const M=j.closest("[data-patch-id]");if(M){T.preventDefault();const ee=M.dataset.patchId||void 0;c.onPatchOpen?.(ee);return}const H=j.closest("[data-entry-id]");if(H?.dataset.entryId){T.preventDefault(),c.onRelatedClick(H.dataset.entryId);return}const F=j.closest("[data-drydock-action]");if(F){T.preventDefault(),b(F.dataset.drydockAction);return}}function b(T){if(T){if(T==="back"){c.onPatchOpen?.(void 0);return}if(T==="approve"){d="approving",p=null,w();return}if(T==="approve-confirm"){S("approve",void 0);return}if(T==="reject"){d="rejecting",p=null,w();return}if(T==="reject-submit"){const j=e.querySelector("#queue-reject-reason")?.value.trim();if(!j){p="Rejection reason is required.",w();return}S("reject",j);return}if(T==="cancel"){d="idle",p=null,w();return}}}async function S(T,j){if(g){d="submitting",p=null,w();try{await cJ(c.theaterId,g,T,j),c.onDecided?.()}catch(M){d=T==="approve"?"approving":"rejecting",p=M instanceof Error?M.message:String(M),w()}}}function w(){const T=e.querySelector("[data-decision-bar-wrap]");T&&(T.innerHTML=XL(d,p))}e.addEventListener("click",_);function x(){o?.destroy(),o=null,r?.(),r=null}async function C(T){if(!n){mf(e,t.tocContainer),x();try{const j=await rJ(c.theaterId,T);if(n)return;const{index:M}=jl(),{html:H,toc:F}=Fa(j.body,{omitDuplicateTitle:j.frontmatter.title,resolveWikiLink:K=>Ep(K)});e.innerHTML=`
|
|
328
|
-
<article class="document">
|
|
329
|
-
<header class="document-header">
|
|
330
|
-
${GJ(j.frontmatter.title)}
|
|
331
|
-
<h1>${gt(j.frontmatter.title)}</h1>
|
|
332
|
-
${NJ(j.frontmatter)}
|
|
333
|
-
</header>
|
|
334
|
-
<div class="markdown-body" id="codex-reader-body">
|
|
335
|
-
${H}
|
|
336
|
-
</div>
|
|
337
|
-
${KJ(j.frontmatter.id,j.frontmatter.tags,M)}
|
|
338
|
-
</article>
|
|
339
|
-
`,t.tocContainer.innerHTML=Ev(F);const ee=e.querySelector("article");ee&&F.length>0&&(r=PE(ee,F,t.tocContainer));const ae=e.querySelector("#codex-reader-body");ee&&ae&&(o=zJ({theaterId:c.theaterId,entryId:T,title:j.frontmatter.title,article:ee,body:ae,onApplied:()=>{C(T)}}))}catch(j){n||gf(e,t.tocContainer,j)}}}async function O(T){if(!n){mf(e,t.tocContainer),x(),f=null,g=null,d="idle",p=null;try{if(T){const j=await aJ(c.theaterId,T);if(n)return;f=j.meta,g=T;const{html:M,toc:H}=Fa(j.wikiEntry.body,{omitDuplicateTitle:j.wikiEntry.title,resolveWikiLink:ee=>Ep(ee)});e.innerHTML=XJ(j,M),t.tocContainer.innerHTML=Ev(H);const F=e.querySelector("article");F&&H.length>0&&(r=PE(F,H,t.tocContainer))}else{const j=await zL(c.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=VJ(j.items,"Review queue — Pending patches")}}catch(j){n||gf(e,t.tocContainer,j)}}}async function P(T){if(!n){mf(e,t.tocContainer),x();try{if(T){const j=await hJ(c.theaterId,T);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=QJ(j)}else{const j=await uJ(c.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=eQ(j)}}catch(j){n||gf(e,t.tocContainer,j)}}}async function z(T){const j=++i,M=c.theaterId;mf(e,t.tocContainer),x();try{const H=await lJ(M,T);if(n||j!==i||M!==c.theaterId)return;const{html:F,toc:ee}=Fa(H.content);e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>Schema</span></li><li><span aria-current="page">${gt(T??"Workspace schema")}</span></li></ol></nav><h1>${gt(T??"Workspace schema")}</h1><span class="queue-dl-mono">${gt(H.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${F}</div></article>`,t.tocContainer.innerHTML=Ev(ee)}catch(H){!n&&j===i&&M===c.theaterId&&gf(e,t.tocContainer,H)}}return t.kind==="entry"&&t.initialEntryId?C(t.initialEntryId):t.kind==="drydock"?O(t.subId):t.kind==="conflicts"?P(t.subId):t.kind==="schema"&&z(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",_),x(),o?.destroy()},async setEntry(T){await C(T)},async navigateSub(T){t.kind==="drydock"?await O(T):t.kind==="conflicts"?await P(T):t.kind==="schema"&&await z(T)},refreshCallbacks(T){c={...c,...T}}}}function mf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function gf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${gt(i)}</div>`,t.innerHTML=""}function GJ(e){return`
|
|
340
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
341
|
-
<ol>
|
|
342
|
-
<li><span>Codex</span></li>
|
|
343
|
-
<li><span aria-current="page">${gt(e)}</span></li>
|
|
344
|
-
</ol>
|
|
345
|
-
</nav>
|
|
346
|
-
`}function KJ(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(c=>i.has(c))})).filter(o=>o.matchingTags.length>0).sort((o,c)=>c.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(c.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
|
|
347
|
-
<section class="related-list">
|
|
348
|
-
<h2>Related entries</h2>
|
|
349
|
-
<div class="related-items">
|
|
350
|
-
${r.map(o=>`<button class="related-card" type="button" data-entry-id="${dr(o.entry.id)}">
|
|
351
|
-
<strong>${gt(o.entry.title)}</strong>
|
|
352
|
-
<span>${qL(o.matchingTags)}</span>
|
|
353
|
-
</button>`).join("")}
|
|
354
|
-
</div>
|
|
355
|
-
</section>
|
|
356
|
-
`}function VJ(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
357
|
-
<article class="document">
|
|
358
|
-
<header class="document-header">
|
|
359
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
360
|
-
<ol>
|
|
361
|
-
<li><span>Codex</span></li>
|
|
362
|
-
<li><span aria-current="page">Review queue</span></li>
|
|
363
|
-
</ol>
|
|
364
|
-
</nav>
|
|
365
|
-
<h1>${gt(t)}</h1>
|
|
366
|
-
</header>
|
|
367
|
-
<div class="queue-row-list">
|
|
368
|
-
${e.map(YJ).join("")}
|
|
369
|
-
</div>
|
|
370
|
-
</article>
|
|
371
|
-
`}function YJ(e){const t=e.op??"create_wiki",n=VL[t]??"?",i=YL[t]??"Patch",r=e.target??e.id,c=[tQ(e.meta.createdAt)].filter(Boolean);return`
|
|
372
|
-
<button class="queue-row" type="button" data-patch-id="${dr(e.id)}" aria-label="${dr(i+": "+r)}">
|
|
373
|
-
<span class="queue-row-badge" aria-hidden="true">
|
|
374
|
-
<span class="op-badge">${n}</span>
|
|
375
|
-
</span>
|
|
376
|
-
<span class="queue-row-body">
|
|
377
|
-
<span class="queue-row-target">${gt(r)}</span>
|
|
378
|
-
${e.summary?`<span class="queue-row-summary">${gt(e.summary)}</span>`:""}
|
|
379
|
-
${c.length>0?`<span class="queue-row-meta">${c.map(gt).join(" · ")}</span>`:""}
|
|
380
|
-
</span>
|
|
381
|
-
</button>
|
|
382
|
-
`}function XJ(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,c=n.frontmatter.op,d=VL[c]??"?",p=YL[c]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",g=i.status==="pending";return`
|
|
383
|
-
<article class="document">
|
|
384
|
-
<header class="document-header">
|
|
385
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
386
|
-
<ol>
|
|
387
|
-
<li><span>Codex</span></li>
|
|
388
|
-
<li><span>Review queue</span></li>
|
|
389
|
-
<li><span aria-current="page">${gt(p)}</span></li>
|
|
390
|
-
</ol>
|
|
391
|
-
</nav>
|
|
392
|
-
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
393
|
-
<h1><span class="op-badge">${d}</span> ${gt(r.title)}</h1>
|
|
394
|
-
<p class="eyebrow">${gt(n.frontmatter.target)} · v${r.version} · ${gt(f)}</p>
|
|
395
|
-
${ZJ(n.frontmatter.proposer,r.tags)}
|
|
396
|
-
</header>
|
|
397
|
-
<div class="markdown-body" id="codex-reader-body">
|
|
398
|
-
${t}
|
|
399
|
-
</div>
|
|
400
|
-
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
401
|
-
${g?XL("idle",null):JJ(i)}
|
|
402
|
-
</div>
|
|
403
|
-
</article>
|
|
404
|
-
`}function ZJ(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${gt(e)}</span>`),t.length>0&&n.push(qL(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function XL(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
405
|
-
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
406
|
-
<div class="queue-action-buttons">
|
|
407
|
-
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
408
|
-
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
409
|
-
</div>
|
|
410
|
-
${t?`<p class="queue-action-error">${gt(t)}</p>`:""}
|
|
411
|
-
`:e==="rejecting"?`
|
|
412
|
-
<div class="queue-reject-form">
|
|
413
|
-
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
414
|
-
<div class="queue-action-buttons">
|
|
415
|
-
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
416
|
-
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
417
|
-
</div>
|
|
418
|
-
${t?`<p class="queue-action-error">${gt(t)}</p>`:""}
|
|
419
|
-
</div>
|
|
420
|
-
`:`
|
|
421
|
-
<div class="queue-action-buttons">
|
|
422
|
-
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
423
|
-
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
424
|
-
</div>
|
|
425
|
-
`}function JJ(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${gt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function QJ(e){return`
|
|
426
|
-
<article class="document">
|
|
427
|
-
<header class="document-header">
|
|
428
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
429
|
-
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
430
|
-
</nav>
|
|
431
|
-
<h1>${gt(e.id)}</h1>
|
|
432
|
-
<p class="eyebrow">Conflict · ${gt(e.meta?.status??"open")}</p>
|
|
433
|
-
</header>
|
|
434
|
-
<div class="markdown-body">
|
|
435
|
-
${e.current?`<h2>Current</h2><pre><code>${gt(e.current)}</code></pre>`:""}
|
|
436
|
-
${e.proposed?`<h2>Proposed</h2><pre><code>${gt(e.proposed)}</code></pre>`:""}
|
|
437
|
-
</div>
|
|
438
|
-
</article>
|
|
439
|
-
`}function eQ(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
440
|
-
<article class="document">
|
|
441
|
-
<header class="document-header">
|
|
442
|
-
<h1>Conflicts</h1>
|
|
443
|
-
</header>
|
|
444
|
-
<div class="markdown-body">
|
|
445
|
-
<ul class="queue-list">
|
|
446
|
-
${e.map(t=>`<li class="queue-item">
|
|
447
|
-
<strong>${gt(t.title||t.id)}</strong>
|
|
448
|
-
<span class="eyebrow">${gt(t.status)}</span>
|
|
449
|
-
</li>`).join("")}
|
|
450
|
-
</ul>
|
|
451
|
-
</div>
|
|
452
|
-
</article>
|
|
453
|
-
`}function tQ(e){try{const n=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(n<1)return"< 1h ago";if(n<24)return`${Math.floor(n)}h ago`;const i=n/24;return i<7?`${Math.floor(i)}d ago`:i<30?`${Math.floor(i/7)}w ago`:`${Math.floor(i/30)}mo ago`}catch{return""}}let Eo=null,vh=null,ZL=null,$a=null,To=null,Ia=null,$f=null,Nv=null,zf,jb=0;function WE(e){ZL=e}function nQ(e,t){const n=rQ();n.parentElement!==e&&e.appendChild(n),vh||(vh=RJ(n,{initialTheaterId:t,onRequest:i=>ZL?.(i)}))}function iQ(e){vh?.setTheater(e)}function JL(e,t,n){const i=aQ(),r=oQ(),o=i.parentElement,c=n.kind==="entry"&&$f==="entry"&&n.initialEntryId===Nv;o&&o!==e&&(jb=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Ia||$f!==n.kind?(Ia?.destroy(),Ia=qJ(i,{...n,tocContainer:r}),$f=n.kind,zf=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==Nv?Ia.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==zf&&(zf=n.subId,Ia.navigateSub(n.subId)),Nv=n.kind==="entry"?n.initialEntryId??null:null,Ia.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=c?jb:0;requestAnimationFrame(()=>{e.scrollTop=d})}function sQ(){const e=$a?.parentElement;e&&(jb=e.scrollTop)}function QL(){Ia?.destroy(),Ia=null,$f=null,zf=void 0,$a?.parentElement&&$a.parentElement.removeChild($a),To?.parentElement&&To.parentElement.removeChild(To)}function qE(){QL(),vh?.destroy(),vh=null,Eo?.parentElement&&Eo.parentElement.removeChild(Eo)}function rQ(){return Eo||(Eo=document.createElement("div"),Eo.className="codex-host"),Eo}function aQ(){return $a||($a=document.createElement("div"),$a.className="codex-reader-host"),$a}function oQ(){return To||(To=document.createElement("div"),To.className="codex-toc-host"),To}const lQ={id:"codex",title:"Codex",icon:()=>u.jsx(fQ,{}),pathAware:!1,render:e=>u.jsx(cQ,{theaterId:e.theaterId})};function cQ({theaterId:e}){const t=Xs(),n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),o=y.useRef(""),[c,d]=y.useState(null),p=t.codexReader,f=p!==null,g=t.codexReaderExpanded,_=t.theaters.find(O=>O.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=c?.contextKey===S&&c.hasWiki?c.id:null,x=w!==null,C=p?`${p.kind}:${p.kind==="entry"?p.entryId:p.kind==="drydock"?p.patchId??"":p.kind==="conflicts"?p.id??"":p.templateId??""}`:null;return y.useEffect(()=>{if(o.current=S,m_(),!e){d({contextKey:S,hasWiki:!1,id:null});return}hQ(e).then(O=>{o.current===S&&d({contextKey:S,...O})}).catch(()=>{o.current===S&&d({contextKey:S,hasWiki:!1,id:null})})},[S,e]),y.useEffect(()=>{c?.contextKey===S&&!c.hasWiki&&qE()},[S,c]),y.useEffect(()=>()=>qE(),[]),y.useEffect(()=>{if(!x||!w)return;const O=n.current;if(O)return nQ(O,w),WE(P=>{P.kind==="entry"?or({kind:"entry",entryId:P.id}):P.kind==="drydock"?or({kind:"drydock",patchId:P.patchId}):P.kind==="conflicts"?or({kind:"conflicts",id:P.id}):P.kind==="schema"&&or({kind:"schema",templateId:P.templateId})}),()=>{WE(null)}},[x,w,f]),y.useEffect(()=>{x&&w&&iQ(w)},[x,w]),y.useEffect(()=>{if(!x||!w||!f||g||!i.current||!r.current||!p)return;const O=p.kind,P=O==="drydock"?p.patchId:O==="conflicts"?p.id:O==="schema"?p.templateId:void 0;JL(i.current,r.current,{initialEntryId:O==="entry"?p.entryId:"",kind:O,subId:P,theaterId:w,onRelatedClick:z=>or({kind:"entry",entryId:z}),onClose:()=>m_(),onPatchOpen:z=>or({kind:"drydock",patchId:z}),onDecided:()=>{kp(),or({kind:"drydock",patchId:void 0})}})},[x,w,f,g,C]),y.useEffect(()=>{f||QL()},[f]),x?f?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:Sf,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:m_,children:"✕"})]}),u.jsx("div",{ref:i,className:"codex-doc-scroll"}),u.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:n,className:"codex-nav-pane"})]}):u.jsx("div",{ref:n,className:"codex-rail-host"}):u.jsx(uQ,{activeTheater:_,hasTheaters:b})}function uQ({activeTheater:e,hasTheaters:t}){return t?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:e?.label||"This Theater"}),u.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function hQ(e){const t=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!t.ok)throw new Error("codex_workspace_unavailable");return dQ(await t.json())}function dQ(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 fQ(){return u.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),u.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),u.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function pQ(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(r=>i===""||r.name.toLocaleLowerCase().includes(i)||r.title.toLocaleLowerCase().includes(i)?n==="all"?!0:r.tasksTotal<=0?!1:n==="complete"?r.tasksDone>=r.tasksTotal:r.tasksDone<r.tasksTotal:!1)}function mQ(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function Ib(e){return e.replace(/\s+/g," ").trim()}function gQ(e,t){const n=i=>Ib(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function eM(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function _Q(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 vQ(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function yQ(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function bQ(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(yQ)?"ready":"blocked"}const SQ="plans-changed",wQ=3e4;function xQ(e,t){let n=null,i=null,r=!1,o=!0;const c=()=>{const d=o;o=!1;let p=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener(SQ,()=>{t()}),n.onopen=()=>{p+=1,d&&p===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(r||t(),i=setTimeout(()=>{i=null,r||c()},wQ))}};return c(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const CQ=360,kQ={id:"plans",title:"Plans",icon:LQ,pathAware:!1,render:e=>u.jsx(EQ,{...e})};function EQ(e){const t=e.theaterId;return u.jsx(TQ,{...e},t)}function TQ(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=y.useState({kind:"no-theater"}),[o,c]=y.useState({kind:"loading"}),[d,p]=y.useState(null),[f,g]=y.useState(0),[_,b]=y.useState(0),[S,w]=y.useState(()=>new Set),x=y.useRef(0),C=y.useRef(0),O=y.useRef(null),P=y.useRef(o),z=y.useRef(null),T=y.useRef(!1),j=y.useRef(!1),M=y.useRef(null),H=y.useRef(null),F=d?.theaterId===n?d.name:null;y.useEffect(()=>{M.current=F},[F]),y.useEffect(()=>{const R=++x.current;if(!n){r({kind:"no-theater"});return}const A=O.current!==null,E=j.current;j.current=!1,A||r({kind:"loading"}),MO(n).then(L=>{if(R!==x.current)return;const $=new Map(L.plans.map(D=>[D.name,mQ(D)])),q=O.current;if(q){const D=new Set(L.plans.filter(V=>q.get(V.name)!==$.get(V.name)).map(V=>V.name));D.size>0&&(H.current&&clearTimeout(H.current),w(D),H.current=setTimeout(()=>w(new Set),1200))}O.current=$,r({kind:"ready",plans:L.plans});const X=M.current;X&&($.has(X)?$.get(X)!==z.current&&b(D=>D+1):(z.current=null,T.current=!0,b(D=>D+1)))}).catch(()=>{R===x.current&&(!A||E)&&r({kind:"error"})})},[n,f]),y.useEffect(()=>{const R=++C.current;if(!n||!F)return;const A=T.current;T.current=!1,!A&&P.current.kind==="ready"&&P.current.plan.name===F||(z.current=null,P.current={kind:"loading"},c({kind:"loading"})),OO(n,F).then(L=>{if(R===C.current){z.current=O.current?.get(L.name)??null;const $={kind:"ready",plan:L};P.current=$,c($)}}).catch(()=>{R===C.current&&(P.current={kind:"error"},c({kind:"error"}))})},[_,F,n]),y.useEffect(()=>{if(n)return xQ(n,()=>{g(R=>R+1)})},[n]),y.useEffect(()=>()=>{H.current&&clearTimeout(H.current)},[]),y.useLayoutEffect(()=>(t?.(F?CQ:null),()=>t?.(null)),[t,F]);const ee=y.useCallback(R=>{n&&p({theaterId:n,name:R})},[n]),ae=y.useCallback(()=>{p(null),z.current=null,P.current={kind:"loading"},c({kind:"loading"})},[]),B=y.useCallback(()=>{j.current=!0,g(R=>R+1)},[]),N=y.useCallback(()=>b(R=>R+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${F?" is-reader-open":""}`,onKeyDown:R=>{R.key==="Escape"&&F&&ae()},children:[F&&u.jsx(RQ,{state:o,onClose:ae,onRetry:N}),F&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(AQ,{selectedName:F,state:i,onRetry:B,onSelect:ee,pulsedNames:S})]})})}function AQ({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,c]=y.useState(""),[d,p]=y.useState("all"),[f,g]=y.useState(null),_=y.useRef(new Map);if(t.kind==="no-theater")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Lv,{children:"Select a Theater to browse plans."})});if(t.kind==="loading")return u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-loading",children:"Loading plans…"})});if(t.kind==="error")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(tM,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Lv,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=pQ(t.plans,o,d),S=(C,O)=>{const P=(C+O+b.length)%b.length;_.current.get(b[P]?.name??"")?.focus()},w=(C,O)=>{(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),S(O,C.key==="ArrowDown"?1:-1))},x=(C,O)=>{C.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${O}`).then(()=>{g(O),window.setTimeout(()=>g(P=>P===O?null:P),1200)}).catch(()=>{})};return u.jsxs("div",{className:"plans-list-pane",children:[u.jsxs("div",{className:"plans-toolbar",children:[u.jsxs("label",{className:"plans-search-label",children:[u.jsx("span",{children:"Search plans"}),u.jsx("input",{className:"plans-search",value:o,onChange:C=>c(C.target.value)})]}),u.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(C=>u.jsx("button",{type:"button",className:`plans-filter${d===C?" is-active":""}`,"aria-pressed":d===C,onClick:()=>p(C),children:C==="all"?"ALL":C==="in-progress"?"IN PROGRESS":"COMPLETE"},C))}),u.jsx("button",{type:"button",className:"plans-refresh",onClick:n,children:"REFRESH"})]}),u.jsxs("div",{className:"plans-list","aria-label":"Plans",children:[b.length===0&&u.jsx(Lv,{children:"No matching plans."}),b.map((C,O)=>{const P=_Q(C.tasksDone,C.tasksTotal),z=P===100;return u.jsxs("div",{className:`plans-row${e===C.name?" is-selected":""}${r.has(C.name)?" is-pulsing":""}`,children:[u.jsxs("button",{ref:T=>{T?_.current.set(C.name,T):_.current.delete(C.name)},type:"button",className:"plans-row-select",onClick:()=>i(C.name),onKeyDown:T=>w(T,O),children:[u.jsx("span",{className:"plans-row-name",children:C.name}),u.jsxs("span",{className:"plans-row-meta",children:[C.waveCount," waves · ",C.tasksDone,"/",C.tasksTotal," tasks · ",eM(C.updatedAt),C.executionMode==="parallel"?" · parallel":""]}),P!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":`${P}% complete`,children:u.jsx("span",{className:`plans-progress-fill${z?" is-complete":""}`,style:{width:`${P}%`}})})]}),u.jsx("button",{type:"button",className:"plans-copy",onClick:T=>x(T,C.name),"aria-label":f===C.name?`Copied plans/${C.name}`:`Copy plans/${C.name}`,children:f===C.name?"COPIED":"COPY"})]},C.name)})]})]})}function RQ({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(Bb,{onClose:t})]}),u.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(Bb,{onClose:t})]}),u.jsx(tM,{message:"Unable to load plan.",onRetry:n})]}):u.jsx(NQ,{plan:e.plan,onClose:t})}function NQ({plan:e,onClose:t}){const n=y.useMemo(()=>{const d=new DOMParser().parseFromString(Fa(e.content).html,"text/html");return Mv(d.body),d.body.innerHTML},[e.content]),i=y.useRef(null),r=y.useRef(null),o=y.useCallback((d,p)=>{const f=i.current;if(!f)return;const g=[...f.querySelectorAll(d)].find(b=>d==="h3"?gQ(b.textContent??"",p):Ib(b.textContent??"")===Ib(p));if(!g)return;const _=window.matchMedia("(prefers-reduced-motion: reduce)").matches;g.scrollIntoView({behavior:_?"auto":"smooth",block:"start"}),g.classList.remove("plans-heading-flash"),g.getBoundingClientRect(),g.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>g.classList.remove("plans-heading-flash"),1200)},[]),c=y.useCallback(d=>{const p=d.target.closest('[data-action="copy-code"]');if(!p)return;const f=p.closest("pre")?.getAttribute("data-code");if(!f)return;navigator.clipboard?.writeText(f);const g=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=g},1200)},[]);return y.useEffect(()=>{const d=i.current;if(!d)return;H0(d),Mv(d);const p=new MutationObserver(()=>Mv(d));return p.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>p.disconnect()},[n]),y.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsxs("div",{className:"plans-reader-heading",children:[u.jsx("h2",{className:"plans-reader-title",children:e.title}),u.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&u.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",eM(e.updatedAt)]})]}),u.jsx(Bb,{onClose:t})]}),u.jsxs("div",{className:"plans-reader-body",children:[u.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,p)=>{const f=vQ(d.tasksDone,d.tasksTotal);return u.jsxs("div",{className:`plans-wave is-${f}`,children:[u.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>o("h2",d.heading),children:d.heading}),d.tasksTotal>0&&u.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&u.jsx("div",{className:"plans-lane-list",children:d.lanes.map((g,_)=>{const b=bQ(e.waves,p,g);return u.jsxs("div",{className:`plans-lane is-${b}`,children:[u.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",g.heading),children:g.id??g.heading}),g.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[g.tasksDone,"/",g.tasksTotal]}),b==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:"READY"})]},g.id??`${d.index}-${_}`)})})]},d.index)})}),u.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:c,dangerouslySetInnerHTML:{__html:n}})]})]})}function Bb({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Lv({children:e,detail:t}){return u.jsxs("div",{className:"plans-empty",children:[u.jsx("span",{children:e}),t&&u.jsx("span",{className:"plans-empty-detail",children:t})]})}function tM({message:e,onRetry:t}){return u.jsxs("div",{className:"plans-error-state",children:[u.jsx("span",{children:e}),u.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Mv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(n)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const n=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),i=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=n?`${i} blocked: ${n}`:`${i} blocked`,t.replaceWith(r)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const n=t.getAttribute("href")??t.getAttribute("xlink:href")??"";n!==""&&!n.startsWith("#")&&t.remove()}}function LQ(){return u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),u.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 MQ=[ZZ,lQ,kQ];function OQ(e="right"){const{railPanels:t}=hc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const DQ=360;function jQ(e){const{codexReader:t}=Xs();return e==="codex"&&t!==null?DQ:0}const nM=240,IQ=312,iM="fleet-console.rail.panelWidth",BQ={kind:"root",relPath:null,label:"Theater-wide"};function PQ(){try{const e=localStorage.getItem(iM);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=nM)return t}}catch{}return IQ}function $Q({theaterId:e,api:t}){const n=y.useRef(null),i=nT(),r=iT(),o=y.useRef(r),c=OQ(),d=MQ,f=[...d,...c].find(N=>N.id===i)??null,g=f!==null,{pathContextTheaterId:_,pathContext:b,pathContextHydrated:S,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:C,isPathContextDeckOpen:O}=sT(),P=e!==null&&_===e&&S&&b!==null,z=jQ(i)+(f?.preferredExtraWidth??0)+Ij(),T=y.useRef(z);T.current=z;const[j,M]=y.useState(PQ),H=y.useRef(j),[F,ee]=y.useState(!1);y.useLayoutEffect(()=>{o.current&&!r&&UN(n.current,".command-band-rail-toggle"),o.current=r},[r]),y.useEffect(()=>{eT(e),e&&jj(e,N=>xj(e,N))},[e]);const ae=y.useCallback(N=>{N.preventDefault();const R=N.clientX,A=H.current;ee(!0);const E=$=>{const q=R-$.clientX,X=window.innerWidth-148-T.current,D=Math.max(nM,Math.min(X,A+q));H.current=D,M(D)},L=()=>{document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",L),ee(!1);try{localStorage.setItem(iM,String(H.current))}catch{}};document.addEventListener("pointermove",E),document.addEventListener("pointerup",L)},[]),K=y.useCallback(N=>{e&&tT(e,R=>G5(e,N,R))},[e]),B=y.useMemo(()=>({theaterId:e,pathContext:b??BQ,selectPathContext:K,api:t,requestExtraWidth:N=>{i!==null&&Dj(i,N)}}),[e,b,K,t,i]);return u.jsxs("div",{ref:n,className:`right-rail${g?" is-open":""}${r?" is-expanded":" is-closed"}${F?" is-dragging":""}${O?" is-context-deck-open":""}`,"data-rail-chrome":r?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!r,style:{"--right-rail-panel-width":`${g?j+z:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:j+z}:void 0,children:[g&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:ae,"aria-hidden":"true"}),f&&u.jsx(zQ,{activePanel:f,activeId:i,ctx:B,theaterId:e,hasHydratedPathContext:P,isPathContextDeckOpen:O,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:C,onSelectPathContext:K})]}),u.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[d.map(N=>u.jsx(GE,{panel:N,isActive:i===N.id},N.id)),d.length>0&&c.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,c.map(N=>u.jsx(GE,{panel:N,isActive:i===N.id},N.id))]})})]})}const zQ=y.memo(function({activePanel:t,activeId:n,ctx:i,theaterId:r,hasHydratedPathContext:o,isPathContextDeckOpen:c,pathContextLoading:d,pathContextMutationInProgress:p,pathContextError:f,onSelectPathContext:g}){const _=y.useRef(null),b=y.useRef(null),S=y.useRef(!1),w=t.pathAware===!0,x=y.useSyncExternalStore(O5,()=>nh().theaters.find(z=>z.id===r)?.label??"Theater"),C=Nj(w,r,o);y.useEffect(()=>{if(S.current&&!c){const z=requestAnimationFrame(()=>_.current?.focus());return S.current=c,()=>cancelAnimationFrame(z)}S.current=c},[c]),y.useEffect(()=>{if(!c)return;const z=T=>{const j=T.target;!(j instanceof Node)||_.current?.contains(j)||b.current?.contains(j)||wf(!1)};return document.addEventListener("pointerdown",z),()=>document.removeEventListener("pointerdown",z)},[c]);const O=y.useCallback(()=>wf(!1),[]),P=y.useCallback(z=>{g(z)},[g]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[w?u.jsxs("button",{ref:_,className:`rail-context-title-trigger${c?" is-open":""}`,type:"button",disabled:!o||d||p,"aria-expanded":c,"aria-haspopup":"dialog",title:f??t.title,onClick:()=>wf(!c),children:[u.jsx("span",{className:"rail-context-title-text",children:t.title}),u.jsx("span",{className:"rail-context-label",title:r===null?"Theater-wide":o?i.pathContext.label:"Loading…",children:r===null?"Theater-wide":o?i.pathContext.label:"Loading…"}),u.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:Mj,children:"✕"}),w&&o&&c&&r?u.jsx(Z5,{ref:b,theaterId:r,theaterLabel:x,context:i.pathContext,isMutating:p,onSelect:P,onClose:O}):null]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:C?t.render(i):u.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function GE({panel:e,isActive:t}){const n=y.useCallback(()=>Lj(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:n,children:i})}const HQ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function FQ(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=Xs(),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.kind==="conflicts"?e.id??"":e.templateId??""}`:null,d=e!==null&&t,p=y.useCallback(()=>{sQ(),LD()},[]);return y.useEffect(()=>{if(!d)return;const f=e;document.body.setAttribute("data-codex-reading","true");const g=document.querySelector(".operations-canvas"),_=document.querySelector(".operations-side-bar");g?.setAttribute("inert",""),_?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&UQ(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),g?.removeAttribute("inert"),_?.removeAttribute("inert");const S=f?.kind==="entry"?f.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(S?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${S}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[d]),y.useEffect(()=>{if(!d||!r.current||!o.current||!e)return;const f=e.kind,g=f==="drydock"?e.patchId:f==="conflicts"?e.id:f==="schema"?e.templateId:void 0;JL(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:g,theaterId:n,onRelatedClick:_=>{or({kind:"entry",entryId:_}),Sf()},onClose:p,onPatchOpen:_=>{or({kind:"drydock",patchId:_}),Sf()},onDecided:()=>{kp(),or({kind:"drydock",patchId:void 0}),Sf()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[d,c]),d?Va.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),u.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:p,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function UQ(e,t){if(!e)return;const n=[...e.querySelectorAll(HQ)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],r=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}const WQ=Qp().api,Pb=560,$b=360,Ov=new Set;function qQ({state:e,claimBootPanelMinimization:t}){const n=y.useRef(null),i=VN(),r=Vp(),o=XN(),c=hc(),[d,p]=y.useState([]),f=y.useMemo(()=>GQ(e).map(R=>R.id),[e.operations,e.activeTheaterId]),g=y.useRef(e);g.current=e,y.useEffect(()=>{$V(e.activeTheaterId)},[e.activeTheaterId]),y.useEffect(()=>{if(!e.activeTheaterId){p([]);return}ZE().then(p).catch(()=>{})},[e.activeTheaterId]),y.useEffect(()=>{const R={current:i},A={current:r},E=L=>{if(!YD()||!L.altKey||L.metaKey||L.ctrlKey)return;const $=document.activeElement;if($ instanceof HTMLElement&&$.matches("input, textarea, [contenteditable='true']")&&!$.closest(".xterm"))return;if(L.code==="KeyF"&&!L.shiftKey){L.preventDefault(),L.stopImmediatePropagation(),HV();return}if(L.shiftKey||L.key!=="ArrowLeft"&&L.key!=="ArrowRight")return;const q=g.current,X=tc(),D=RD(q.operations.filter(ce=>ce.theaterId===q.activeTheaterId),q.groups.filter(ce=>ce.theaterId===q.activeTheaterId),X.operationOrder,X.collapsedGroups,R.current===null?X.minimized:[]);if(L.preventDefault(),L.stopImmediatePropagation(),D.length===0)return;const V=R.current??g.current.activeOperationId,J=AD(D,V,L.key==="ArrowRight"?1:-1);if(J){if(R.current){Mi(J),Zu(J);return}if(A.current){Tu(J),Mi(J);return}X.minimized.includes(J)&&Tu(J),ih(J)}};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[r,i]),y.useEffect(()=>{for(const E of f)BV(E);if(!e.operationsHydrated||(PV(f),!e.activeTheaterId))return;const R=t(e.activeTheaterId);if(R===null)return;const A=g.current.pendingOperationFocus;IV(A?R.filter(E=>E!==A):R)},[t,f,e.activeTheaterId,e.operationsHydrated]),y.useEffect(()=>{const R=e.pendingOperationFocus;if(R===null)return;if(Yr()!==null){Zu(R),f_();return}if(xp()){Tu(R),Mi(R),f_();return}Xr();const A=KE(n.current);A&&cE(R,A),f_()},[e.pendingOperationFocus]);const _=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(R=>R.theaterId===e.activeTheaterId);const b=y.useCallback((R,A)=>c.plugins.find(L=>L.id===R)?.renderLaunchIcon?.(A)??null,[c.plugins]),S=y.useCallback((R,A,E)=>{if(!g.current.activeTheaterId)return;const L={...VE(E),zIndex:zo()};Dv(R,A,L,g.current.activeTheaterId,c.plugins)},[c.plugins]),w=y.useCallback((R,A)=>{if(!g.current.activeTheaterId)return;const E=VQ(n.current),L={...VE(E),zIndex:zo()};Dv(R,A,L,g.current.activeTheaterId,c.plugins)},[c.plugins]),x=y.useCallback((R,A,E)=>{g.current.activeTheaterId&&Dv(R,A,E,g.current.activeTheaterId,c.plugins)},[c.plugins]),C=y.useCallback(()=>{JN({x:0,y:0,zoom:1})},[]),O=y.useCallback(R=>{const A=g.current.operations.find(X=>X.id===R);if(!A)return;if(A.theaterId!==g.current.activeTheaterId){ih(R);return}const E=Yr();if(E!==null){Mi(R),E!==R&&Zu(R);return}if(xp()){Tu(R),Mi(R);return}const L=tc(),$=L.operations[R]??A.geometry??KQ(A);L.operations[R]||xb(R,$),Tu(R),Mi(R);const q=KE(n.current);q&&cE(R,q)},[]),P=y.useCallback(R=>{g.current.activeOperationId===R&&Mi(null),QN(R)},[]),z=y.useCallback((R,A)=>{bf(R,{accent:A}).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),T=y.useCallback((R,A)=>{x5(R,A).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),j=y.useCallback((R,A)=>{bf(R,{groupId:A}).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),M=y.useCallback((R,A,E)=>{jO({theaterId:R,name:A,color:"blue"}).then(L=>E?bf(E,{groupId:L.id}).then(()=>{}):void 0).then(()=>Promise.all([Xi(null).then(fs),bo().then(So)])).catch(()=>{})},[]),H=y.useCallback((R,A)=>{A&&d_(R,{color:A}).then(()=>bo()).then(So).catch(()=>{})},[]),F=y.useCallback((R,A)=>{d_(R,{name:A}).then(()=>bo()).then(So).catch(()=>{})},[]),ee=y.useCallback(R=>{const A=new Map(g.current.groups.map(L=>[L.id,L])),E=R.flatMap((L,$)=>{const q=A.get(L);return!q||q.order===$?[]:[d_(L,{order:$})]});E.length!==0&&Promise.allSettled(E).then(()=>bo()).then(So).catch(()=>{})},[]),ae=y.useCallback(R=>{IO(R).then(()=>Promise.all([Xi(null).then(fs),bo().then(So)])).catch(()=>{})},[]),K=y.useCallback(R=>{if(Ov.has(R))return;Ov.add(R);const A=g.current.operations.find(L=>L.id===R)?.pluginId,E=(A?c.plugins.find(L=>L.id===A):null)??null;YQ(R,E).finally(()=>Ov.delete(R))},[c.plugins]),B=y.useCallback(async R=>{j5();try{const A=await w5(R),E=await S5(A);I5(E)}catch(A){Wv(A instanceof Error?A.message:String(A))}},[]),N=y.useCallback(async R=>{const A=()=>Promise.all([Xi(null).then(fs),bo().then(So)]).then(()=>{}).catch(()=>{});try{await DO(R),cC(R),await A()}catch(E){if(E instanceof tn&&E.status===404){cC(R),await A();return}Wv(E instanceof Error?E.message:String(E))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(NY,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:o,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:d,canLaunch:_,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:b,onLaunchKind:w,onResetView:C,onClose:K,onMinimize:P,onFocus:O,onSetAccent:z,onRename:T,onSetGroupId:j,onCreateGroup:M,onSetGroupColor:H,onRenameGroup:F,onReorderGroups:ee,onUngroupAll:ae,onSelectTheater:CD,onAddTheater:B,onCancelAddTheater:TD,onForgetTheater:N}),u.jsx("div",{className:"operations-center-stage",ref:n,children:u.jsx($Z,{state:e,catalog:d,canLaunch:_,renderKindIcon:b,onLaunchKind:S,onLaunchAtGeometry:x,onClose:K,onFocus:O,onRename:T,onSetAccent:z})}),u.jsx($Q,{theaterId:e.activeTheaterId,api:WQ}),u.jsx(FQ,{})]})}function GQ(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(qv)}function KE(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function KQ(e){return e.geometry??{x:0,y:0,width:Pb,height:$b,zIndex:0}}function VQ(e){const t=tc(),n=e?.clientWidth??800,i=e?.clientHeight??600;return _h({x:n/2,y:i/2},t.viewport)}function VE(e){return{x:e.x-Pb/2,y:e.y-$b/2,width:Pb,height:$b}}async function Dv(e,t,n,i,r){const o=r.find(_=>_.id===e),d=Qp(()=>{Xi(null).then(fs).catch(()=>{})});let p=null;if(o?.launch?p=(await o.launch({theaterId:i,kind:t,geometry:n,operations:d.operations})).id:p=(await d.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Xi(null).then(fs).catch(()=>{}),!p)return;const f=LV()===i,g=nh().operations.some(_=>_.id===p);f&&g&&Yr()!==null?(Mi(p),Zu(p)):ih(p)}async function YQ(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Xi(null).then(fs).catch(()=>{})}const XQ=3e4;let _f=1e3,Ru=null,jv=null,Iv=!1;function sM(){Ru!==null&&(clearTimeout(Ru),Ru=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);ZQ(i.operation)&&xD(i.operation)}catch{}}),e.addEventListener("update:available",()=>{yh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{wL(JSON.parse(n.data))}catch{vE()}}),e.onopen=()=>{_f=1e3,yh()},e.onerror=()=>{e.close(),vE(),Ru=setTimeout(()=>{Ru=null,_f=Math.min(_f*2,XQ),Xi().then(fs).catch(()=>{}).finally(sM)},_f)}}function yh(){if(jv){Iv=!0;return}jv=TO(nh().activeTheaterId).then(fD).catch(()=>{}).finally(()=>{jv=null,Iv&&(Iv=!1,yh())})}function ZQ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const JQ=6e3;function QQ(){const e=Xs(),t=y.useRef(new Set),n=y.useRef(null),i=Ps(),r=hc(),o=l1(),c=LL(o.state?.language??"auto"),p=i.pathname.startsWith("/operations"),f=y.useCallback(g=>n.current===null||t.current.has(g)?null:(t.current.add(g),n.current),[]);return y.useEffect(()=>{const g=Qp(()=>{Xi().then(fs).catch(()=>{})}),_=r.plugins.map(b=>b.install?.(g)).filter(b=>typeof b=="function");return()=>{for(const b of _)b()}},[r.plugins]),y.useEffect(()=>{dD(p)},[p]),y.useEffect(()=>{const g=new AbortController;EO(g.signal).then(S=>{SD(S),lC()}).catch(S=>{g.signal.aborted||(vt({theaterError:S instanceof Error?S.message:String(S)}),lC())});const _=Date.now();Xi(null,g.signal).then(S=>{n.current=S.filter(w=>w.ts.createdAt<_).map(w=>w.id),wD(S)}).catch(()=>{}),bo(null,g.signal).then(So).catch(()=>{}),yh();const b=window.setTimeout(yh,JQ);return()=>{window.clearTimeout(b),g.abort()}},[]),y.useEffect(()=>(NL({locale:c}),bX),[c]),y.useEffect(()=>OX({getSideBarCollapsed:()=>Tb().collapsed,setSideBarCollapsed:a1,toggleOperationSearch:P5,toggleRailChrome:Q5}),[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(ZY,{operationsViewVisible:p}),u.jsx("main",{className:"console-route-content",children:u.jsxs(q4,{children:[u.jsx(Nl,{path:"/",element:u.jsx(u_,{to:"/operations",replace:!0})}),u.jsx(Nl,{path:"/operations",element:u.jsx(qQ,{state:e,claimBootPanelMinimization:f})}),u.jsx(Nl,{path:"/carrier-settings",element:u.jsx(u_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),u.jsx(Nl,{path:"/settings",element:u.jsx(ZX,{})}),u.jsx(Nl,{path:"*",element:u.jsx(u_,{to:"/operations",replace:!0})})]})}),u.jsx(oX,{state:e}),u.jsx(AX,{state:e}),u.jsx(sX,{state:e}),u.jsx(fX,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Hf,"react/jsx-runtime":u6,"@fleet-console/sdk/plugin/browser":N6,"@fleet-console/sdk/settings/browser":B6,"@fleet-console/sdk/operations/browser":v6,"@fleet-console/sdk/notifications/browser":$6,"@fleet-console/sdk/react/browser":H6};Vf("instrument");vD();try{const e=await EL();Vf(e.theme),Uv(e.uiFont),_X(e)}catch{}const eee=await XK();sM();const YE=document.querySelector("#app");YE&&K6.createRoot(YE).render(u.jsx(y.StrictMode,{children:u.jsx(mO,{basename:"/console",children:u.jsx(YK,{value:eee,children:u.jsx(QQ,{})})})}));export{aq as _,tee as a,zb as g,Zt as k,Yu as p};
|