@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
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
function FE(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 Ab(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vQ(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 qg={exports:{}},su={};var Ax;function W3(){if(Ax)return su;Ax=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 su.Fragment=t,su.jsx=n,su.jsxs=n,su}var Rx;function q3(){return Rx||(Rx=1,qg.exports=W3()),qg.exports}var u=q3();const G3=Ab(u),K3=FE({__proto__:null,default:G3},[u]);var Gg={exports:{}},at={};var Lx;function V3(){if(Lx)return at;Lx=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"),_=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function A(O,V,J){this.props=O,this.context=V,this.refs=k,this.updater=J||w}A.prototype.isReactComponent={},A.prototype.setState=function(O,V){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,V,"setState")},A.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function B(){}B.prototype=A.prototype;function z(O,V,J){this.props=O,this.context=V,this.refs=k,this.updater=J||w}var E=z.prototype=new B;E.constructor=z,x(E,A.prototype),E.isPureReactComponent=!0;var M=Array.isArray;function j(){}var H={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Q(O,V,J){var he=J.ref;return{$$typeof:e,type:O,key:V,ref:he!==void 0?he:null,props:J}}function oe(O,V){return Q(O.type,V,O.props)}function Y(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function $(O){var V={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(J){return V[J]})}var L=/\/+/g;function P(O,V){return typeof O=="object"&&O!==null&&O.key!=null?$(""+O.key):V.toString(36)}function D(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(j,j):(O.status="pending",O.then(function(V){O.status==="pending"&&(O.status="fulfilled",O.value=V)},function(V){O.status==="pending"&&(O.status="rejected",O.reason=V)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function T(O,V,J,he,fe){var le=typeof O;(le==="undefined"||le==="boolean")&&(O=null);var Te=!1;if(O===null)Te=!0;else switch(le){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(O.$$typeof){case e:case t:Te=!0;break;case _:return Te=O._init,T(Te(O._payload),V,J,he,fe)}}if(Te)return fe=fe(O),Te=he===""?"."+P(O,0):he,M(fe)?(J="",Te!=null&&(J=Te.replace(L,"$&/")+"/"),T(fe,V,J,"",function(dt){return dt})):fe!=null&&(Y(fe)&&(fe=oe(fe,J+(fe.key==null||O&&O.key===fe.key?"":(""+fe.key).replace(L,"$&/")+"/")+Te)),V.push(fe)),1;Te=0;var Re=he===""?".":he+":";if(M(O))for(var $e=0;$e<O.length;$e++)he=O[$e],le=Re+P(he,$e),Te+=T(he,V,J,le,fe);else if($e=S(O),typeof $e=="function")for(O=$e.call(O),$e=0;!(he=O.next()).done;)he=he.value,le=Re+P(he,$e++),Te+=T(he,V,J,le,fe);else if(le==="object"){if(typeof O.then=="function")return T(D(O),V,J,he,fe);throw V=String(O),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Te}function R(O,V,J){if(O==null)return O;var he=[],fe=0;return T(O,he,"","",function(le){return V.call(J,le,fe++)}),he}function N(O){if(O._status===-1){var V=O._result;V=V(),V.then(function(J){(O._status===0||O._status===-1)&&(O._status=1,O._result=J)},function(J){(O._status===0||O._status===-1)&&(O._status=2,O._result=J)}),O._status===-1&&(O._status=0,O._result=V)}if(O._status===1)return O._result.default;throw O._result}var F=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},W={map:R,forEach:function(O,V,J){R(O,function(){V.apply(this,arguments)},J)},count:function(O){var V=0;return R(O,function(){V++}),V},toArray:function(O){return R(O,function(V){return V})||[]},only:function(O){if(!Y(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return at.Activity=g,at.Children=W,at.Component=A,at.Fragment=n,at.Profiler=r,at.PureComponent=z,at.StrictMode=i,at.Suspense=p,at.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,at.__COMPILER_RUNTIME={__proto__:null,c:function(O){return H.H.useMemoCache(O)}},at.cache=function(O){return function(){return O.apply(null,arguments)}},at.cacheSignal=function(){return null},at.cloneElement=function(O,V,J){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var he=x({},O.props),fe=O.key;if(V!=null)for(le in V.key!==void 0&&(fe=""+V.key),V)!U.call(V,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&V.ref===void 0||(he[le]=V[le]);var le=arguments.length-2;if(le===1)he.children=J;else if(1<le){for(var Te=Array(le),Re=0;Re<le;Re++)Te[Re]=arguments[Re+2];he.children=Te}return Q(O.type,fe,he)},at.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:o,_context:O},O},at.createElement=function(O,V,J){var he,fe={},le=null;if(V!=null)for(he in V.key!==void 0&&(le=""+V.key),V)U.call(V,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(fe[he]=V[he]);var Te=arguments.length-2;if(Te===1)fe.children=J;else if(1<Te){for(var Re=Array(Te),$e=0;$e<Te;$e++)Re[$e]=arguments[$e+2];fe.children=Re}if(O&&O.defaultProps)for(he in Te=O.defaultProps,Te)fe[he]===void 0&&(fe[he]=Te[he]);return Q(O,le,fe)},at.createRef=function(){return{current:null}},at.forwardRef=function(O){return{$$typeof:d,render:O}},at.isValidElement=Y,at.lazy=function(O){return{$$typeof:_,_payload:{_status:-1,_result:O},_init:N}},at.memo=function(O,V){return{$$typeof:f,type:O,compare:V===void 0?null:V}},at.startTransition=function(O){var V=H.T,J={};H.T=J;try{var he=O(),fe=H.S;fe!==null&&fe(J,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(j,F)}catch(le){F(le)}finally{V!==null&&J.types!==null&&(V.types=J.types),H.T=V}},at.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},at.use=function(O){return H.H.use(O)},at.useActionState=function(O,V,J){return H.H.useActionState(O,V,J)},at.useCallback=function(O,V){return H.H.useCallback(O,V)},at.useContext=function(O){return H.H.useContext(O)},at.useDebugValue=function(){},at.useDeferredValue=function(O,V){return H.H.useDeferredValue(O,V)},at.useEffect=function(O,V){return H.H.useEffect(O,V)},at.useEffectEvent=function(O){return H.H.useEffectEvent(O)},at.useId=function(){return H.H.useId()},at.useImperativeHandle=function(O,V,J){return H.H.useImperativeHandle(O,V,J)},at.useInsertionEffect=function(O,V){return H.H.useInsertionEffect(O,V)},at.useLayoutEffect=function(O,V){return H.H.useLayoutEffect(O,V)},at.useMemo=function(O,V){return H.H.useMemo(O,V)},at.useOptimistic=function(O,V){return H.H.useOptimistic(O,V)},at.useReducer=function(O,V,J){return H.H.useReducer(O,V,J)},at.useRef=function(O){return H.H.useRef(O)},at.useState=function(O){return H.H.useState(O)},at.useSyncExternalStore=function(O,V,J){return H.H.useSyncExternalStore(O,V,J)},at.useTransition=function(){return H.H.useTransition()},at.version="19.2.7",at}var Nx;function Rb(){return Nx||(Nx=1,Gg.exports=V3()),Gg.exports}var y=Rb();const Y3=Ab(y),jf=FE({__proto__:null,default:Y3},[y]),X3="fc-operation-body";let Ci=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function UE(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Ci(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(J3).filter(i=>i!==null):[]}function If(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)||WE(t))throw new Ci(500,"Invalid operation response");return t}function WE(e){return Ev(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function Z3({children:e,className:t}){return u.jsx("div",{className:e6(X3,t),children:e})}function J3(e){if(!qE(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(Q3).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function Q3(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 Ev(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Ev(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Ev(i,t))}function e6(...e){return e.filter(t=>!!t).join(" ")}const t6=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Ci,OperationBody:Z3,assertOperationNode:If,fetchOperationCatalog:UE,hasForbiddenBrowserPayloadKey:WE},Symbol.toStringTag,{value:"Module"}));function n6(e){return e}function i6(e){return e}function GE(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(Kg(n,i),r).then(c6),subscribe:(n,i,r)=>{const o=new EventSource(Kg(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(Kg(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!c.ok)throw new Ci(c.status,`Terminal ticket request failed: ${c.status}`);const d=await c.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new Ci(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 Ci(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return If(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 Ci(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return If(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Ci(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>h6(n,i),write:(n,i)=>d6(n,i)},settings:{read:async n=>{const i=await fetch(Mx(n));if(!i.ok)throw new Ci(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(Mx(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Ci(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function KE(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 Ci(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(If):[])},[]);return y.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function r6(e,t){return y.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function a6(e,t){return y.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function o6(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 l6(e,t){return y.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function c6(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Ci(e.status,`Plugin request failed: ${e.status}`,t)}return e}function Kg(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Ci(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Ci(400,"Invalid plugin path");return`/plugins/${e}${n}`}const u6=/^[a-z0-9][a-z0-9._-]*$/;function Mx(e){if(!u6.test(e))throw new Ci(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function h6(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 d6(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const f6=Object.freeze(Object.defineProperty({__proto__:null,React:jf,createClientCapabilities:GE,defineOperationKind:i6,definePlugin:n6,useOperationStatus:l6,useOperations:s6,usePluginApi:r6,usePluginSettings:a6,usePluginStorage:o6,useStoreSnapshot:KE},Symbol.toStringTag,{value:"Module"}));function p6(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 g6({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 _6({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 v6({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 y6({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:y6,SettingsRow:g6,SettingsSelect:v6,SettingsToggle:_6,defineSettingsSection:p6},Symbol.toStringTag,{value:"Module"}));function S6(e){return e}const w6=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:S6},Symbol.toStringTag,{value:"Module"})),x6=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Bf 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??x6:this.props.children}}const C6=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Bf,React:jf,default:jf},Symbol.toStringTag,{value:"Module"}));var Vg={exports:{}},ru={},Yg={exports:{}},Xg={};var Ox;function k6(){return Ox||(Ox=1,(function(e){function t(T,R){var N=T.length;T.push(R);e:for(;0<N;){var F=N-1>>>1,W=T[F];if(0<r(W,R))T[F]=R,T[N]=W,N=F;else break e}}function n(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var R=T[0],N=T.pop();if(N!==R){T[0]=N;e:for(var F=0,W=T.length,O=W>>>1;F<O;){var V=2*(F+1)-1,J=T[V],he=V+1,fe=T[he];if(0>r(J,N))he<W&&0>r(fe,J)?(T[F]=fe,T[he]=N,F=he):(T[F]=J,T[V]=N,F=V);else if(he<W&&0>r(fe,N))T[F]=fe,T[he]=N,F=he;else break e}}return R}function r(T,R){var N=T.sortIndex-R.sortIndex;return N!==0?N:T.id-R.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=[],_=1,g=null,b=3,S=!1,w=!1,x=!1,k=!1,A=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function E(T){for(var R=n(f);R!==null;){if(R.callback===null)i(f);else if(R.startTime<=T)i(f),R.sortIndex=R.expirationTime,t(p,R);else break;R=n(f)}}function M(T){if(x=!1,E(T),!w)if(n(p)!==null)w=!0,j||(j=!0,$());else{var R=n(f);R!==null&&D(M,R.startTime-T)}}var j=!1,H=-1,U=5,Q=-1;function oe(){return k?!0:!(e.unstable_now()-Q<U)}function Y(){if(k=!1,j){var T=e.unstable_now();Q=T;var R=!0;try{e:{w=!1,x&&(x=!1,B(H),H=-1),S=!0;var N=b;try{t:{for(E(T),g=n(p);g!==null&&!(g.expirationTime>T&&oe());){var F=g.callback;if(typeof F=="function"){g.callback=null,b=g.priorityLevel;var W=F(g.expirationTime<=T);if(T=e.unstable_now(),typeof W=="function"){g.callback=W,E(T),R=!0;break t}g===n(p)&&i(p),E(T)}else i(p);g=n(p)}if(g!==null)R=!0;else{var O=n(f);O!==null&&D(M,O.startTime-T),R=!1}}break e}finally{g=null,b=N,S=!1}R=void 0}}finally{R?$():j=!1}}}var $;if(typeof z=="function")$=function(){z(Y)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,P=L.port2;L.port1.onmessage=Y,$=function(){P.postMessage(null)}}else $=function(){A(Y,0)};function D(T,R){H=A(function(){T(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(T){switch(b){case 1:case 2:case 3:var R=3;break;default:R=b}var N=b;b=R;try{return T()}finally{b=N}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(T,R){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var N=b;b=T;try{return R()}finally{b=N}},e.unstable_scheduleCallback=function(T,R,N){var F=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?F+N:F):N=F,T){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=N+W,T={id:_++,callback:R,priorityLevel:T,startTime:N,expirationTime:W,sortIndex:-1},N>F?(T.sortIndex=N,t(f,T),n(p)===null&&T===n(f)&&(x?(B(H),H=-1):x=!0,D(M,N-F))):(T.sortIndex=W,t(p,T),w||S||(w=!0,j||(j=!0,$()))),T},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(T){var R=b;return function(){var N=b;b=R;try{return T.apply(this,arguments)}finally{b=N}}}})(Xg)),Xg}var Dx;function E6(){return Dx||(Dx=1,Yg.exports=k6()),Yg.exports}var Zg={exports:{}},wi={};var jx;function T6(){if(jx)return wi;jx=1;var e=Rb();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)f+="&args[]="+encodeURIComponent(arguments[_])}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,_){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:p,containerInfo:f,implementation:_}}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 wi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,wi.createPortal=function(p,f){var _=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,_)},wi.flushSync=function(p){var f=c.T,_=i.p;try{if(c.T=null,i.p=2,p)return p()}finally{c.T=f,i.p=_,i.d.f()}},wi.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))},wi.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},wi.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var _=f.as,g=d(_,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;_==="style"?i.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):_==="script"&&i.d.X(p,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},wi.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var _=d(f.as,f.crossOrigin);i.d.M(p,{crossOrigin:_,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)},wi.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var _=f.as,g=d(_,f.crossOrigin);i.d.L(p,_,{crossOrigin:g,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})}},wi.preloadModule=function(p,f){if(typeof p=="string")if(f){var _=d(f.as,f.crossOrigin);i.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:_,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(p)},wi.requestFormReset=function(p){i.d.r(p)},wi.unstable_batchedUpdates=function(p,f){return p(f)},wi.useFormState=function(p,f,_){return c.H.useFormState(p,f,_)},wi.useFormStatus=function(){return c.H.useHostTransitionStatus()},wi.version="19.2.7",wi}var Ix;function VE(){if(Ix)return Zg.exports;Ix=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(),Zg.exports=T6(),Zg.exports}var Bx;function A6(){if(Bx)return ru;Bx=1;var e=E6(),t=Rb(),n=VE();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 C=!1,I=m.child;I;){if(I===l){C=!0,l=m,h=v;break}if(I===h){C=!0,h=m,l=v;break}I=I.sibling}if(!C){for(I=v.child;I;){if(I===l){C=!0,l=v,h=m;break}if(I===h){C=!0,h=v,l=m;break}I=I.sibling}if(!C)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 _(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=_(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),z=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function $(s){return s===null||typeof s!="object"?null:(s=Y&&s[Y]||s["@@iterator"],typeof s=="function"?s:null)}var L=Symbol.for("react.client.reference");function P(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===L?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case A:return"Profiler";case k:return"StrictMode";case M:return"Suspense";case j:return"SuspenseList";case Q:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case z:return s.displayName||"Context";case B:return(s._context.displayName||"Context")+".Consumer";case E: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:P(s.type)||"Memo";case U:a=s._payload,s=s._init;try{return P(s(a))}catch{}}return null}var D=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N={pending:!1,data:null,method:null,action:null},F=[],W=-1;function O(s){return{current:s}}function V(s){0>W||(s.current=F[W],F[W]=null,W--)}function J(s,a){W++,F[W]=s.current,s.current=a}var he=O(null),fe=O(null),le=O(null),Te=O(null);function Re(s,a){switch(J(le,a),J(fe,s),J(he,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Zw(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Zw(a),s=Jw(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}V(he),J(he,s)}function $e(){V(he),V(fe),V(le)}function dt(s){s.memoizedState!==null&&J(Te,s);var a=he.current,l=Jw(a,s.type);a!==l&&(J(fe,s),J(he,l))}function xe(s){fe.current===s&&(V(he),V(fe)),Te.current===s&&(V(Te),eu._currentValue=N)}var Se,Ee;function Ke(s){if(Se===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Se=a&&a[1]||"",Ee=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Se+s+Ee}var de=!1;function Ge(s,a){if(!s||de)return"";de=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(ce){var ae=ce}Reflect.construct(s,[],_e)}else{try{_e.call()}catch(ce){ae=ce}s.call(_e.prototype)}}else{try{throw Error()}catch(ce){ae=ce}(_e=s())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(ce){if(ce&&ae&&typeof ce.stack=="string")return[ce.stack,ae.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(),C=v[0],I=v[1];if(C&&I){var K=C.split(`
|
|
4
|
+
`),ne=I.split(`
|
|
5
|
+
`);for(m=h=0;h<K.length&&!K[h].includes("DetermineComponentFrameRoot");)h++;for(;m<ne.length&&!ne[m].includes("DetermineComponentFrameRoot");)m++;if(h===K.length||m===ne.length)for(h=K.length-1,m=ne.length-1;1<=h&&0<=m&&K[h]!==ne[m];)m--;for(;1<=h&&0<=m;h--,m--)if(K[h]!==ne[m]){if(h!==1||m!==1)do if(h--,m--,0>m||K[h]!==ne[m]){var me=`
|
|
6
|
+
`+K[h].replace(" at new "," at ");return s.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",s.displayName)),me}while(1<=h&&0<=m);break}}}finally{de=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ke(l):""}function Le(s,a){switch(s.tag){case 26:case 27:case 5:return Ke(s.type);case 16:return Ke("Lazy");case 13:return s.child!==a&&a!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return Ge(s.type,!1);case 11:return Ge(s.type.render,!1);case 1:return Ge(s.type,!0);case 31:return Ke("Activity");default:return""}}function et(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,Tt=e.unstable_scheduleCallback,Un=e.unstable_cancelCallback,we=e.unstable_shouldYield,qe=e.unstable_requestPaint,it=e.unstable_now,Ei=e.unstable_getCurrentPriorityLevel,vn=e.unstable_ImmediatePriority,cn=e.unstable_UserBlockingPriority,bi=e.unstable_NormalPriority,zs=e.unstable_LowPriority,_s=e.unstable_IdlePriority,Qi=e.log,Zn=e.unstable_setDisableYieldValue,An=null,ie=null;function ue(s){if(typeof Qi=="function"&&Zn(s),ie&&typeof ie.setStrictMode=="function")try{ie.setStrictMode(An,s)}catch{}}var Be=Math.clz32?Math.clz32:At,Me=Math.log,Fe=Math.LN2;function At(s){return s>>>=0,s===0?32:31-(Me(s)/Fe|0)|0}var Ti=256,Rt=262144,Mn=4194304;function Ft(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 G(s,a,l){var h=s.pendingLanes;if(h===0)return 0;var m=0,v=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var I=h&134217727;return I!==0?(h=I&~v,h!==0?m=Ft(h):(C&=I,C!==0?m=Ft(C):l||(l=I&~s,l!==0&&(m=Ft(l))))):(I=h&~v,I!==0?m=Ft(I):C!==0?m=Ft(C):l||(l=h&~s,l!==0&&(m=Ft(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 pe(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function ye(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ze(){var s=Mn;return Mn<<=1,(Mn&62914560)===0&&(Mn=4194304),s}function $t(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function Lt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ie(s,a,l,h,m,v){var C=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,K=s.expirationTimes,ne=s.hiddenUpdates;for(l=C&~l;0<l;){var me=31-Be(l),_e=1<<me;I[me]=0,K[me]=-1;var ae=ne[me];if(ae!==null)for(ne[me]=null,me=0;me<ae.length;me++){var ce=ae[me];ce!==null&&(ce.lane&=-536870913)}l&=~_e}h!==0&&Ne(s,h,0),v!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=v&~(C&~a))}function Ne(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-Be(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-Be(l),m=1<<h;m&a|s[h]&a&&(s[h]|=a),l&=~m}}function tn(s,a){var l=a&-a;return l=(l&42)!==0?1:gt(l),(l&(s.suspendedLanes|a))!==0?0:l}function gt(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 Wn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Hs(){var s=R.p;return s!==0?s:(s=window.event,s===void 0?32:Sx(s.type))}function es(s,a){var l=R.p;try{return R.p=s,a()}finally{R.p=l}}var ui=Math.random().toString(36).slice(2),Ut="__reactFiber$"+ui,re="__reactProps$"+ui,ot="__reactContainer$"+ui,Wt="__reactEvents$"+ui,vt="__reactListeners$"+ui,tt="__reactHandles$"+ui,yn="__reactResources$"+ui,un="__reactMarker$"+ui;function Oe(s){delete s[Ut],delete s[re],delete s[Wt],delete s[vt],delete s[tt]}function q(s){var a=s[Ut];if(a)return a;for(var l=s.parentNode;l;){if(a=l[ot]||l[Ut]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=rx(s);s!==null;){if(l=s[Ut])return l;s=rx(s)}return a}s=l,l=s.parentNode}return null}function se(s){if(s=s[Ut]||s[ot]){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 st(s){var a=s[yn];return a||(a=s[yn]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function rt(s){s[un]=!0}var jt=new Set,Zt={};function Et(s,a){be(s,a),be(s+"Capture",a)}function be(s,a){for(Zt[s]=a,s=0;s<a.length;s++)jt.add(a[s])}var He=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]*$"),je={},St={};function Qt(s){return Bt.call(St,s)?!0:Bt.call(je,s)?!1:He.test(s)?St[s]=!0:(je[s]=!0,!1)}function qn(s,a,l){if(Qt(a))if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+l)}}function Ai(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 Si(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 qt(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 wh(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(C){l=""+C,v.call(this,C)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return l},setValue:function(C){l=""+C},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Uo(s){if(!s._valueTracker){var a=ts(s)?"checked":"value";s._valueTracker=wh(s,a,""+s[a])}}function fc(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 Wp=/[\n"\\]/g;function zi(s){return s.replace(Wp,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function pc(s,a,l,h,m,v,C,I){s.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.type=C:s.removeAttribute("type"),a!=null?C==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+qt(a)):s.value!==""+qt(a)&&(s.value=""+qt(a)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),a!=null?qo(s,C,qt(a)):l!=null?qo(s,C,qt(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=""+qt(I):s.removeAttribute("name")}function Ja(s,a,l,h,m,v,C,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?""+qt(l):"",a=a!=null?""+qt(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,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),Uo(s)}function qo(s,a,l){a==="number"&&Wo(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function hi(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=""+qt(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 xh(s,a,l){if(a!=null&&(a=""+qt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+qt(l):""}function Go(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(D(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=qt(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),Uo(s)}function Qe(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Ch=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 On(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||Ch.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Pt(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&&On(s,m,h)}else for(var v in a)a.hasOwnProperty(v)&&On(s,v,a[v])}function ta(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 Sr=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"]]),mc=/^[\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 na(s){return mc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function ke(){}var Ue=null;function lt(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var wt=null,pn=null;function vs(s){var a=se(s);if(a&&(s=a.stateNode)){var l=s[re]||null;e:switch(s=a.stateNode,a.type){case"input":if(pc(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[re]||null;if(!m)throw Error(i(90));pc(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&&fc(h)}break e;case"textarea":xh(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&hi(s,!!l.multiple,a,!1)}}}var gc=!1;function kh(s,a,l){if(gc)return s(a,l);gc=!0;try{var h=s(a);return h}finally{if(gc=!1,(wt!==null||pn!==null)&&(dd(),wt&&(a=wt,s=pn,pn=wt=null,vs(a),s)))for(a=0;a<s.length;a++)vs(s[a])}}function _c(s,a){var l=s.stateNode;if(l===null)return null;var h=l[re]||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 wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qp=!1;if(wr)try{var vc={};Object.defineProperty(vc,"passive",{get:function(){qp=!0}}),window.addEventListener("test",vc,vc),window.removeEventListener("test",vc,vc)}catch{qp=!1}var ia=null,Gp=null,Eh=null;function J0(){if(Eh)return Eh;var s,a=Gp,l=a.length,h,m="value"in ia?ia.value:ia.textContent,v=m.length;for(s=0;s<l&&a[s]===m[s];s++);var C=l-s;for(h=1;h<=C&&a[l-h]===m[v-h];h++);return Eh=m.slice(s,1<h?1-h:void 0)}function Th(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 Ah(){return!0}function Q0(){return!1}function Hi(s){function a(l,h,m,v,C){this._reactName=l,this._targetInst=m,this.type=h,this.nativeEvent=v,this.target=C,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)?Ah:Q0,this.isPropagationStopped=Q0,this}return g(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=Ah)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ah)},persist:function(){},isPersistent:Ah}),a}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rh=Hi(Qa),yc=g({},Qa,{view:0,detail:0}),FN=Hi(yc),Kp,Vp,bc,Lh=g({},yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xp,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!==bc&&(bc&&s.type==="mousemove"?(Kp=s.screenX-bc.screenX,Vp=s.screenY-bc.screenY):Vp=Kp=0,bc=s),Kp)},movementY:function(s){return"movementY"in s?s.movementY:Vp}}),e1=Hi(Lh),UN=g({},Lh,{dataTransfer:0}),WN=Hi(UN),qN=g({},yc,{relatedTarget:0}),Yp=Hi(qN),GN=g({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),KN=Hi(GN),VN=g({},Qa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),YN=Hi(VN),XN=g({},Qa,{data:0}),t1=Hi(XN),ZN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JN={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"},QN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eM(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=QN[s])?!!a[s]:!1}function Xp(){return eM}var tM=g({},yc,{key:function(s){if(s.key){var a=ZN[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Th(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?JN[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xp,charCode:function(s){return s.type==="keypress"?Th(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Th(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),nM=Hi(tM),iM=g({},Lh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),n1=Hi(iM),sM=g({},yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xp}),rM=Hi(sM),aM=g({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),oM=Hi(aM),lM=g({},Lh,{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}),cM=Hi(lM),uM=g({},Qa,{newState:0,oldState:0}),hM=Hi(uM),dM=[9,13,27,32],Zp=wr&&"CompositionEvent"in window,Sc=null;wr&&"documentMode"in document&&(Sc=document.documentMode);var fM=wr&&"TextEvent"in window&&!Sc,i1=wr&&(!Zp||Sc&&8<Sc&&11>=Sc),s1=" ",r1=!1;function a1(s,a){switch(s){case"keyup":return dM.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function o1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ko=!1;function pM(s,a){switch(s){case"compositionend":return o1(a);case"keypress":return a.which!==32?null:(r1=!0,s1);case"textInput":return s=a.data,s===s1&&r1?null:s;default:return null}}function mM(s,a){if(Ko)return s==="compositionend"||!Zp&&a1(s,a)?(s=J0(),Eh=Gp=ia=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 i1&&a.locale!=="ko"?null:a.data;default:return null}}var gM={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 l1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!gM[s.type]:a==="textarea"}function c1(s,a,l,h){wt?pn?pn.push(h):pn=[h]:wt=h,a=yd(a,"onChange"),0<a.length&&(l=new Rh("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var wc=null,xc=null;function _M(s){qw(s,0)}function Nh(s){var a=Ae(s);if(fc(a))return s}function u1(s,a){if(s==="change")return a}var h1=!1;if(wr){var Jp;if(wr){var Qp="oninput"in document;if(!Qp){var d1=document.createElement("div");d1.setAttribute("oninput","return;"),Qp=typeof d1.oninput=="function"}Jp=Qp}else Jp=!1;h1=Jp&&(!document.documentMode||9<document.documentMode)}function f1(){wc&&(wc.detachEvent("onpropertychange",p1),xc=wc=null)}function p1(s){if(s.propertyName==="value"&&Nh(xc)){var a=[];c1(a,xc,s,lt(s)),kh(_M,a)}}function vM(s,a,l){s==="focusin"?(f1(),wc=a,xc=l,wc.attachEvent("onpropertychange",p1)):s==="focusout"&&f1()}function yM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Nh(xc)}function bM(s,a){if(s==="click")return Nh(a)}function SM(s,a){if(s==="input"||s==="change")return Nh(a)}function wM(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ns=typeof Object.is=="function"?Object.is:wM;function Cc(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 m1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function g1(s,a){var l=m1(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=m1(l)}}function _1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?_1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function v1(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 em(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 xM=wr&&"documentMode"in document&&11>=document.documentMode,Vo=null,tm=null,kc=null,nm=!1;function y1(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;nm||Vo==null||Vo!==Wo(h)||(h=Vo,"selectionStart"in h&&em(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}),kc&&Cc(kc,h)||(kc=h,h=yd(tm,"onSelect"),0<h.length&&(a=new Rh("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")},im={},b1={};wr&&(b1=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(im[s])return im[s];if(!Yo[s])return s;var a=Yo[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in b1)return im[s]=a[l];return s}var S1=to("animationend"),w1=to("animationiteration"),x1=to("animationstart"),CM=to("transitionrun"),kM=to("transitionstart"),EM=to("transitioncancel"),C1=to("transitionend"),k1=new Map,sm="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(" ");sm.push("scrollEnd");function Fs(s,a){k1.set(s,a),Et(a,[s])}var Mh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},ys=[],Xo=0,rm=0;function Oh(){for(var s=Xo,a=rm=Xo=0;a<s;){var l=ys[a];ys[a++]=null;var h=ys[a];ys[a++]=null;var m=ys[a];ys[a++]=null;var v=ys[a];if(ys[a++]=null,h!==null&&m!==null){var C=h.pending;C===null?m.next=m:(m.next=C.next,C.next=m),h.pending=m}v!==0&&E1(l,m,v)}}function Dh(s,a,l,h){ys[Xo++]=s,ys[Xo++]=a,ys[Xo++]=l,ys[Xo++]=h,rm|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function am(s,a,l,h){return Dh(s,a,l,h),jh(s)}function no(s,a){return Dh(s,null,null,a),jh(s)}function E1(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-Be(l),s=v.hiddenUpdates,h=s[m],h===null?s[m]=[a]:h.push(a),a.lane=l|536870912),v):null}function jh(s){if(50<Kc)throw Kc=0,mg=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 TM(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 TM(s,a,l,h)}function om(s){return s=s.prototype,!(!s||!s.isReactComponent)}function xr(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 T1(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 Ih(s,a,l,h,m,v){var C=0;if(h=s,typeof s=="function")om(s)&&(C=1);else if(typeof s=="string")C=M3(s,l,he.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Q:return s=is(31,l,a,m),s.elementType=Q,s.lanes=v,s;case x:return io(l.children,m,v,a);case k:C=8,m|=24;break;case A:return s=is(12,l,a,m|2),s.elementType=A,s.lanes=v,s;case M:return s=is(13,l,a,m),s.elementType=M,s.lanes=v,s;case j:return s=is(19,l,a,m),s.elementType=j,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case z:C=10;break e;case B:C=9;break e;case E:C=11;break e;case H:C=14;break e;case U:C=16,h=null;break e}C=29,l=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=is(C,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 lm(s,a,l){return s=is(6,s,null,a),s.lanes=l,s}function A1(s){var a=is(18,null,null,0);return a.stateNode=s,a}function cm(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 R1=new WeakMap;function bs(s,a){if(typeof s=="object"&&s!==null){var l=R1.get(s);return l!==void 0?l:(a={value:s,source:a,stack:et(a)},R1.set(s,a),a)}return{value:s,source:a,stack:et(a)}}var Jo=[],Qo=0,Bh=null,Ec=0,Ss=[],ws=0,sa=null,nr=1,ir="";function Cr(s,a){Jo[Qo++]=Ec,Jo[Qo++]=Bh,Bh=s,Ec=a}function L1(s,a,l){Ss[ws++]=nr,Ss[ws++]=ir,Ss[ws++]=sa,sa=s;var h=nr;s=ir;var m=32-Be(h)-1;h&=~(1<<m),l+=1;var v=32-Be(a)+m;if(30<v){var C=m-m%5;v=(h&(1<<C)-1).toString(32),h>>=C,m-=C,nr=1<<32-Be(a)+m|l<<m|h,ir=v+s}else nr=1<<v|l<<m|h,ir=s}function um(s){s.return!==null&&(Cr(s,1),L1(s,1,0))}function hm(s){for(;s===Bh;)Bh=Jo[--Qo],Jo[Qo]=null,Ec=Jo[--Qo],Jo[Qo]=null;for(;s===sa;)sa=Ss[--ws],Ss[ws]=null,ir=Ss[--ws],Ss[ws]=null,nr=Ss[--ws],Ss[ws]=null}function N1(s,a){Ss[ws++]=nr,Ss[ws++]=ir,Ss[ws++]=sa,nr=a.id,ir=a.overflow,sa=s}var di=null,nn=null,kt=!1,ra=null,xs=!1,dm=Error(i(519));function aa(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tc(bs(a,s)),dm}function M1(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[Ut]=s,a[re]=h,l){case"dialog":bt("cancel",a),bt("close",a);break;case"iframe":case"object":case"embed":bt("load",a);break;case"video":case"audio":for(l=0;l<Yc.length;l++)bt(Yc[l],a);break;case"source":bt("error",a);break;case"img":case"image":case"link":bt("error",a),bt("load",a);break;case"details":bt("toggle",a);break;case"input":bt("invalid",a),Ja(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":bt("invalid",a);break;case"textarea":bt("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||Yw(a.textContent,l)?(h.popover!=null&&(bt("beforetoggle",a),bt("toggle",a)),h.onScroll!=null&&bt("scroll",a),h.onScrollEnd!=null&&bt("scrollend",a),h.onClick!=null&&(a.onclick=ke),a=!0):a=!1,a||aa(s,!0)}function O1(s){for(di=s.return;di;)switch(di.tag){case 5:case 31:case 13:xs=!1;return;case 27:case 3:xs=!0;return;default:di=di.return}}function el(s){if(s!==di)return!1;if(!kt)return O1(s),kt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Lg(s.type,s.memoizedProps)),l=!l),l&&nn&&aa(s),O1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));nn=sx(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));nn=sx(s)}else a===27?(a=nn,ba(s.type)?(s=jg,jg=null,nn=s):nn=a):nn=di?ks(s.stateNode.nextSibling):null;return!0}function so(){nn=di=null,kt=!1}function fm(){var s=ra;return s!==null&&(qi===null?qi=s:qi.push.apply(qi,s),ra=null),s}function Tc(s){ra===null?ra=[s]:ra.push(s)}var pm=O(null),ro=null,kr=null;function oa(s,a,l){J(pm,a._currentValue),a._currentValue=l}function Er(s){s._currentValue=pm.current,V(pm)}function mm(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 gm(s,a,l,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var v=m.dependencies;if(v!==null){var C=m.child;v=v.firstContext;e:for(;v!==null;){var I=v;v=m;for(var K=0;K<a.length;K++)if(I.context===a[K]){v.lanes|=l,I=v.alternate,I!==null&&(I.lanes|=l),mm(v.return,l,s),h||(C=null);break e}v=I.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(i(341));C.lanes|=l,v=C.alternate,v!==null&&(v.lanes|=l),mm(C,l,s),C=null}else C=m.child;if(C!==null)C.return=m;else for(C=m;C!==null;){if(C===s){C=null;break}if(m=C.sibling,m!==null){m.return=C.return,C=m;break}C=C.return}m=C}}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 C=m.alternate;if(C===null)throw Error(i(387));if(C=C.memoizedProps,C!==null){var I=m.type;ns(m.pendingProps.value,C.value)||(s!==null?s.push(I):s=[I])}}else if(m===Te.current){if(C=m.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(eu):s=[eu])}m=m.return}s!==null&&gm(a,s,l,h),a.flags|=262144}function $h(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,kr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function fi(s){return D1(ro,s)}function Ph(s,a){return ro===null&&ao(s),D1(s,a)}function D1(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},kr===null){if(s===null)throw Error(i(308));kr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else kr=kr.next=a;return l}var AM=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()})}},RM=e.unstable_scheduleCallback,LM=e.unstable_NormalPriority,Dn={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _m(){return{controller:new AM,data:new Map,refCount:0}}function Ac(s){s.refCount--,s.refCount===0&&RM(LM,function(){s.controller.abort()})}var Rc=null,vm=0,nl=0,il=null;function NM(s,a){if(Rc===null){var l=Rc=[];vm=0,nl=Sg(),il={status:"pending",value:void 0,then:function(h){l.push(h)}}}return vm++,a.then(j1,j1),a}function j1(){if(--vm===0&&Rc!==null){il!==null&&(il.status="fulfilled");var s=Rc;Rc=null,nl=0,il=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function MM(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 I1=T.S;T.S=function(s,a){yw=it(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&NM(s,a),I1!==null&&I1(s,a)};var oo=O(null);function ym(){var s=oo.current;return s!==null?s:Jt.pooledCache}function zh(s,a){a===null?J(oo,oo.current):J(oo,a.pool)}function B1(){var s=ym();return s===null?null:{parent:Dn._currentValue,pool:s}}var sl=Error(i(460)),bm=Error(i(474)),Hh=Error(i(542)),Fh={then:function(){}};function $1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function P1(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(ke,ke),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,H1(s),s;default:if(typeof a.status=="string")a.then(ke,ke);else{if(s=Jt,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,H1(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 z1(){if(co===null)throw Error(i(459));var s=co;return co=null,s}function H1(s){if(s===sl||s===Hh)throw Error(i(483))}var rl=null,Lc=0;function Uh(s){var a=Lc;return Lc+=1,rl===null&&(rl=[]),P1(rl,s,a)}function Nc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Wh(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 F1(s){function a(Z,X){if(s){var te=Z.deletions;te===null?(Z.deletions=[X],Z.flags|=16):te.push(X)}}function l(Z,X){if(!s)return null;for(;X!==null;)a(Z,X),X=X.sibling;return null}function h(Z){for(var X=new Map;Z!==null;)Z.key!==null?X.set(Z.key,Z):X.set(Z.index,Z),Z=Z.sibling;return X}function m(Z,X){return Z=xr(Z,X),Z.index=0,Z.sibling=null,Z}function v(Z,X,te){return Z.index=te,s?(te=Z.alternate,te!==null?(te=te.index,te<X?(Z.flags|=67108866,X):te):(Z.flags|=67108866,X)):(Z.flags|=1048576,X)}function C(Z){return s&&Z.alternate===null&&(Z.flags|=67108866),Z}function I(Z,X,te,ge){return X===null||X.tag!==6?(X=lm(te,Z.mode,ge),X.return=Z,X):(X=m(X,te),X.return=Z,X)}function K(Z,X,te,ge){var Ve=te.type;return Ve===x?me(Z,X,te.props.children,ge,te.key):X!==null&&(X.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===U&&lo(Ve)===X.type)?(X=m(X,te.props),Nc(X,te),X.return=Z,X):(X=Ih(te.type,te.key,te.props,null,Z.mode,ge),Nc(X,te),X.return=Z,X)}function ne(Z,X,te,ge){return X===null||X.tag!==4||X.stateNode.containerInfo!==te.containerInfo||X.stateNode.implementation!==te.implementation?(X=cm(te,Z.mode,ge),X.return=Z,X):(X=m(X,te.children||[]),X.return=Z,X)}function me(Z,X,te,ge,Ve){return X===null||X.tag!==7?(X=io(te,Z.mode,ge,Ve),X.return=Z,X):(X=m(X,te),X.return=Z,X)}function _e(Z,X,te){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=lm(""+X,Z.mode,te),X.return=Z,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return te=Ih(X.type,X.key,X.props,null,Z.mode,te),Nc(te,X),te.return=Z,te;case w:return X=cm(X,Z.mode,te),X.return=Z,X;case U:return X=lo(X),_e(Z,X,te)}if(D(X)||$(X))return X=io(X,Z.mode,te,null),X.return=Z,X;if(typeof X.then=="function")return _e(Z,Uh(X),te);if(X.$$typeof===z)return _e(Z,Ph(Z,X),te);Wh(Z,X)}return null}function ae(Z,X,te,ge){var Ve=X!==null?X.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ve!==null?null:I(Z,X,""+te,ge);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return te.key===Ve?K(Z,X,te,ge):null;case w:return te.key===Ve?ne(Z,X,te,ge):null;case U:return te=lo(te),ae(Z,X,te,ge)}if(D(te)||$(te))return Ve!==null?null:me(Z,X,te,ge,null);if(typeof te.then=="function")return ae(Z,X,Uh(te),ge);if(te.$$typeof===z)return ae(Z,X,Ph(Z,te),ge);Wh(Z,te)}return null}function ce(Z,X,te,ge,Ve){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return Z=Z.get(te)||null,I(X,Z,""+ge,Ve);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return Z=Z.get(ge.key===null?te:ge.key)||null,K(X,Z,ge,Ve);case w:return Z=Z.get(ge.key===null?te:ge.key)||null,ne(X,Z,ge,Ve);case U:return ge=lo(ge),ce(Z,X,te,ge,Ve)}if(D(ge)||$(ge))return Z=Z.get(te)||null,me(X,Z,ge,Ve,null);if(typeof ge.then=="function")return ce(Z,X,te,Uh(ge),Ve);if(ge.$$typeof===z)return ce(Z,X,te,Ph(X,ge),Ve);Wh(X,ge)}return null}function Pe(Z,X,te,ge){for(var Ve=null,Nt=null,We=X,ut=X=0,Ct=null;We!==null&&ut<te.length;ut++){We.index>ut?(Ct=We,We=null):Ct=We.sibling;var Mt=ae(Z,We,te[ut],ge);if(Mt===null){We===null&&(We=Ct);break}s&&We&&Mt.alternate===null&&a(Z,We),X=v(Mt,X,ut),Nt===null?Ve=Mt:Nt.sibling=Mt,Nt=Mt,We=Ct}if(ut===te.length)return l(Z,We),kt&&Cr(Z,ut),Ve;if(We===null){for(;ut<te.length;ut++)We=_e(Z,te[ut],ge),We!==null&&(X=v(We,X,ut),Nt===null?Ve=We:Nt.sibling=We,Nt=We);return kt&&Cr(Z,ut),Ve}for(We=h(We);ut<te.length;ut++)Ct=ce(We,Z,ut,te[ut],ge),Ct!==null&&(s&&Ct.alternate!==null&&We.delete(Ct.key===null?ut:Ct.key),X=v(Ct,X,ut),Nt===null?Ve=Ct:Nt.sibling=Ct,Nt=Ct);return s&&We.forEach(function(ka){return a(Z,ka)}),kt&&Cr(Z,ut),Ve}function Ze(Z,X,te,ge){if(te==null)throw Error(i(151));for(var Ve=null,Nt=null,We=X,ut=X=0,Ct=null,Mt=te.next();We!==null&&!Mt.done;ut++,Mt=te.next()){We.index>ut?(Ct=We,We=null):Ct=We.sibling;var ka=ae(Z,We,Mt.value,ge);if(ka===null){We===null&&(We=Ct);break}s&&We&&ka.alternate===null&&a(Z,We),X=v(ka,X,ut),Nt===null?Ve=ka:Nt.sibling=ka,Nt=ka,We=Ct}if(Mt.done)return l(Z,We),kt&&Cr(Z,ut),Ve;if(We===null){for(;!Mt.done;ut++,Mt=te.next())Mt=_e(Z,Mt.value,ge),Mt!==null&&(X=v(Mt,X,ut),Nt===null?Ve=Mt:Nt.sibling=Mt,Nt=Mt);return kt&&Cr(Z,ut),Ve}for(We=h(We);!Mt.done;ut++,Mt=te.next())Mt=ce(We,Z,ut,Mt.value,ge),Mt!==null&&(s&&Mt.alternate!==null&&We.delete(Mt.key===null?ut:Mt.key),X=v(Mt,X,ut),Nt===null?Ve=Mt:Nt.sibling=Mt,Nt=Mt);return s&&We.forEach(function(U3){return a(Z,U3)}),kt&&Cr(Z,ut),Ve}function Vt(Z,X,te,ge){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;X!==null;){if(X.key===Ve){if(Ve=te.type,Ve===x){if(X.tag===7){l(Z,X.sibling),ge=m(X,te.props.children),ge.return=Z,Z=ge;break e}}else if(X.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===U&&lo(Ve)===X.type){l(Z,X.sibling),ge=m(X,te.props),Nc(ge,te),ge.return=Z,Z=ge;break e}l(Z,X);break}else a(Z,X);X=X.sibling}te.type===x?(ge=io(te.props.children,Z.mode,ge,te.key),ge.return=Z,Z=ge):(ge=Ih(te.type,te.key,te.props,null,Z.mode,ge),Nc(ge,te),ge.return=Z,Z=ge)}return C(Z);case w:e:{for(Ve=te.key;X!==null;){if(X.key===Ve)if(X.tag===4&&X.stateNode.containerInfo===te.containerInfo&&X.stateNode.implementation===te.implementation){l(Z,X.sibling),ge=m(X,te.children||[]),ge.return=Z,Z=ge;break e}else{l(Z,X);break}else a(Z,X);X=X.sibling}ge=cm(te,Z.mode,ge),ge.return=Z,Z=ge}return C(Z);case U:return te=lo(te),Vt(Z,X,te,ge)}if(D(te))return Pe(Z,X,te,ge);if($(te)){if(Ve=$(te),typeof Ve!="function")throw Error(i(150));return te=Ve.call(te),Ze(Z,X,te,ge)}if(typeof te.then=="function")return Vt(Z,X,Uh(te),ge);if(te.$$typeof===z)return Vt(Z,X,Ph(Z,te),ge);Wh(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,X!==null&&X.tag===6?(l(Z,X.sibling),ge=m(X,te),ge.return=Z,Z=ge):(l(Z,X),ge=lm(te,Z.mode,ge),ge.return=Z,Z=ge),C(Z)):l(Z,X)}return function(Z,X,te,ge){try{Lc=0;var Ve=Vt(Z,X,te,ge);return rl=null,Ve}catch(We){if(We===sl||We===Hh)throw We;var Nt=is(29,We,null,Z.mode);return Nt.lanes=ge,Nt.return=Z,Nt}}}var uo=F1(!0),U1=F1(!1),la=!1;function Sm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wm(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 ca(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ua(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=jh(s),E1(s,null,l),a}return Dh(s,h,a,l),jh(s)}function Mc(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 xm(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 C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?m=v=C:v=v.next=C,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 Cm=!1;function Oc(){if(Cm){var s=il;if(s!==null)throw s}}function Dc(s,a,l,h){Cm=!1;var m=s.updateQueue;la=!1;var v=m.firstBaseUpdate,C=m.lastBaseUpdate,I=m.shared.pending;if(I!==null){m.shared.pending=null;var K=I,ne=K.next;K.next=null,C===null?v=ne:C.next=ne,C=K;var me=s.alternate;me!==null&&(me=me.updateQueue,I=me.lastBaseUpdate,I!==C&&(I===null?me.firstBaseUpdate=ne:I.next=ne,me.lastBaseUpdate=K))}if(v!==null){var _e=m.baseState;C=0,me=ne=K=null,I=v;do{var ae=I.lane&-536870913,ce=ae!==I.lane;if(ce?(xt&ae)===ae:(h&ae)===ae){ae!==0&&ae===nl&&(Cm=!0),me!==null&&(me=me.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Pe=s,Ze=I;ae=a;var Vt=l;switch(Ze.tag){case 1:if(Pe=Ze.payload,typeof Pe=="function"){_e=Pe.call(Vt,_e,ae);break e}_e=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Ze.payload,ae=typeof Pe=="function"?Pe.call(Vt,_e,ae):Pe,ae==null)break e;_e=g({},_e,ae);break e;case 2:la=!0}}ae=I.callback,ae!==null&&(s.flags|=64,ce&&(s.flags|=8192),ce=m.callbacks,ce===null?m.callbacks=[ae]:ce.push(ae))}else ce={lane:ae,tag:I.tag,payload:I.payload,callback:I.callback,next:null},me===null?(ne=me=ce,K=_e):me=me.next=ce,C|=ae;if(I=I.next,I===null){if(I=m.shared.pending,I===null)break;ce=I,I=ce.next,ce.next=null,m.lastBaseUpdate=ce,m.shared.pending=null}}while(!0);me===null&&(K=_e),m.baseState=K,m.firstBaseUpdate=ne,m.lastBaseUpdate=me,v===null&&(m.shared.lanes=0),ma|=C,s.lanes=C,s.memoizedState=_e}}function W1(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function q1(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)W1(l[s],a)}var al=O(null),qh=O(0);function G1(s,a){s=jr,J(qh,s),J(al,a),jr=s|a.baseLanes}function km(){J(qh,jr),J(al,al.current)}function Em(){jr=qh.current,V(al),V(qh)}var ss=O(null),Cs=null;function ha(s){var a=s.alternate;J(Rn,Rn.current&1),J(ss,s),Cs===null&&(a===null||al.current!==null||a.memoizedState!==null)&&(Cs=s)}function Tm(s){J(Rn,Rn.current),J(ss,s),Cs===null&&(Cs=s)}function K1(s){s.tag===22?(J(Rn,Rn.current),J(ss,s),Cs===null&&(Cs=s)):da()}function da(){J(Rn,Rn.current),J(ss,ss.current)}function rs(s){V(ss),Cs===s&&(Cs=null),V(Rn)}var Rn=O(0);function Gh(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Og(l)||Dg(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 Tr=0,ct=null,Gt=null,jn=null,Kh=!1,ol=!1,ho=!1,Vh=0,jc=0,ll=null,OM=0;function bn(){throw Error(i(321))}function Am(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 Rm(s,a,l,h,m,v){return Tr=v,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,T.H=s===null||s.memoizedState===null?LS:Wm,ho=!1,v=l(h,m),ho=!1,ol&&(v=Y1(a,l,h,m)),V1(s),v}function V1(s){T.H=$c;var a=Gt!==null&&Gt.next!==null;if(Tr=0,jn=Gt=ct=null,Kh=!1,jc=0,ll=null,a)throw Error(i(300));s===null||In||(s=s.dependencies,s!==null&&$h(s)&&(In=!0))}function Y1(s,a,l,h){ct=s;var m=0;do{if(ol&&(ll=null),jc=0,ol=!1,25<=m)throw Error(i(301));if(m+=1,jn=Gt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}T.H=NS,v=a(l,h)}while(ol);return v}function DM(){var s=T.H,a=s.useState()[0];return a=typeof a.then=="function"?Ic(a):a,s=s.useState()[0],(Gt!==null?Gt.memoizedState:null)!==s&&(ct.flags|=1024),a}function Lm(){var s=Vh!==0;return Vh=0,s}function Nm(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Mm(s){if(Kh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Kh=!1}Tr=0,jn=Gt=ct=null,ol=!1,jc=Vh=0,ll=null}function Ri(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?ct.memoizedState=jn=s:jn=jn.next=s,jn}function Ln(){if(Gt===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=Gt.next;var a=jn===null?ct.memoizedState:jn.next;if(a!==null)jn=a,Gt=s;else{if(s===null)throw ct.alternate===null?Error(i(467)):Error(i(310));Gt=s,s={memoizedState:Gt.memoizedState,baseState:Gt.baseState,baseQueue:Gt.baseQueue,queue:Gt.queue,next:null},jn===null?ct.memoizedState=jn=s:jn=jn.next=s}return jn}function Yh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ic(s){var a=jc;return jc+=1,ll===null&&(ll=[]),s=P1(ll,s,a),a=ct,(jn===null?a.memoizedState:jn.next)===null&&(a=a.alternate,T.H=a===null||a.memoizedState===null?LS:Wm),s}function Xh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Ic(s);if(s.$$typeof===z)return fi(s)}throw Error(i(438,String(s)))}function Om(s){var a=null,l=ct.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=ct.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=Yh(),ct.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]=oe;return a.index++,l}function Ar(s,a){return typeof a=="function"?a(s):a}function Zh(s){var a=Ln();return Dm(a,Gt,s)}function Dm(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 C=m.next;m.next=v.next,v.next=C}a.baseQueue=m=v,h.pending=null}if(v=s.baseState,m===null)s.memoizedState=v;else{a=m.next;var I=C=null,K=null,ne=a,me=!1;do{var _e=ne.lane&-536870913;if(_e!==ne.lane?(xt&_e)===_e:(Tr&_e)===_e){var ae=ne.revertLane;if(ae===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),_e===nl&&(me=!0);else if((Tr&ae)===ae){ne=ne.next,ae===nl&&(me=!0);continue}else _e={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(I=K=_e,C=v):K=K.next=_e,ct.lanes|=ae,ma|=ae;_e=ne.action,ho&&l(v,_e),v=ne.hasEagerState?ne.eagerState:l(v,_e)}else ae={lane:_e,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(I=K=ae,C=v):K=K.next=ae,ct.lanes|=_e,ma|=_e;ne=ne.next}while(ne!==null&&ne!==a);if(K===null?C=v:K.next=I,!ns(v,s.memoizedState)&&(In=!0,me&&(l=il,l!==null)))throw l;s.memoizedState=v,s.baseState=C,s.baseQueue=K,h.lastRenderedState=v}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function jm(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 C=m=m.next;do v=s(v,C.action),C=C.next;while(C!==m);ns(v,a.memoizedState)||(In=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),l.lastRenderedState=v}return[v,h]}function X1(s,a,l){var h=ct,m=Ln(),v=kt;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=a();var C=!ns((Gt||m).memoizedState,l);if(C&&(m.memoizedState=l,In=!0),m=m.queue,$m(Q1.bind(null,h,m,s),[s]),m.getSnapshot!==a||C||jn!==null&&jn.memoizedState.tag&1){if(h.flags|=2048,cl(9,{destroy:void 0},J1.bind(null,h,m,l,a),null),Jt===null)throw Error(i(349));v||(Tr&127)!==0||Z1(h,a,l)}return l}function Z1(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=ct.updateQueue,a===null?(a=Yh(),ct.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function J1(s,a,l,h){a.value=l,a.getSnapshot=h,eS(a)&&tS(s)}function Q1(s,a,l){return l(function(){eS(a)&&tS(s)})}function eS(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ns(s,l)}catch{return!0}}function tS(s){var a=no(s,2);a!==null&&Gi(a,s,2)}function Im(s){var a=Ri();if(typeof s=="function"){var l=s;if(s=l(),ho){ue(!0);try{l()}finally{ue(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:s},a}function nS(s,a,l,h){return s.baseState=l,Dm(s,Gt,typeof h=="function"?h:Ar)}function jM(s,a,l,h,m){if(ed(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(C){v.listeners.push(C)}};T.T!==null?l(!0):v.isTransition=!1,h(v),l=a.pending,l===null?(v.next=a.pending=v,iS(a,v)):(v.next=l.next,a.pending=l.next=v)}}function iS(s,a){var l=a.action,h=a.payload,m=s.state;if(a.isTransition){var v=T.T,C={};T.T=C;try{var I=l(m,h),K=T.S;K!==null&&K(C,I),sS(s,a,I)}catch(ne){Bm(s,a,ne)}finally{v!==null&&C.types!==null&&(v.types=C.types),T.T=v}}else try{v=l(m,h),sS(s,a,v)}catch(ne){Bm(s,a,ne)}}function sS(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){rS(s,a,h)},function(h){return Bm(s,a,h)}):rS(s,a,l)}function rS(s,a,l){a.status="fulfilled",a.value=l,aS(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,iS(s,l)))}function Bm(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,aS(a),a=a.next;while(a!==h)}s.action=null}function aS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function oS(s,a){return a}function lS(s,a){if(kt){var l=Jt.formState;if(l!==null){e:{var h=ct;if(kt){if(nn){t:{for(var m=nn,v=xs;m.nodeType!==8;){if(!v){m=null;break t}if(m=ks(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){nn=ks(m.nextSibling),h=m.data==="F!";break e}}aa(h)}h=!1}h&&(a=l[0])}}return l=Ri(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oS,lastRenderedState:a},l.queue=h,l=TS.bind(null,ct,h),h.dispatch=l,h=Im(!1),v=Um.bind(null,ct,!1,h.queue),h=Ri(),m={state:a,dispatch:null,action:s,pending:null},h.queue=m,l=jM.bind(null,ct,m,v,l),m.dispatch=l,h.memoizedState=s,[a,l,!1]}function cS(s){var a=Ln();return uS(a,Gt,s)}function uS(s,a,l){if(a=Dm(s,a,oS)[0],s=Zh(Ar)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Ic(a)}catch(C){throw C===sl?Hh:C}else h=a;a=Ln();var m=a.queue,v=m.dispatch;return l!==a.memoizedState&&(ct.flags|=2048,cl(9,{destroy:void 0},IM.bind(null,m,l),null)),[h,v,s]}function IM(s,a){s.action=a}function hS(s){var a=Ln(),l=Gt;if(l!==null)return uS(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=ct.updateQueue,a===null&&(a=Yh(),ct.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 dS(){return Ln().memoizedState}function Jh(s,a,l,h){var m=Ri();ct.flags|=s,m.memoizedState=cl(1|a,{destroy:void 0},l,h===void 0?null:h)}function Qh(s,a,l,h){var m=Ln();h=h===void 0?null:h;var v=m.memoizedState.inst;Gt!==null&&h!==null&&Am(h,Gt.memoizedState.deps)?m.memoizedState=cl(a,v,l,h):(ct.flags|=s,m.memoizedState=cl(1|a,v,l,h))}function fS(s,a){Jh(8390656,8,s,a)}function $m(s,a){Qh(2048,8,s,a)}function BM(s){ct.flags|=4;var a=ct.updateQueue;if(a===null)a=Yh(),ct.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function pS(s){var a=Ln().memoizedState;return BM({ref:a,nextImpl:s}),function(){if((It&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function mS(s,a){return Qh(4,2,s,a)}function gS(s,a){return Qh(4,4,s,a)}function _S(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 vS(s,a,l){l=l!=null?l.concat([s]):null,Qh(4,4,_S.bind(null,a,s),l)}function Pm(){}function yS(s,a){var l=Ln();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&Am(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function bS(s,a){var l=Ln();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&Am(a,h[1]))return h[0];if(h=s(),ho){ue(!0);try{s()}finally{ue(!1)}}return l.memoizedState=[h,a],h}function zm(s,a,l){return l===void 0||(Tr&1073741824)!==0&&(xt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=Sw(),ct.lanes|=s,ma|=s,l)}function SS(s,a,l,h){return ns(l,a)?l:al.current!==null?(s=zm(s,l,h),ns(s,a)||(In=!0),s):(Tr&42)===0||(Tr&1073741824)!==0&&(xt&261930)===0?(In=!0,s.memoizedState=l):(s=Sw(),ct.lanes|=s,ma|=s,a)}function wS(s,a,l,h,m){var v=R.p;R.p=v!==0&&8>v?v:8;var C=T.T,I={};T.T=I,Um(s,!1,a,l);try{var K=m(),ne=T.S;if(ne!==null&&ne(I,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var me=MM(K,h);Bc(s,a,me,ls(s))}else Bc(s,a,h,ls(s))}catch(_e){Bc(s,a,{then:function(){},status:"rejected",reason:_e},ls())}finally{R.p=v,C!==null&&I.types!==null&&(C.types=I.types),T.T=C}}function $M(){}function Hm(s,a,l,h){if(s.tag!==5)throw Error(i(476));var m=xS(s).queue;wS(s,m,a,N,l===null?$M:function(){return CS(s),l(h)})}function xS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:N},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function CS(s){var a=xS(s);a.next===null&&(a=s.alternate.memoizedState),Bc(s,a.next.queue,{},ls())}function Fm(){return fi(eu)}function kS(){return Ln().memoizedState}function ES(){return Ln().memoizedState}function PM(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=ls();s=ca(l);var h=ua(a,s,l);h!==null&&(Gi(h,a,l),Mc(h,a,l)),a={cache:_m()},s.payload=a;return}a=a.return}}function zM(s,a,l){var h=ls();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ed(s)?AS(a,l):(l=am(s,a,l,h),l!==null&&(Gi(l,s,h),RS(l,a,h)))}function TS(s,a,l){var h=ls();Bc(s,a,l,h)}function Bc(s,a,l,h){var m={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ed(s))AS(a,m);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var C=a.lastRenderedState,I=v(C,l);if(m.hasEagerState=!0,m.eagerState=I,ns(I,C))return Dh(s,a,m,0),Jt===null&&Oh(),!1}catch{}if(l=am(s,a,m,h),l!==null)return Gi(l,s,h),RS(l,a,h),!0}return!1}function Um(s,a,l,h){if(h={lane:2,revertLane:Sg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ed(s)){if(a)throw Error(i(479))}else a=am(s,l,h,2),a!==null&&Gi(a,s,2)}function ed(s){var a=s.alternate;return s===ct||a!==null&&a===ct}function AS(s,a){ol=Kh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function RS(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Ye(s,l)}}var $c={readContext:fi,use:Xh,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};$c.useEffectEvent=bn;var LS={readContext:fi,use:Xh,useCallback:function(s,a){return Ri().memoizedState=[s,a===void 0?null:a],s},useContext:fi,useEffect:fS,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,Jh(4194308,4,_S.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Jh(4194308,4,s,a)},useInsertionEffect:function(s,a){Jh(4,2,s,a)},useMemo:function(s,a){var l=Ri();a=a===void 0?null:a;var h=s();if(ho){ue(!0);try{s()}finally{ue(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=Ri();if(l!==void 0){var m=l(a);if(ho){ue(!0);try{l(a)}finally{ue(!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=zM.bind(null,ct,s),[h.memoizedState,s]},useRef:function(s){var a=Ri();return s={current:s},a.memoizedState=s},useState:function(s){s=Im(s);var a=s.queue,l=TS.bind(null,ct,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Pm,useDeferredValue:function(s,a){var l=Ri();return zm(l,s,a)},useTransition:function(){var s=Im(!1);return s=wS.bind(null,ct,s.queue,!0,!1),Ri().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=ct,m=Ri();if(kt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),Jt===null)throw Error(i(349));(xt&127)!==0||Z1(h,a,l)}m.memoizedState=l;var v={value:l,getSnapshot:a};return m.queue=v,fS(Q1.bind(null,h,v,s),[s]),h.flags|=2048,cl(9,{destroy:void 0},J1.bind(null,h,v,l,a),null),l},useId:function(){var s=Ri(),a=Jt.identifierPrefix;if(kt){var l=ir,h=nr;l=(h&~(1<<32-Be(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=Vh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=OM++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Fm,useFormState:lS,useActionState:lS,useOptimistic:function(s){var a=Ri();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Um.bind(null,ct,!0,l),l.dispatch=a,[s,a]},useMemoCache:Om,useCacheRefresh:function(){return Ri().memoizedState=PM.bind(null,ct)},useEffectEvent:function(s){var a=Ri(),l={impl:s};return a.memoizedState=l,function(){if((It&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Wm={readContext:fi,use:Xh,useCallback:yS,useContext:fi,useEffect:$m,useImperativeHandle:vS,useInsertionEffect:mS,useLayoutEffect:gS,useMemo:bS,useReducer:Zh,useRef:dS,useState:function(){return Zh(Ar)},useDebugValue:Pm,useDeferredValue:function(s,a){var l=Ln();return SS(l,Gt.memoizedState,s,a)},useTransition:function(){var s=Zh(Ar)[0],a=Ln().memoizedState;return[typeof s=="boolean"?s:Ic(s),a]},useSyncExternalStore:X1,useId:kS,useHostTransitionStatus:Fm,useFormState:cS,useActionState:cS,useOptimistic:function(s,a){var l=Ln();return nS(l,Gt,s,a)},useMemoCache:Om,useCacheRefresh:ES};Wm.useEffectEvent=pS;var NS={readContext:fi,use:Xh,useCallback:yS,useContext:fi,useEffect:$m,useImperativeHandle:vS,useInsertionEffect:mS,useLayoutEffect:gS,useMemo:bS,useReducer:jm,useRef:dS,useState:function(){return jm(Ar)},useDebugValue:Pm,useDeferredValue:function(s,a){var l=Ln();return Gt===null?zm(l,s,a):SS(l,Gt.memoizedState,s,a)},useTransition:function(){var s=jm(Ar)[0],a=Ln().memoizedState;return[typeof s=="boolean"?s:Ic(s),a]},useSyncExternalStore:X1,useId:kS,useHostTransitionStatus:Fm,useFormState:hS,useActionState:hS,useOptimistic:function(s,a){var l=Ln();return Gt!==null?nS(l,Gt,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Om,useCacheRefresh:ES};NS.useEffectEvent=pS;function qm(s,a,l,h){a=s.memoizedState,l=l(h,a),l=l==null?a:g({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Gm={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=ls(),m=ca(h);m.payload=a,l!=null&&(m.callback=l),a=ua(s,m,h),a!==null&&(Gi(a,s,h),Mc(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=ls(),m=ca(h);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=ua(s,m,h),a!==null&&(Gi(a,s,h),Mc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=ls(),h=ca(l);h.tag=2,a!=null&&(h.callback=a),a=ua(s,h,l),a!==null&&(Gi(a,s,l),Mc(a,s,l))}};function MS(s,a,l,h,m,v,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,C):a.prototype&&a.prototype.isPureReactComponent?!Cc(l,h)||!Cc(m,v):!0}function OS(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&&Gm.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=g({},l));for(var m in s)l[m]===void 0&&(l[m]=s[m])}return l}function DS(s){Mh(s)}function jS(s){console.error(s)}function IS(s){Mh(s)}function td(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function BS(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 Km(s,a,l){return l=ca(l),l.tag=3,l.payload={element:null},l.callback=function(){td(s,a)},l}function $S(s){return s=ca(s),s.tag=3,s}function PS(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(){BS(a,l,h)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){BS(a,l,h),typeof m!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var I=h.stack;this.componentDidCatch(h.value,{componentStack:I!==null?I:""})})}function HM(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 Cs===null?fd():l.alternate===null&&Sn===0&&(Sn=3),l.flags&=-257,l.flags|=65536,l.lanes=m,h===Fh?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),vg(s,h,m)),!1;case 22:return l.flags|=65536,h===Fh?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)),vg(s,h,m)),!1}throw Error(i(435,l.tag))}return vg(s,h,m),fd(),!1}if(kt)return a=ss.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,h!==dm&&(s=Error(i(422),{cause:h}),Tc(bs(s,l)))):(h!==dm&&(a=Error(i(423),{cause:h}),Tc(bs(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=bs(h,l),m=Km(s.stateNode,h,m),xm(s,m),Sn!==4&&(Sn=2)),!1;var v=Error(i(520),{cause:h});if(v=bs(v,l),Gc===null?Gc=[v]:Gc.push(v),Sn!==4&&(Sn=2),a===null)return!0;h=bs(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=Km(l.stateNode,h,s),xm(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"&&(ga===null||!ga.has(v))))return l.flags|=65536,m&=-m,l.lanes|=m,m=$S(m),PS(m,s,l,h),xm(l,m),!1}l=l.return}while(l!==null);return!1}var Vm=Error(i(461)),In=!1;function pi(s,a,l,h){a.child=s===null?U1(a,null,l,h):uo(a,s.child,l,h)}function zS(s,a,l,h,m){l=l.render;var v=a.ref;if("ref"in h){var C={};for(var I in h)I!=="ref"&&(C[I]=h[I])}else C=h;return ao(a),h=Rm(s,a,l,C,v,m),I=Lm(),s!==null&&!In?(Nm(s,a,m),Rr(s,a,m)):(kt&&I&&um(a),a.flags|=1,pi(s,a,h,m),a.child)}function HS(s,a,l,h,m){if(s===null){var v=l.type;return typeof v=="function"&&!om(v)&&v.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=v,FS(s,a,v,h,m)):(s=Ih(l.type,null,h,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!ng(s,m)){var C=v.memoizedProps;if(l=l.compare,l=l!==null?l:Cc,l(C,h)&&s.ref===a.ref)return Rr(s,a,m)}return a.flags|=1,s=xr(v,h),s.ref=a.ref,s.return=a,a.child=s}function FS(s,a,l,h,m){if(s!==null){var v=s.memoizedProps;if(Cc(v,h)&&s.ref===a.ref)if(In=!1,a.pendingProps=h=v,ng(s,m))(s.flags&131072)!==0&&(In=!0);else return a.lanes=s.lanes,Rr(s,a,m)}return Ym(s,a,l,h,m)}function US(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 WS(s,a,v,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&zh(a,v!==null?v.cachePool:null),v!==null?G1(a,v):km(),K1(a);else return h=a.lanes=536870912,WS(s,a,v!==null?v.baseLanes|l:l,l,h)}else v!==null?(zh(a,v.cachePool),G1(a,v),da(),a.memoizedState=null):(s!==null&&zh(a,null),km(),da());return pi(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 WS(s,a,l,h,m){var v=ym();return v=v===null?null:{parent:Dn._currentValue,pool:v},a.memoizedState={baseLanes:l,cachePool:v},s!==null&&zh(a,null),km(),K1(a),s!==null&&tl(s,a,h,!0),a.childLanes=m,null}function nd(s,a){return a=sd({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function qS(s,a,l){return uo(a,s.child,null,l),s=nd(a,a.pendingProps),s.flags|=2,rs(a),a.memoizedState=null,s}function FM(s,a,l){var h=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(kt){if(h.mode==="hidden")return s=nd(a,h),a.lanes=536870912,Pc(null,s);if(Tm(a),(s=nn)?(s=ix(s,xs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:sa!==null?{id:nr,overflow:ir}:null,retryLane:536870912,hydrationErrors:null},l=A1(s),l.return=a,a.child=l,di=a,nn=null)):s=null,s===null)throw aa(a);return a.lanes=536870912,null}return nd(a,h)}var v=s.memoizedState;if(v!==null){var C=v.dehydrated;if(Tm(a),m)if(a.flags&256)a.flags&=-257,a=qS(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(In||tl(s,a,l,!1),m=(l&s.childLanes)!==0,In||m){if(h=Jt,h!==null&&(C=tn(h,l),C!==0&&C!==v.retryLane))throw v.retryLane=C,no(s,C),Gi(h,s,C),Vm;fd(),a=qS(s,a,l)}else s=v.treeContext,nn=ks(C.nextSibling),di=a,kt=!0,ra=null,xs=!1,s!==null&&N1(a,s),a=nd(a,h),a.flags|=4096;return a}return s=xr(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function id(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 Ym(s,a,l,h,m){return ao(a),l=Rm(s,a,l,h,void 0,m),h=Lm(),s!==null&&!In?(Nm(s,a,m),Rr(s,a,m)):(kt&&h&&um(a),a.flags|=1,pi(s,a,l,m),a.child)}function GS(s,a,l,h,m,v){return ao(a),a.updateQueue=null,l=Y1(a,h,l,m),V1(s),h=Lm(),s!==null&&!In?(Nm(s,a,v),Rr(s,a,v)):(kt&&h&&um(a),a.flags|=1,pi(s,a,l,v),a.child)}function KS(s,a,l,h,m){if(ao(a),a.stateNode===null){var v=Zo,C=l.contextType;typeof C=="object"&&C!==null&&(v=fi(C)),v=new l(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Gm,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},Sm(a),C=l.contextType,v.context=typeof C=="object"&&C!==null?fi(C):Zo,v.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(qm(a,l,C,h),v.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(C=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),C!==v.state&&Gm.enqueueReplaceState(v,v.state,null),Dc(a,h,v,m),Oc(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){v=a.stateNode;var I=a.memoizedProps,K=fo(l,I);v.props=K;var ne=v.context,me=l.contextType;C=Zo,typeof me=="object"&&me!==null&&(C=fi(me));var _e=l.getDerivedStateFromProps;me=typeof _e=="function"||typeof v.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,me||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(I||ne!==C)&&OS(a,v,h,C),la=!1;var ae=a.memoizedState;v.state=ae,Dc(a,h,v,m),Oc(),ne=a.memoizedState,I||ae!==ne||la?(typeof _e=="function"&&(qm(a,l,_e,h),ne=a.memoizedState),(K=la||MS(a,l,K,h,ae,ne,C))?(me||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=C,h=K):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,wm(s,a),C=a.memoizedProps,me=fo(l,C),v.props=me,_e=a.pendingProps,ae=v.context,ne=l.contextType,K=Zo,typeof ne=="object"&&ne!==null&&(K=fi(ne)),I=l.getDerivedStateFromProps,(ne=typeof I=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(C!==_e||ae!==K)&&OS(a,v,h,K),la=!1,ae=a.memoizedState,v.state=ae,Dc(a,h,v,m),Oc();var ce=a.memoizedState;C!==_e||ae!==ce||la||s!==null&&s.dependencies!==null&&$h(s.dependencies)?(typeof I=="function"&&(qm(a,l,I,h),ce=a.memoizedState),(me=la||MS(a,l,me,h,ae,ce,K)||s!==null&&s.dependencies!==null&&$h(s.dependencies))?(ne||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,ce,K),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,ce,K)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ce),v.props=h,v.state=ce,v.context=K,h=me):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),h=!1)}return v=h,id(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)):pi(s,a,l,m),a.memoizedState=v.state,s=a.child):s=Rr(s,a,m),s}function VS(s,a,l,h){return so(),a.flags|=256,pi(s,a,l,h),a.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zm(s){return{baseLanes:s,cachePool:B1()}}function Jm(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=os),s}function YS(s,a,l){var h=a.pendingProps,m=!1,v=(a.flags&128)!==0,C;if((C=v)||(C=s!==null&&s.memoizedState===null?!1:(Rn.current&2)!==0),C&&(m=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,s===null){if(kt){if(m?ha(a):da(),(s=nn)?(s=ix(s,xs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:sa!==null?{id:nr,overflow:ir}:null,retryLane:536870912,hydrationErrors:null},l=A1(s),l.return=a,a.child=l,di=a,nn=null)):s=null,s===null)throw aa(a);return Dg(s)?a.lanes=32:a.lanes=536870912,null}var I=h.children;return h=h.fallback,m?(da(),m=a.mode,I=sd({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=Zm(l),h.childLanes=Jm(s,C,l),a.memoizedState=Xm,Pc(null,h)):(ha(a),Qm(a,I))}var K=s.memoizedState;if(K!==null&&(I=K.dehydrated,I!==null)){if(v)a.flags&256?(ha(a),a.flags&=-257,a=eg(s,a,l)):a.memoizedState!==null?(da(),a.child=s.child,a.flags|=128,a=null):(da(),I=h.fallback,m=a.mode,h=sd({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=Zm(l),h.childLanes=Jm(s,C,l),a.memoizedState=Xm,a=Pc(null,h));else if(ha(a),Dg(I)){if(C=I.nextSibling&&I.nextSibling.dataset,C)var ne=C.dgst;C=ne,h=Error(i(419)),h.stack="",h.digest=C,Tc({value:h,source:null,stack:null}),a=eg(s,a,l)}else if(In||tl(s,a,l,!1),C=(l&s.childLanes)!==0,In||C){if(C=Jt,C!==null&&(h=tn(C,l),h!==0&&h!==K.retryLane))throw K.retryLane=h,no(s,h),Gi(C,s,h),Vm;Og(I)||fd(),a=eg(s,a,l)}else Og(I)?(a.flags|=192,a.child=s.child,a=null):(s=K.treeContext,nn=ks(I.nextSibling),di=a,kt=!0,ra=null,xs=!1,s!==null&&N1(a,s),a=Qm(a,h.children),a.flags|=4096);return a}return m?(da(),I=h.fallback,m=a.mode,K=s.child,ne=K.sibling,h=xr(K,{mode:"hidden",children:h.children}),h.subtreeFlags=K.subtreeFlags&65011712,ne!==null?I=xr(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=Zm(l):(m=I.cachePool,m!==null?(K=Dn._currentValue,m=m.parent!==K?{parent:K,pool:K}:m):m=B1(),I={baseLanes:I.baseLanes|l,cachePool:m}),h.memoizedState=I,h.childLanes=Jm(s,C,l),a.memoizedState=Xm,Pc(s.child,h)):(ha(a),l=s.child,s=l.sibling,l=xr(l,{mode:"visible",children:h.children}),l.return=a,l.sibling=null,s!==null&&(C=a.deletions,C===null?(a.deletions=[s],a.flags|=16):C.push(s)),a.child=l,a.memoizedState=null,l)}function Qm(s,a){return a=sd({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function sd(s,a){return s=is(22,s,null,a),s.lanes=0,s}function eg(s,a,l){return uo(a,s.child,null,l),s=Qm(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function XS(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),mm(s.return,a,l)}function tg(s,a,l,h,m,v){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:m,treeForkCount:v}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=l,C.tailMode=m,C.treeForkCount=v)}function ZS(s,a,l){var h=a.pendingProps,m=h.revealOrder,v=h.tail;h=h.children;var C=Rn.current,I=(C&2)!==0;if(I?(C=C&1|2,a.flags|=128):C&=1,J(Rn,C),pi(s,a,h,l),h=kt?Ec:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&XS(s,l,a);else if(s.tag===19)XS(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&&Gh(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),tg(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&&Gh(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}tg(a,!0,l,null,v,h);break;case"together":tg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Rr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),ma|=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=xr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=xr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function ng(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&$h(s)))}function UM(s,a,l){switch(a.tag){case 3:Re(a,a.stateNode.containerInfo),oa(a,Dn,s.memoizedState.cache),so();break;case 27:case 5:dt(a);break;case 4:Re(a,a.stateNode.containerInfo);break;case 10:oa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Tm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(ha(a),a.flags|=128,null):(l&a.child.childLanes)!==0?YS(s,a,l):(ha(a),s=Rr(s,a,l),s!==null?s.sibling:null);ha(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 ZS(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),J(Rn,Rn.current),h)break;return null;case 22:return a.lanes=0,US(s,a,l,a.pendingProps);case 24:oa(a,Dn,s.memoizedState.cache)}return Rr(s,a,l)}function JS(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)In=!0;else{if(!ng(s,l)&&(a.flags&128)===0)return In=!1,UM(s,a,l);In=(s.flags&131072)!==0}else In=!1,kt&&(a.flags&1048576)!==0&&L1(a,Ec,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")om(s)?(h=fo(s,h),a.tag=1,a=KS(null,a,s,h,l)):(a.tag=0,a=Ym(null,a,s,h,l));else{if(s!=null){var m=s.$$typeof;if(m===E){a.tag=11,a=zS(null,a,s,h,l);break e}else if(m===H){a.tag=14,a=HS(null,a,s,h,l);break e}}throw a=P(s)||s,Error(i(306,a,""))}}return a;case 0:return Ym(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,m=fo(h,a.pendingProps),KS(s,a,h,m,l);case 3:e:{if(Re(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var v=a.memoizedState;m=v.element,wm(s,a),Dc(a,h,null,l);var C=a.memoizedState;if(h=C.cache,oa(a,Dn,h),h!==v.cache&&gm(a,[Dn],l,!0),Oc(),h=C.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=VS(s,a,h,l);break e}else if(h!==m){m=bs(Error(i(424)),a),Tc(m),a=VS(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=ks(s.firstChild),di=a,kt=!0,ra=null,xs=!0,l=U1(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(so(),h===m){a=Rr(s,a,l);break e}pi(s,a,h,l)}a=a.child}return a;case 26:return id(s,a),s===null?(l=cx(a.type,null,a.pendingProps,null))?a.memoizedState=l:kt||(l=a.type,s=a.pendingProps,h=bd(le.current).createElement(l),h[Ut]=a,h[re]=s,mi(h,l,s),rt(h),a.stateNode=h):a.memoizedState=cx(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return dt(a),s===null&&kt&&(h=a.stateNode=ax(a.type,a.pendingProps,le.current),di=a,xs=!0,m=nn,ba(a.type)?(jg=m,nn=ks(h.firstChild)):nn=m),pi(s,a,a.pendingProps.children,l),id(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&kt&&((m=h=nn)&&(h=y3(h,a.type,a.pendingProps,xs),h!==null?(a.stateNode=h,di=a,nn=ks(h.firstChild),xs=!1,m=!0):m=!1),m||aa(a)),dt(a),m=a.type,v=a.pendingProps,C=s!==null?s.memoizedProps:null,h=v.children,Lg(m,v)?h=null:C!==null&&Lg(m,C)&&(a.flags|=32),a.memoizedState!==null&&(m=Rm(s,a,DM,null,null,l),eu._currentValue=m),id(s,a),pi(s,a,h,l),a.child;case 6:return s===null&&kt&&((s=l=nn)&&(l=b3(l,a.pendingProps,xs),l!==null?(a.stateNode=l,di=a,nn=null,s=!0):s=!1),s||aa(a)),null;case 13:return YS(s,a,l);case 4:return Re(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=uo(a,null,h,l):pi(s,a,h,l),a.child;case 11:return zS(s,a,a.type,a.pendingProps,l);case 7:return pi(s,a,a.pendingProps,l),a.child;case 8:return pi(s,a,a.pendingProps.children,l),a.child;case 12:return pi(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,oa(a,a.type,h.value),pi(s,a,h.children,l),a.child;case 9:return m=a.type._context,h=a.pendingProps.children,ao(a),m=fi(m),h=h(m),a.flags|=1,pi(s,a,h,l),a.child;case 14:return HS(s,a,a.type,a.pendingProps,l);case 15:return FS(s,a,a.type,a.pendingProps,l);case 19:return ZS(s,a,l);case 31:return FM(s,a,l);case 22:return US(s,a,l,a.pendingProps);case 24:return ao(a),h=fi(Dn),s===null?(m=ym(),m===null&&(m=Jt,v=_m(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=l),m=v),a.memoizedState={parent:h,cache:m},Sm(a),oa(a,Dn,m)):((s.lanes&l)!==0&&(wm(s,a),Dc(a,null,null,l),Oc()),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),oa(a,Dn,h)):(h=v.cache,oa(a,Dn,h),h!==m.cache&&gm(a,[Dn],l,!0))),pi(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Lr(s){s.flags|=4}function ig(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(kw())s.flags|=8192;else throw co=Fh,bm}else s.flags&=-16777217}function QS(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!px(a))if(kw())s.flags|=8192;else throw co=Fh,bm}function rd(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?ze():536870912,s.lanes|=a,fl|=a)}function zc(s,a){if(!kt)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 WM(s,a,l){var h=a.pendingProps;switch(hm(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),Er(Dn),$e(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(el(a)?Lr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,fm())),sn(a),null;case 26:var m=a.type,v=a.memoizedState;return s===null?(Lr(a),v!==null?(sn(a),QS(a,v)):(sn(a),ig(a,m,null,h,l))):v?v!==s.memoizedState?(Lr(a),sn(a),QS(a,v)):(sn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Lr(a),sn(a),ig(a,m,s,h,l)),null;case 27:if(xe(a),l=le.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Lr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return sn(a),null}s=he.current,el(a)?M1(a):(s=ax(m,h,l),a.stateNode=s,Lr(a))}return sn(a),null;case 5:if(xe(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Lr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return sn(a),null}if(v=he.current,el(a))M1(a);else{var C=bd(le.current);switch(v){case 1:v=C.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=C.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=C.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?C.createElement(m,{is:h.is}):C.createElement(m)}}v[Ut]=a,v[re]=h;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=v;e:switch(mi(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&&Lr(a)}}return sn(a),ig(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Lr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=le.current,el(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,m=di,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Ut]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||Yw(s.nodeValue,l)),s||aa(a,!0)}else s=bd(s).createTextNode(h),s[Ut]=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[Ut]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),s=!1}else l=fm(),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[Ut]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),m=!1}else m=fm(),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),rd(a,a.updateQueue),sn(a),null);case 4:return $e(),s===null&&kg(a.stateNode.containerInfo),sn(a),null;case 10:return Er(a.type),sn(a),null;case 19:if(V(Rn),h=a.memoizedState,h===null)return sn(a),null;if(m=(a.flags&128)!==0,v=h.rendering,v===null)if(m)zc(h,!1);else{if(Sn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=Gh(s),v!==null){for(a.flags|=128,zc(h,!1),s=v.updateQueue,a.updateQueue=s,rd(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)T1(l,s),l=l.sibling;return J(Rn,Rn.current&1|2),kt&&Cr(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&it()>ud&&(a.flags|=128,m=!0,zc(h,!1),a.lanes=4194304)}else{if(!m)if(s=Gh(v),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,rd(a,s),zc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!kt)return sn(a),null}else 2*it()-h.renderingStartTime>ud&&l!==536870912&&(a.flags|=128,m=!0,zc(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=it(),s.sibling=null,l=Rn.current,J(Rn,m?l&1|2:l&1),kt&&Cr(a,h.treeForkCount),s):(sn(a),null);case 22:case 23:return rs(a),Em(),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&&rd(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),Er(Dn),sn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function qM(s,a){switch(hm(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Er(Dn),$e(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return xe(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(Rn),null;case 4:return $e(),null;case 10:return Er(a.type),null;case 22:case 23:return rs(a),Em(),s!==null&&V(oo),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Er(Dn),null;case 25:return null;default:return null}}function ew(s,a){switch(hm(a),a.tag){case 3:Er(Dn),$e();break;case 26:case 27:case 5:xe(a);break;case 4:$e();break;case 31:a.memoizedState!==null&&rs(a);break;case 13:rs(a);break;case 19:V(Rn);break;case 10:Er(a.type);break;case 22:case 23:rs(a),Em(),s!==null&&V(oo);break;case 24:Er(Dn)}}function Hc(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,C=l.inst;h=v(),C.destroy=h}l=l.next}while(l!==m)}}catch(I){Ht(a,a.return,I)}}function fa(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 C=h.inst,I=C.destroy;if(I!==void 0){C.destroy=void 0,m=a;var K=l,ne=I;try{ne()}catch(me){Ht(m,K,me)}}}h=h.next}while(h!==v)}}catch(me){Ht(a,a.return,me)}}function tw(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{q1(a,l)}catch(h){Ht(s,s.return,h)}}}function nw(s,a,l){l.props=fo(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){Ht(s,a,h)}}function Fc(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){Ht(s,a,m)}}function sr(s,a){var l=s.ref,h=s.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(m){Ht(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){Ht(s,a,m)}else l.current=null}function iw(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){Ht(s,s.return,m)}}function sg(s,a,l){try{var h=s.stateNode;f3(h,s.type,l,a),h[re]=a}catch(m){Ht(s,s.return,m)}}function sw(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ba(s.type)||s.tag===4}function rg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||sw(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&&ba(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 ag(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=ke));else if(h!==4&&(h===27&&ba(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(ag(s,a,l),s=s.sibling;s!==null;)ag(s,a,l),s=s.sibling}function ad(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&&ba(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(ad(s,a,l),s=s.sibling;s!==null;)ad(s,a,l),s=s.sibling}function rw(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);mi(a,h,l),a[Ut]=s,a[re]=l}catch(v){Ht(s,s.return,v)}}var Nr=!1,Bn=!1,og=!1,aw=typeof WeakSet=="function"?WeakSet:Set,Jn=null;function GM(s,a){if(s=s.containerInfo,Ag=Td,s=v1(s),em(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 C=0,I=-1,K=-1,ne=0,me=0,_e=s,ae=null;t:for(;;){for(var ce;_e!==l||m!==0&&_e.nodeType!==3||(I=C+m),_e!==v||h!==0&&_e.nodeType!==3||(K=C+h),_e.nodeType===3&&(C+=_e.nodeValue.length),(ce=_e.firstChild)!==null;)ae=_e,_e=ce;for(;;){if(_e===s)break t;if(ae===l&&++ne===m&&(I=C),ae===v&&++me===h&&(K=C),(ce=_e.nextSibling)!==null)break;_e=ae,ae=_e.parentNode}_e=ce}l=I===-1||K===-1?null:{start:I,end:K}}else l=null}l=l||{start:0,end:0}}else l=null;for(Rg={focusedElem:s,selectionRange:l},Td=!1,Jn=a;Jn!==null;)if(a=Jn,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Jn=s;else for(;Jn!==null;){switch(a=Jn,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(Ze){Ht(l,l.return,Ze)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Mg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Mg(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,Jn=s;break}Jn=a.return}}function ow(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Or(s,l),h&4&&Hc(5,l);break;case 1:if(Or(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(C){Ht(l,l.return,C)}else{var m=fo(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(C){Ht(l,l.return,C)}}h&64&&tw(l),h&512&&Fc(l,l.return);break;case 3:if(Or(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{q1(s,a)}catch(C){Ht(l,l.return,C)}}break;case 27:a===null&&h&4&&rw(l);case 26:case 5:Or(s,l),a===null&&h&4&&iw(l),h&512&&Fc(l,l.return);break;case 12:Or(s,l);break;case 31:Or(s,l),h&4&&uw(s,l);break;case 13:Or(s,l),h&4&&hw(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=t3.bind(null,l),S3(s,l))));break;case 22:if(h=l.memoizedState!==null||Nr,!h){a=a!==null&&a.memoizedState!==null||Bn,m=Nr;var v=Bn;Nr=h,(Bn=a)&&!v?Dr(s,l,(l.subtreeFlags&8772)!==0):Or(s,l),Nr=m,Bn=v}break;case 30:break;default:Or(s,l)}}function lw(s){var a=s.alternate;a!==null&&(s.alternate=null,lw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Oe(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 hn=null,Fi=!1;function Mr(s,a,l){for(l=l.child;l!==null;)cw(s,a,l),l=l.sibling}function cw(s,a,l){if(ie&&typeof ie.onCommitFiberUnmount=="function")try{ie.onCommitFiberUnmount(An,l)}catch{}switch(l.tag){case 26:Bn||sr(l,a),Mr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Bn||sr(l,a);var h=hn,m=Fi;ba(l.type)&&(hn=l.stateNode,Fi=!1),Mr(s,a,l),Zc(l.stateNode),hn=h,Fi=m;break;case 5:Bn||sr(l,a);case 6:if(h=hn,m=Fi,hn=null,Mr(s,a,l),hn=h,Fi=m,hn!==null)if(Fi)try{(hn.nodeType===9?hn.body:hn.nodeName==="HTML"?hn.ownerDocument.body:hn).removeChild(l.stateNode)}catch(v){Ht(l,a,v)}else try{hn.removeChild(l.stateNode)}catch(v){Ht(l,a,v)}break;case 18:hn!==null&&(Fi?(s=hn,tx(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Sl(s)):tx(hn,l.stateNode));break;case 4:h=hn,m=Fi,hn=l.stateNode.containerInfo,Fi=!0,Mr(s,a,l),hn=h,Fi=m;break;case 0:case 11:case 14:case 15:fa(2,l,a),Bn||fa(4,l,a),Mr(s,a,l);break;case 1:Bn||(sr(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&nw(l,a,h)),Mr(s,a,l);break;case 21:Mr(s,a,l);break;case 22:Bn=(h=Bn)||l.memoizedState!==null,Mr(s,a,l),Bn=h;break;default:Mr(s,a,l)}}function uw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Sl(s)}catch(l){Ht(a,a.return,l)}}}function hw(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){Ht(a,a.return,l)}}function KM(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new aw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new aw),a;default:throw Error(i(435,s.tag))}}function od(s,a){var l=KM(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var m=n3.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,C=a,I=C;e:for(;I!==null;){switch(I.tag){case 27:if(ba(I.type)){hn=I.stateNode,Fi=!1;break e}break;case 5:hn=I.stateNode,Fi=!1;break e;case 3:case 4:hn=I.stateNode.containerInfo,Fi=!0;break e}I=I.return}if(hn===null)throw Error(i(160));cw(v,C,m),hn=null,Fi=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)dw(a,s),a=a.sibling}var Us=null;function dw(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&&(fa(3,s,s.return),Hc(3,s),fa(5,s,s.return));break;case 1:Ui(a,s),Wi(s),h&512&&(Bn||l===null||sr(l,l.return)),h&64&&Nr&&(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=Us;if(Ui(a,s),Wi(s),h&512&&(Bn||l===null||sr(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[un]||v[Ut]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(h),m.head.insertBefore(v,m.querySelector("head > title"))),mi(v,h,l),v[Ut]=s,rt(v),h=v;break e;case"link":var C=dx("link","href",m).get(h+(l.href||""));if(C){for(var I=0;I<C.length;I++)if(v=C[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)){C.splice(I,1);break t}}v=m.createElement(h),mi(v,h,l),m.head.appendChild(v);break;case"meta":if(C=dx("meta","content",m).get(h+(l.content||""))){for(I=0;I<C.length;I++)if(v=C[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)){C.splice(I,1);break t}}v=m.createElement(h),mi(v,h,l),m.head.appendChild(v);break;default:throw Error(i(468,h))}v[Ut]=s,rt(v),h=v}s.stateNode=h}else fx(m,s.type,s.stateNode);else s.stateNode=hx(m,h,s.memoizedProps);else v!==h?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,h===null?fx(m,s.type,s.stateNode):hx(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&sg(s,s.memoizedProps,l.memoizedProps)}break;case 27:Ui(a,s),Wi(s),h&512&&(Bn||l===null||sr(l,l.return)),l!==null&&h&4&&sg(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Ui(a,s),Wi(s),h&512&&(Bn||l===null||sr(l,l.return)),s.flags&32){m=s.stateNode;try{Qe(m,"")}catch(Pe){Ht(s,s.return,Pe)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,sg(s,m,l!==null?l.memoizedProps:m)),h&1024&&(og=!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){Ht(s,s.return,Pe)}}break;case 3:if(xd=null,m=Us,Us=Sd(a.containerInfo),Ui(a,s),Us=m,Wi(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{Sl(a.containerInfo)}catch(Pe){Ht(s,s.return,Pe)}og&&(og=!1,fw(s));break;case 4:h=Us,Us=Sd(s.stateNode.containerInfo),Ui(a,s),Wi(s),Us=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,od(s,h)));break;case 13:Ui(a,s),Wi(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(cd=it()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,od(s,h)));break;case 22:m=s.memoizedState!==null;var K=l!==null&&l.memoizedState!==null,ne=Nr,me=Bn;if(Nr=ne||m,Bn=me||K,Ui(a,s),Bn=me,Nr=ne,Wi(s),h&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||K||Nr||Bn||po(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){K=l=a;try{if(v=K.stateNode,m)C=v.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{I=K.stateNode;var _e=K.memoizedProps.style,ae=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;I.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Pe){Ht(K,K.return,Pe)}}}else if(a.tag===6){if(l===null){K=a;try{K.stateNode.nodeValue=m?"":K.memoizedProps}catch(Pe){Ht(K,K.return,Pe)}}}else if(a.tag===18){if(l===null){K=a;try{var ce=K.stateNode;m?nx(ce,!0):nx(K.stateNode,!1)}catch(Pe){Ht(K,K.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,od(s,l))));break;case 19:Ui(a,s),Wi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,od(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(sw(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,v=rg(s);ad(s,v,m);break;case 5:var C=l.stateNode;l.flags&32&&(Qe(C,""),l.flags&=-33);var I=rg(s);ad(s,I,C);break;case 3:case 4:var K=l.stateNode.containerInfo,ne=rg(s);ag(s,ne,K);break;default:throw Error(i(161))}}catch(me){Ht(s,s.return,me)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function fw(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;fw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Or(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ow(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:fa(4,a,a.return),po(a);break;case 1:sr(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&nw(a,a.return,l),po(a);break;case 27:Zc(a.stateNode);case 26:case 5:sr(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 Dr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,m=s,v=a,C=v.flags;switch(v.tag){case 0:case 11:case 15:Dr(m,v,l),Hc(4,v);break;case 1:if(Dr(m,v,l),h=v,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ne){Ht(h,h.return,ne)}if(h=v,m=h.updateQueue,m!==null){var I=h.stateNode;try{var K=m.shared.hiddenCallbacks;if(K!==null)for(m.shared.hiddenCallbacks=null,m=0;m<K.length;m++)W1(K[m],I)}catch(ne){Ht(h,h.return,ne)}}l&&C&64&&tw(v),Fc(v,v.return);break;case 27:rw(v);case 26:case 5:Dr(m,v,l),l&&h===null&&C&4&&iw(v),Fc(v,v.return);break;case 12:Dr(m,v,l);break;case 31:Dr(m,v,l),l&&C&4&&uw(m,v);break;case 13:Dr(m,v,l),l&&C&4&&hw(m,v);break;case 22:v.memoizedState===null&&Dr(m,v,l),Fc(v,v.return);break;case 30:break;default:Dr(m,v,l)}a=a.sibling}}function lg(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&&Ac(l))}function cg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Ac(s))}function Ws(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)pw(s,a,l,h),a=a.sibling}function pw(s,a,l,h){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Ws(s,a,l,h),m&2048&&Hc(9,a);break;case 1:Ws(s,a,l,h);break;case 3:Ws(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&&Ac(s)));break;case 12:if(m&2048){Ws(s,a,l,h),s=a.stateNode;try{var v=a.memoizedProps,C=v.id,I=v.onPostCommit;typeof I=="function"&&I(C,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(K){Ht(a,a.return,K)}}else Ws(s,a,l,h);break;case 31:Ws(s,a,l,h);break;case 13:Ws(s,a,l,h);break;case 23:break;case 22:v=a.stateNode,C=a.alternate,a.memoizedState!==null?v._visibility&2?Ws(s,a,l,h):Uc(s,a):v._visibility&2?Ws(s,a,l,h):(v._visibility|=2,ul(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),m&2048&&lg(C,a);break;case 24:Ws(s,a,l,h),m&2048&&cg(a.alternate,a);break;default:Ws(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,C=a,I=l,K=h,ne=C.flags;switch(C.tag){case 0:case 11:case 15:ul(v,C,I,K,m),Hc(8,C);break;case 23:break;case 22:var me=C.stateNode;C.memoizedState!==null?me._visibility&2?ul(v,C,I,K,m):Uc(v,C):(me._visibility|=2,ul(v,C,I,K,m)),m&&ne&2048&&lg(C.alternate,C);break;case 24:ul(v,C,I,K,m),m&&ne&2048&&cg(C.alternate,C);break;default:ul(v,C,I,K,m)}a=a.sibling}}function Uc(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:Uc(l,h),m&2048&&lg(h.alternate,h);break;case 24:Uc(l,h),m&2048&&cg(h.alternate,h);break;default:Uc(l,h)}a=a.sibling}}var Wc=8192;function hl(s,a,l){if(s.subtreeFlags&Wc)for(s=s.child;s!==null;)mw(s,a,l),s=s.sibling}function mw(s,a,l){switch(s.tag){case 26:hl(s,a,l),s.flags&Wc&&s.memoizedState!==null&&O3(l,Us,s.memoizedState,s.memoizedProps);break;case 5:hl(s,a,l);break;case 3:case 4:var h=Us;Us=Sd(s.stateNode.containerInfo),hl(s,a,l),Us=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Wc,Wc=16777216,hl(s,a,l),Wc=h):hl(s,a,l));break;default:hl(s,a,l)}}function gw(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 qc(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];Jn=h,vw(h,s)}gw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)_w(s),s=s.sibling}function _w(s){switch(s.tag){case 0:case 11:case 15:qc(s),s.flags&2048&&fa(9,s,s.return);break;case 3:qc(s);break;case 12:qc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,ld(s)):qc(s);break;default:qc(s)}}function ld(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];Jn=h,vw(h,s)}gw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:fa(8,a,a.return),ld(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,ld(a));break;default:ld(a)}s=s.sibling}}function vw(s,a){for(;Jn!==null;){var l=Jn;switch(l.tag){case 0:case 11:case 15:fa(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:Ac(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,Jn=h;else e:for(l=s;Jn!==null;){h=Jn;var m=h.sibling,v=h.return;if(lw(h),h===l){Jn=null;break e}if(m!==null){m.return=v,Jn=m;break e}Jn=v}}}var VM={getCacheForType:function(s){var a=fi(Dn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return fi(Dn).controller.signal}},YM=typeof WeakMap=="function"?WeakMap:Map,It=0,Jt=null,yt=null,xt=0,zt=0,as=null,pa=!1,dl=!1,ug=!1,jr=0,Sn=0,ma=0,mo=0,hg=0,os=0,fl=0,Gc=null,qi=null,dg=!1,cd=0,yw=0,ud=1/0,hd=null,ga=null,Gn=0,_a=null,pl=null,Ir=0,fg=0,pg=null,bw=null,Kc=0,mg=null;function ls(){return(It&2)!==0&&xt!==0?xt&-xt:T.T!==null?Sg():Hs()}function Sw(){if(os===0)if((xt&536870912)===0||kt){var s=Rt;Rt<<=1,(Rt&3932160)===0&&(Rt=262144),os=s}else os=536870912;return s=ss.current,s!==null&&(s.flags|=32),os}function Gi(s,a,l){(s===Jt&&(zt===2||zt===9)||s.cancelPendingCommit!==null)&&(ml(s,0),va(s,xt,os,!1)),Lt(s,l),((It&2)===0||s!==Jt)&&(s===Jt&&((It&2)===0&&(mo|=l),Sn===4&&va(s,xt,os,!1)),rr(s))}function ww(s,a,l){if((It&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||pe(s,a),m=h?JM(s,a):_g(s,a,!0),v=h;do{if(m===0){dl&&!h&&va(s,a,0,!1);break}else{if(l=s.current.alternate,v&&!XM(l)){m=_g(s,a,!1),v=!1;continue}if(m===2){if(v=a,s.errorRecoveryDisabledLanes&v)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var I=s;m=Gc;var K=I.current.memoizedState.isDehydrated;if(K&&(ml(I,C).flags|=256),C=_g(I,C,!1),C!==2){if(ug&&!K){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=C}if(v=!1,m!==2)continue}}if(m===1){ml(s,0),va(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:va(h,a,os,!pa);break e;case 2:qi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=cd+300-it(),10<m)){if(va(h,a,os,!pa),G(h,0,!0)!==0)break e;Ir=a,h.timeoutHandle=Qw(xw.bind(null,h,l,qi,hd,dg,a,os,mo,fl,pa,v,"Throttled",-0,0),m);break e}xw(h,l,qi,hd,dg,a,os,mo,fl,pa,v,null,-0,0)}}break}while(!0);rr(s)}function xw(s,a,l,h,m,v,C,I,K,ne,me,_e,ae,ce){if(s.timeoutHandle=-1,_e=a.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ke},mw(a,v,_e);var Pe=(v&62914560)===v?cd-it():(v&4194048)===v?yw-it():0;if(Pe=D3(_e,Pe),Pe!==null){Ir=v,s.cancelPendingCommit=Pe(Nw.bind(null,s,a,v,l,h,m,C,I,K,me,_e,null,ae,ce)),va(s,v,C,!ne);return}}Nw(s,a,v,l,h,m,C,I,K)}function XM(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 va(s,a,l,h){a&=~hg,a&=~mo,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var m=a;0<m;){var v=31-Be(m),C=1<<v;h[v]=-1,m&=~C}l!==0&&Ne(s,l,a)}function dd(){return(It&6)===0?(Vc(0),!1):!0}function gg(){if(yt!==null){if(zt===0)var s=yt.return;else s=yt,kr=ro=null,Mm(s),rl=null,Lc=0,s=yt;for(;s!==null;)ew(s.alternate,s),s=s.return;yt=null}}function ml(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,g3(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Ir=0,gg(),Jt=s,yt=l=xr(s.current,null),xt=a,zt=0,as=null,pa=!1,dl=pe(s,a),ug=!1,fl=os=hg=mo=ma=Sn=0,qi=Gc=null,dg=!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-Be(h),v=1<<m;a|=s[m],h&=~v}return jr=a,Oh(),l}function Cw(s,a){ct=null,T.H=$c,a===sl||a===Hh?(a=z1(),zt=3):a===bm?(a=z1(),zt=4):zt=a===Vm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,as=a,yt===null&&(Sn=1,td(s,bs(a,s.current)))}function kw(){var s=ss.current;return s===null?!0:(xt&4194048)===xt?Cs===null:(xt&62914560)===xt||(xt&536870912)!==0?s===Cs:!1}function Ew(){var s=T.H;return T.H=$c,s===null?$c:s}function Tw(){var s=T.A;return T.A=VM,s}function fd(){Sn=4,pa||(xt&4194048)!==xt&&ss.current!==null||(dl=!0),(ma&134217727)===0&&(mo&134217727)===0||Jt===null||va(Jt,xt,os,!1)}function _g(s,a,l){var h=It;It|=2;var m=Ew(),v=Tw();(Jt!==s||xt!==a)&&(hd=null,ml(s,a)),a=!1;var C=Sn;e:do try{if(zt!==0&&yt!==null){var I=yt,K=as;switch(zt){case 8:gg(),C=6;break e;case 3:case 2:case 9:case 6:ss.current===null&&(a=!0);var ne=zt;if(zt=0,as=null,gl(s,I,K,ne),l&&dl){C=0;break e}break;default:ne=zt,zt=0,as=null,gl(s,I,K,ne)}}ZM(),C=Sn;break}catch(me){Cw(s,me)}while(!0);return a&&s.shellSuspendCounter++,kr=ro=null,It=h,T.H=m,T.A=v,yt===null&&(Jt=null,xt=0,Oh()),C}function ZM(){for(;yt!==null;)Aw(yt)}function JM(s,a){var l=It;It|=2;var h=Ew(),m=Tw();Jt!==s||xt!==a?(hd=null,ud=it()+500,ml(s,a)):dl=pe(s,a);e:do try{if(zt!==0&&yt!==null){a=yt;var v=as;t:switch(zt){case 1:zt=0,as=null,gl(s,a,v,1);break;case 2:case 9:if($1(v)){zt=0,as=null,Rw(a);break}a=function(){zt!==2&&zt!==9||Jt!==s||(zt=7),rr(s)},v.then(a,a);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:$1(v)?(zt=0,as=null,Rw(a)):(zt=0,as=null,gl(s,a,v,7));break;case 5:var C=null;switch(yt.tag){case 26:C=yt.memoizedState;case 5:case 27:var I=yt;if(C?px(C):I.stateNode.complete){zt=0,as=null;var K=I.sibling;if(K!==null)yt=K;else{var ne=I.return;ne!==null?(yt=ne,pd(ne)):yt=null}break t}}zt=0,as=null,gl(s,a,v,5);break;case 6:zt=0,as=null,gl(s,a,v,6);break;case 8:gg(),Sn=6;break e;default:throw Error(i(462))}}QM();break}catch(me){Cw(s,me)}while(!0);return kr=ro=null,T.H=h,T.A=m,It=l,yt!==null?0:(Jt=null,xt=0,Oh(),Sn)}function QM(){for(;yt!==null&&!we();)Aw(yt)}function Aw(s){var a=JS(s.alternate,s,jr);s.memoizedProps=s.pendingProps,a===null?pd(s):yt=a}function Rw(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=GS(l,a,a.pendingProps,a.type,void 0,xt);break;case 11:a=GS(l,a,a.pendingProps,a.type.render,a.ref,xt);break;case 5:Mm(a);default:ew(l,a),a=yt=T1(a,jr),a=JS(l,a,jr)}s.memoizedProps=s.pendingProps,a===null?pd(s):yt=a}function gl(s,a,l,h){kr=ro=null,Mm(a),rl=null,Lc=0;var m=a.return;try{if(HM(s,m,a,l,xt)){Sn=1,td(s,bs(l,s.current)),yt=null;return}}catch(v){if(m!==null)throw yt=m,v;Sn=1,td(s,bs(l,s.current)),yt=null;return}a.flags&32768?(kt||h===1?s=!0:dl||(xt&536870912)!==0?s=!1:(pa=s=!0,(h===2||h===9||h===3||h===6)&&(h=ss.current,h!==null&&h.tag===13&&(h.flags|=16384))),Lw(a,s)):pd(a)}function pd(s){var a=s;do{if((a.flags&32768)!==0){Lw(a,pa);return}s=a.return;var l=WM(a.alternate,a,jr);if(l!==null){yt=l;return}if(a=a.sibling,a!==null){yt=a;return}yt=a=s}while(a!==null);Sn===0&&(Sn=5)}function Lw(s,a){do{var l=qM(s.alternate,s);if(l!==null){l.flags&=32767,yt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){yt=s;return}yt=s=l}while(s!==null);Sn=6,yt=null}function Nw(s,a,l,h,m,v,C,I,K){s.cancelPendingCommit=null;do md();while(Gn!==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|=rm,Ie(s,l,v,C,I,K),s===Jt&&(yt=Jt=null,xt=0),pl=a,_a=s,Ir=l,fg=v,pg=m,bw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,i3(bi,function(){return Iw(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=T.T,T.T=null,m=R.p,R.p=2,C=It,It|=4;try{GM(s,a,l)}finally{It=C,R.p=m,T.T=h}}Gn=1,Mw(),Ow(),Dw()}}function Mw(){if(Gn===1){Gn=0;var s=_a,a=pl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var h=R.p;R.p=2;var m=It;It|=4;try{dw(a,s);var v=Rg,C=v1(s.containerInfo),I=v.focusedElem,K=v.selectionRange;if(C!==I&&I&&I.ownerDocument&&_1(I.ownerDocument.documentElement,I)){if(K!==null&&em(I)){var ne=K.start,me=K.end;if(me===void 0&&(me=ne),"selectionStart"in I)I.selectionStart=ne,I.selectionEnd=Math.min(me,I.value.length);else{var _e=I.ownerDocument||document,ae=_e&&_e.defaultView||window;if(ae.getSelection){var ce=ae.getSelection(),Pe=I.textContent.length,Ze=Math.min(K.start,Pe),Vt=K.end===void 0?Ze:Math.min(K.end,Pe);!ce.extend&&Ze>Vt&&(C=Vt,Vt=Ze,Ze=C);var Z=g1(I,Ze),X=g1(I,Vt);if(Z&&X&&(ce.rangeCount!==1||ce.anchorNode!==Z.node||ce.anchorOffset!==Z.offset||ce.focusNode!==X.node||ce.focusOffset!==X.offset)){var te=_e.createRange();te.setStart(Z.node,Z.offset),ce.removeAllRanges(),Ze>Vt?(ce.addRange(te),ce.extend(X.node,X.offset)):(te.setEnd(X.node,X.offset),ce.addRange(te))}}}}for(_e=[],ce=I;ce=ce.parentNode;)ce.nodeType===1&&_e.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<_e.length;I++){var ge=_e[I];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Td=!!Ag,Rg=Ag=null}finally{It=m,R.p=h,T.T=l}}s.current=a,Gn=2}}function Ow(){if(Gn===2){Gn=0;var s=_a,a=pl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var h=R.p;R.p=2;var m=It;It|=4;try{ow(s,a.alternate,a)}finally{It=m,R.p=h,T.T=l}}Gn=3}}function Dw(){if(Gn===4||Gn===3){Gn=0,qe();var s=_a,a=pl,l=Ir,h=bw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Gn=5:(Gn=0,pl=_a=null,jw(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ga=null),Wn(l),a=a.stateNode,ie&&typeof ie.onCommitFiberRoot=="function")try{ie.onCommitFiberRoot(An,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=T.T,m=R.p,R.p=2,T.T=null;try{for(var v=s.onRecoverableError,C=0;C<h.length;C++){var I=h[C];v(I.value,{componentStack:I.stack})}}finally{T.T=a,R.p=m}}(Ir&3)!==0&&md(),rr(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===mg?Kc++:(Kc=0,mg=s):Kc=0,Vc(0)}}function jw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Ac(a)))}function md(){return Mw(),Ow(),Dw(),Iw()}function Iw(){if(Gn!==5)return!1;var s=_a,a=fg;fg=0;var l=Wn(Ir),h=T.T,m=R.p;try{R.p=32>l?32:l,T.T=null,l=pg,pg=null;var v=_a,C=Ir;if(Gn=0,pl=_a=null,Ir=0,(It&6)!==0)throw Error(i(331));var I=It;if(It|=4,_w(v.current),pw(v,v.current,C,l),It=I,Vc(0,!1),ie&&typeof ie.onPostCommitFiberRoot=="function")try{ie.onPostCommitFiberRoot(An,v)}catch{}return!0}finally{R.p=m,T.T=h,jw(s,a)}}function Bw(s,a,l){a=bs(l,a),a=Km(s.stateNode,a,2),s=ua(s,a,2),s!==null&&(Lt(s,2),rr(s))}function Ht(s,a,l){if(s.tag===3)Bw(s,s,l);else for(;a!==null;){if(a.tag===3){Bw(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ga===null||!ga.has(h))){s=bs(l,s),l=$S(2),h=ua(a,l,2),h!==null&&(PS(l,h,a,s),Lt(h,2),rr(h));break}}a=a.return}}function vg(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new YM;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)||(ug=!0,m.add(l),s=e3.bind(null,s,a,l),a.then(s,s))}function e3(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,Jt===s&&(xt&l)===l&&(Sn===4||Sn===3&&(xt&62914560)===xt&&300>it()-cd?(It&2)===0&&ml(s,0):hg|=l,fl===xt&&(fl=0)),rr(s)}function $w(s,a){a===0&&(a=ze()),s=no(s,a),s!==null&&(Lt(s,a),rr(s))}function t3(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),$w(s,l)}function n3(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),$w(s,l)}function i3(s,a){return Tt(s,a)}var gd=null,_l=null,yg=!1,_d=!1,bg=!1,ya=0;function rr(s){s!==_l&&s.next===null&&(_l===null?gd=_l=s:_l=_l.next=s),_d=!0,yg||(yg=!0,r3())}function Vc(s,a){if(!bg&&_d){bg=!0;do for(var l=!1,h=gd;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var v=0;else{var C=h.suspendedLanes,I=h.pingedLanes;v=(1<<31-Be(42|s)+1)-1,v&=m&~(C&~I),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,Fw(h,v))}else v=xt,v=G(h,h===Jt?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||pe(h,v)||(l=!0,Fw(h,v));h=h.next}while(l);bg=!1}}function s3(){Pw()}function Pw(){_d=yg=!1;var s=0;ya!==0&&m3()&&(s=ya);for(var a=it(),l=null,h=gd;h!==null;){var m=h.next,v=zw(h,a);v===0?(h.next=null,l===null?gd=m:l.next=m,m===null&&(_l=l)):(l=h,(s!==0||(v&3)!==0)&&(_d=!0)),h=m}Gn!==0&&Gn!==5||Vc(s),ya!==0&&(ya=0)}function zw(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var C=31-Be(v),I=1<<C,K=m[C];K===-1?((I&l)===0||(I&h)!==0)&&(m[C]=ye(I,a)):K<=a&&(s.expiredLanes|=I),v&=~I}if(a=Jt,l=xt,l=G(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(zt===2||zt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Un(h),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||pe(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(h!==null&&Un(h),Wn(l)){case 2:case 8:l=cn;break;case 32:l=bi;break;case 268435456:l=_s;break;default:l=bi}return h=Hw.bind(null,s),l=Tt(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&Un(h),s.callbackPriority=2,s.callbackNode=null,2}function Hw(s,a){if(Gn!==0&&Gn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(md()&&s.callbackNode!==l)return null;var h=xt;return h=G(s,s===Jt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(ww(s,h,a),zw(s,it()),s.callbackNode!=null&&s.callbackNode===l?Hw.bind(null,s):null)}function Fw(s,a){if(md())return null;ww(s,a,!0)}function r3(){_3(function(){(It&6)!==0?Tt(vn,s3):Pw()})}function Sg(){if(ya===0){var s=nl;s===0&&(s=Ti,Ti<<=1,(Ti&261888)===0&&(Ti=256)),ya=s}return ya}function Uw(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:na(""+s)}function Ww(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 a3(s,a,l,h,m){if(a==="submit"&&l&&l.stateNode===m){var v=Uw((m[re]||null).action),C=h.submitter;C&&(a=(a=C[re]||null)?Uw(a.formAction):C.getAttribute("formAction"),a!==null&&(v=a,C=null));var I=new Rh("action","action",null,h,m);s.push({event:I,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(ya!==0){var K=C?Ww(m,C):new FormData(m);Hm(l,{pending:!0,data:K,method:m.method,action:v},null,K)}}else typeof v=="function"&&(I.preventDefault(),K=C?Ww(m,C):new FormData(m),Hm(l,{pending:!0,data:K,method:m.method,action:v},v,K))},currentTarget:m}]})}}for(var wg=0;wg<sm.length;wg++){var xg=sm[wg],o3=xg.toLowerCase(),l3=xg[0].toUpperCase()+xg.slice(1);Fs(o3,"on"+l3)}Fs(S1,"onAnimationEnd"),Fs(w1,"onAnimationIteration"),Fs(x1,"onAnimationStart"),Fs("dblclick","onDoubleClick"),Fs("focusin","onFocus"),Fs("focusout","onBlur"),Fs(CM,"onTransitionRun"),Fs(kM,"onTransitionStart"),Fs(EM,"onTransitionCancel"),Fs(C1,"onTransitionEnd"),be("onMouseEnter",["mouseout","mouseover"]),be("onMouseLeave",["mouseout","mouseover"]),be("onPointerEnter",["pointerout","pointerover"]),be("onPointerLeave",["pointerout","pointerover"]),Et("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Et("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Et("onBeforeInput",["compositionend","keypress","textInput","paste"]),Et("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Et("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Et("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yc="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(" "),c3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yc));function qw(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 C=h.length-1;0<=C;C--){var I=h[C],K=I.instance,ne=I.currentTarget;if(I=I.listener,K!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(me){Mh(me)}m.currentTarget=null,v=K}else for(C=0;C<h.length;C++){if(I=h[C],K=I.instance,ne=I.currentTarget,I=I.listener,K!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(me){Mh(me)}m.currentTarget=null,v=K}}}}function bt(s,a){var l=a[Wt];l===void 0&&(l=a[Wt]=new Set);var h=s+"__bubble";l.has(h)||(Gw(a,s,2,!1),l.add(h))}function Cg(s,a,l){var h=0;a&&(h|=4),Gw(l,s,h,a)}var vd="_reactListening"+Math.random().toString(36).slice(2);function kg(s){if(!s[vd]){s[vd]=!0,jt.forEach(function(l){l!=="selectionchange"&&(c3.has(l)||Cg(l,!1,s),Cg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[vd]||(a[vd]=!0,Cg("selectionchange",!1,a))}}function Gw(s,a,l,h){switch(Sx(a)){case 2:var m=B3;break;case 8:m=$3;break;default:m=zg}l=m.bind(null,a,l,s),m=void 0,!qp||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 Eg(s,a,l,h,m){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var I=h.stateNode.containerInfo;if(I===m)break;if(C===4)for(C=h.return;C!==null;){var K=C.tag;if((K===3||K===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;I!==null;){if(C=q(I),C===null)return;if(K=C.tag,K===5||K===6||K===26||K===27){h=v=C;continue e}I=I.parentNode}}h=h.return}kh(function(){var ne=v,me=lt(l),_e=[];e:{var ae=k1.get(s);if(ae!==void 0){var ce=Rh,Pe=s;switch(s){case"keypress":if(Th(l)===0)break e;case"keydown":case"keyup":ce=nM;break;case"focusin":Pe="focus",ce=Yp;break;case"focusout":Pe="blur",ce=Yp;break;case"beforeblur":case"afterblur":ce=Yp;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":ce=e1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=WN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=rM;break;case S1:case w1:case x1:ce=KN;break;case C1:ce=oM;break;case"scroll":case"scrollend":ce=FN;break;case"wheel":ce=cM;break;case"copy":case"cut":case"paste":ce=YN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=n1;break;case"toggle":case"beforetoggle":ce=hM}var Ze=(a&4)!==0,Vt=!Ze&&(s==="scroll"||s==="scrollend"),Z=Ze?ae!==null?ae+"Capture":null:ae;Ze=[];for(var X=ne,te;X!==null;){var ge=X;if(te=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||te===null||Z===null||(ge=_c(X,Z),ge!=null&&Ze.push(Xc(X,ge,te))),Vt)break;X=X.return}0<Ze.length&&(ae=new ce(ae,Pe,null,l,me),_e.push({event:ae,listeners:Ze}))}}if((a&7)===0){e:{if(ae=s==="mouseover"||s==="pointerover",ce=s==="mouseout"||s==="pointerout",ae&&l!==Ue&&(Pe=l.relatedTarget||l.fromElement)&&(q(Pe)||Pe[ot]))break e;if((ce||ae)&&(ae=me.window===me?me:(ae=me.ownerDocument)?ae.defaultView||ae.parentWindow:window,ce?(Pe=l.relatedTarget||l.toElement,ce=ne,Pe=Pe?q(Pe):null,Pe!==null&&(Vt=o(Pe),Ze=Pe.tag,Pe!==Vt||Ze!==5&&Ze!==27&&Ze!==6)&&(Pe=null)):(ce=null,Pe=ne),ce!==Pe)){if(Ze=e1,ge="onMouseLeave",Z="onMouseEnter",X="mouse",(s==="pointerout"||s==="pointerover")&&(Ze=n1,ge="onPointerLeave",Z="onPointerEnter",X="pointer"),Vt=ce==null?ae:Ae(ce),te=Pe==null?ae:Ae(Pe),ae=new Ze(ge,X+"leave",ce,l,me),ae.target=Vt,ae.relatedTarget=te,ge=null,q(me)===ne&&(Ze=new Ze(Z,X+"enter",Pe,l,me),Ze.target=te,Ze.relatedTarget=Vt,ge=Ze),Vt=ge,ce&&Pe)t:{for(Ze=u3,Z=ce,X=Pe,te=0,ge=Z;ge;ge=Ze(ge))te++;ge=0;for(var Ve=X;Ve;Ve=Ze(Ve))ge++;for(;0<te-ge;)Z=Ze(Z),te--;for(;0<ge-te;)X=Ze(X),ge--;for(;te--;){if(Z===X||X!==null&&Z===X.alternate){Ze=Z;break t}Z=Ze(Z),X=Ze(X)}Ze=null}else Ze=null;ce!==null&&Kw(_e,ae,ce,Ze,!1),Pe!==null&&Vt!==null&&Kw(_e,Vt,Pe,Ze,!0)}}e:{if(ae=ne?Ae(ne):window,ce=ae.nodeName&&ae.nodeName.toLowerCase(),ce==="select"||ce==="input"&&ae.type==="file")var Nt=u1;else if(l1(ae))if(h1)Nt=SM;else{Nt=yM;var We=vM}else ce=ae.nodeName,!ce||ce.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?ne&&ta(ne.elementType)&&(Nt=u1):Nt=bM;if(Nt&&(Nt=Nt(s,ne))){c1(_e,Nt,l,me);break e}We&&We(s,ae,ne),s==="focusout"&&ne&&ae.type==="number"&&ne.memoizedProps.value!=null&&qo(ae,"number",ae.value)}switch(We=ne?Ae(ne):window,s){case"focusin":(l1(We)||We.contentEditable==="true")&&(Vo=We,tm=ne,kc=null);break;case"focusout":kc=tm=Vo=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,y1(_e,l,me);break;case"selectionchange":if(xM)break;case"keydown":case"keyup":y1(_e,l,me)}var ut;if(Zp)e:{switch(s){case"compositionstart":var Ct="onCompositionStart";break e;case"compositionend":Ct="onCompositionEnd";break e;case"compositionupdate":Ct="onCompositionUpdate";break e}Ct=void 0}else Ko?a1(s,l)&&(Ct="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ct="onCompositionStart");Ct&&(i1&&l.locale!=="ko"&&(Ko||Ct!=="onCompositionStart"?Ct==="onCompositionEnd"&&Ko&&(ut=J0()):(ia=me,Gp="value"in ia?ia.value:ia.textContent,Ko=!0)),We=yd(ne,Ct),0<We.length&&(Ct=new t1(Ct,s,null,l,me),_e.push({event:Ct,listeners:We}),ut?Ct.data=ut:(ut=o1(l),ut!==null&&(Ct.data=ut)))),(ut=fM?pM(s,l):mM(s,l))&&(Ct=yd(ne,"onBeforeInput"),0<Ct.length&&(We=new t1("onBeforeInput","beforeinput",null,l,me),_e.push({event:We,listeners:Ct}),We.data=ut)),a3(_e,s,ne,l,me)}qw(_e,a)})}function Xc(s,a,l){return{instance:s,listener:a,currentTarget:l}}function yd(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=_c(s,l),m!=null&&h.unshift(Xc(s,m,v)),m=_c(s,a),m!=null&&h.push(Xc(s,m,v))),s.tag===3)return h;s=s.return}return[]}function u3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Kw(s,a,l,h,m){for(var v=a._reactName,C=[];l!==null&&l!==h;){var I=l,K=I.alternate,ne=I.stateNode;if(I=I.tag,K!==null&&K===h)break;I!==5&&I!==26&&I!==27||ne===null||(K=ne,m?(ne=_c(l,v),ne!=null&&C.unshift(Xc(l,ne,K))):m||(ne=_c(l,v),ne!=null&&C.push(Xc(l,ne,K)))),l=l.return}C.length!==0&&s.push({event:a,listeners:C})}var h3=/\r\n?/g,d3=/\u0000|\uFFFD/g;function Vw(s){return(typeof s=="string"?s:""+s).replace(h3,`
|
|
9
|
+
`).replace(d3,"")}function Yw(s,a){return a=Vw(a),Vw(s)===a}function Kt(s,a,l,h,m,v){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Qe(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Qe(s,""+h);break;case"className":Ai(s,"class",h);break;case"tabIndex":Ai(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Ai(s,l,h);break;case"style":Pt(s,h,v);break;case"data":if(a!=="object"){Ai(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=na(""+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"&&Kt(s,a,"name",m.name,m,null),Kt(s,a,"formEncType",m.formEncType,m,null),Kt(s,a,"formMethod",m.formMethod,m,null),Kt(s,a,"formTarget",m.formTarget,m,null)):(Kt(s,a,"encType",m.encType,m,null),Kt(s,a,"method",m.method,m,null),Kt(s,a,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=na(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=ke);break;case"onScroll":h!=null&&bt("scroll",s);break;case"onScrollEnd":h!=null&&bt("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=na(""+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":bt("beforetoggle",s),bt("toggle",s),qn(s,"popover",h);break;case"xlinkActuate":Si(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Si(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Si(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Si(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Si(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Si(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Si(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Si(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Si(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":qn(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=Sr.get(l)||l,qn(s,l,h))}}function Tg(s,a,l,h,m,v){switch(l){case"style":Pt(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"?Qe(s,h):(typeof h=="number"||typeof h=="bigint")&&Qe(s,""+h);break;case"onScroll":h!=null&&bt("scroll",s);break;case"onScrollEnd":h!=null&&bt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=ke);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zt.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[re]||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,""):qn(s,l,h)}}}function mi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":bt("error",s),bt("load",s);var h=!1,m=!1,v;for(v in l)if(l.hasOwnProperty(v)){var C=l[v];if(C!=null)switch(v){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Kt(s,a,v,C,l,null)}}m&&Kt(s,a,"srcSet",l.srcSet,l,null),h&&Kt(s,a,"src",l.src,l,null);return;case"input":bt("invalid",s);var I=v=C=m=null,K=null,ne=null;for(h in l)if(l.hasOwnProperty(h)){var me=l[h];if(me!=null)switch(h){case"name":m=me;break;case"type":C=me;break;case"checked":K=me;break;case"defaultChecked":ne=me;break;case"value":v=me;break;case"defaultValue":I=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(i(137,a));break;default:Kt(s,a,h,me,l,null)}}Ja(s,v,I,K,ne,C,m,!1);return;case"select":bt("invalid",s),h=C=v=null;for(m in l)if(l.hasOwnProperty(m)&&(I=l[m],I!=null))switch(m){case"value":v=I;break;case"defaultValue":C=I;break;case"multiple":h=I;default:Kt(s,a,m,I,l,null)}a=v,l=C,s.multiple=!!h,a!=null?hi(s,!!h,a,!1):l!=null&&hi(s,!!h,l,!0);return;case"textarea":bt("invalid",s),v=m=h=null;for(C in l)if(l.hasOwnProperty(C)&&(I=l[C],I!=null))switch(C){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:Kt(s,a,C,I,l,null)}Go(s,h,m,v);return;case"option":for(K in l)l.hasOwnProperty(K)&&(h=l[K],h!=null)&&(K==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":Kt(s,a,K,h,l,null));return;case"dialog":bt("beforetoggle",s),bt("toggle",s),bt("cancel",s),bt("close",s);break;case"iframe":case"object":bt("load",s);break;case"video":case"audio":for(h=0;h<Yc.length;h++)bt(Yc[h],s);break;case"image":bt("error",s),bt("load",s);break;case"details":bt("toggle",s);break;case"embed":case"source":case"link":bt("error",s),bt("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:Kt(s,a,ne,h,l,null)}return;default:if(ta(a)){for(me in l)l.hasOwnProperty(me)&&(h=l[me],h!==void 0&&Tg(s,a,me,h,l,void 0));return}}for(I in l)l.hasOwnProperty(I)&&(h=l[I],h!=null&&Kt(s,a,I,h,l,null))}function f3(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,C=null,I=null,K=null,ne=null,me=null;for(ce in l){var _e=l[ce];if(l.hasOwnProperty(ce)&&_e!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":K=_e;default:h.hasOwnProperty(ce)||Kt(s,a,ce,null,h,_e)}}for(var ae in h){var ce=h[ae];if(_e=l[ae],h.hasOwnProperty(ae)&&(ce!=null||_e!=null))switch(ae){case"type":v=ce;break;case"name":m=ce;break;case"checked":ne=ce;break;case"defaultChecked":me=ce;break;case"value":C=ce;break;case"defaultValue":I=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,a));break;default:ce!==_e&&Kt(s,a,ae,ce,h,_e)}}pc(s,C,I,K,ne,me,v,m);return;case"select":ce=C=I=ae=null;for(v in l)if(K=l[v],l.hasOwnProperty(v)&&K!=null)switch(v){case"value":break;case"multiple":ce=K;default:h.hasOwnProperty(v)||Kt(s,a,v,null,h,K)}for(m in h)if(v=h[m],K=l[m],h.hasOwnProperty(m)&&(v!=null||K!=null))switch(m){case"value":ae=v;break;case"defaultValue":I=v;break;case"multiple":C=v;default:v!==K&&Kt(s,a,m,v,h,K)}a=I,l=C,h=ce,ae!=null?hi(s,!!l,ae,!1):!!h!=!!l&&(a!=null?hi(s,!!l,a,!0):hi(s,!!l,l?[]:"",!1));return;case"textarea":ce=ae=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:Kt(s,a,I,null,h,m)}for(C in h)if(m=h[C],v=l[C],h.hasOwnProperty(C)&&(m!=null||v!=null))switch(C){case"value":ae=m;break;case"defaultValue":ce=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&Kt(s,a,C,m,h,v)}xh(s,ae,ce);return;case"option":for(var Pe in l)ae=l[Pe],l.hasOwnProperty(Pe)&&ae!=null&&!h.hasOwnProperty(Pe)&&(Pe==="selected"?s.selected=!1:Kt(s,a,Pe,null,h,ae));for(K in h)ae=h[K],ce=l[K],h.hasOwnProperty(K)&&ae!==ce&&(ae!=null||ce!=null)&&(K==="selected"?s.selected=ae&&typeof ae!="function"&&typeof ae!="symbol":Kt(s,a,K,ae,h,ce));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 Ze in l)ae=l[Ze],l.hasOwnProperty(Ze)&&ae!=null&&!h.hasOwnProperty(Ze)&&Kt(s,a,Ze,null,h,ae);for(ne in h)if(ae=h[ne],ce=l[ne],h.hasOwnProperty(ne)&&ae!==ce&&(ae!=null||ce!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,a));break;default:Kt(s,a,ne,ae,h,ce)}return;default:if(ta(a)){for(var Vt in l)ae=l[Vt],l.hasOwnProperty(Vt)&&ae!==void 0&&!h.hasOwnProperty(Vt)&&Tg(s,a,Vt,void 0,h,ae);for(me in h)ae=h[me],ce=l[me],!h.hasOwnProperty(me)||ae===ce||ae===void 0&&ce===void 0||Tg(s,a,me,ae,h,ce);return}}for(var Z in l)ae=l[Z],l.hasOwnProperty(Z)&&ae!=null&&!h.hasOwnProperty(Z)&&Kt(s,a,Z,null,h,ae);for(_e in h)ae=h[_e],ce=l[_e],!h.hasOwnProperty(_e)||ae===ce||ae==null&&ce==null||Kt(s,a,_e,ae,h,ce)}function Xw(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function p3(){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,C=m.initiatorType,I=m.duration;if(v&&I&&Xw(C)){for(C=0,I=m.responseEnd,h+=1;h<l.length;h++){var K=l[h],ne=K.startTime;if(ne>I)break;var me=K.transferSize,_e=K.initiatorType;me&&Xw(_e)&&(K=K.responseEnd,C+=me*(K<I?1:(I-ne)/(K-ne)))}if(--h,a+=8*(v+C)/(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 Ag=null,Rg=null;function bd(s){return s.nodeType===9?s:s.ownerDocument}function Zw(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 Jw(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 Lg(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 Ng=null;function m3(){var s=window.event;return s&&s.type==="popstate"?s===Ng?!1:(Ng=s,!0):(Ng=null,!1)}var Qw=typeof setTimeout=="function"?setTimeout:void 0,g3=typeof clearTimeout=="function"?clearTimeout:void 0,ex=typeof Promise=="function"?Promise:void 0,_3=typeof queueMicrotask=="function"?queueMicrotask:typeof ex<"u"?function(s){return ex.resolve(null).then(s).catch(v3)}:Qw;function v3(s){setTimeout(function(){throw s})}function ba(s){return s==="head"}function tx(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")Zc(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Zc(l);for(var v=l.firstChild;v;){var C=v.nextSibling,I=v.nodeName;v[un]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=C}}else l==="body"&&Zc(s.ownerDocument.body);l=m}while(l);Sl(a)}function nx(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 Mg(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":Mg(l),Oe(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function y3(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[un])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=ks(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=ks(s.nextSibling),s===null))return null;return s}function ix(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ks(s.nextSibling),s===null))return null;return s}function Og(s){return s.data==="$?"||s.data==="$~"}function Dg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function S3(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 ks(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var jg=null;function sx(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return ks(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function rx(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 ax(s,a,l){switch(a=bd(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 Zc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Oe(s)}var Es=new Map,ox=new Set;function Sd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Br=R.d;R.d={f:w3,r:x3,D:C3,C:k3,L:E3,m:T3,X:R3,S:A3,M:L3};function w3(){var s=Br.f(),a=dd();return s||a}function x3(s){var a=se(s);a!==null&&a.tag===5&&a.type==="form"?CS(a):Br.r(s)}var vl=typeof document>"u"?null:document;function lx(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+'"]'),ox.has(m)||(ox.add(m),s={rel:s,crossOrigin:l,href:a},h.querySelector(m)===null&&(a=h.createElement("link"),mi(a,"link",s),rt(a),h.head.appendChild(a)))}}function C3(s){Br.D(s),lx("dns-prefetch",s,null)}function k3(s,a){Br.C(s,a),lx("preconnect",s,a)}function E3(s,a,l){Br.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)}Es.has(v)||(s=g({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Es.set(v,s),h.querySelector(m)!==null||a==="style"&&h.querySelector(Jc(v))||a==="script"&&h.querySelector(Qc(v))||(a=h.createElement("link"),mi(a,"link",s),rt(a),h.head.appendChild(a)))}}function T3(s,a){Br.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(!Es.has(v)&&(s=g({rel:"modulepreload",href:s},a),Es.set(v,s),l.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Qc(v)))return}h=l.createElement("link"),mi(h,"link",s),rt(h),l.head.appendChild(h)}}}function A3(s,a,l){Br.S(s,a,l);var h=vl;if(h&&s){var m=st(h).hoistableStyles,v=yl(s);a=a||"default";var C=m.get(v);if(!C){var I={loading:0,preload:null};if(C=h.querySelector(Jc(v)))I.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Es.get(v))&&Ig(s,l);var K=C=h.createElement("link");rt(K),mi(K,"link",s),K._p=new Promise(function(ne,me){K.onload=ne,K.onerror=me}),K.addEventListener("load",function(){I.loading|=1}),K.addEventListener("error",function(){I.loading|=2}),I.loading|=4,wd(C,a,h)}C={type:"stylesheet",instance:C,count:1,state:I},m.set(v,C)}}}function R3(s,a){Br.X(s,a);var l=vl;if(l&&s){var h=st(l).hoistableScripts,m=bl(s),v=h.get(m);v||(v=l.querySelector(Qc(m)),v||(s=g({src:s,async:!0},a),(a=Es.get(m))&&Bg(s,a),v=l.createElement("script"),rt(v),mi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function L3(s,a){Br.M(s,a);var l=vl;if(l&&s){var h=st(l).hoistableScripts,m=bl(s),v=h.get(m);v||(v=l.querySelector(Qc(m)),v||(s=g({src:s,async:!0,type:"module"},a),(a=Es.get(m))&&Bg(s,a),v=l.createElement("script"),rt(v),mi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function cx(s,a,l,h){var m=(m=le.current)?Sd(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=st(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=st(m).hoistableStyles,C=v.get(s);if(C||(m=m.ownerDocument||m,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,C),(v=m.querySelector(Jc(s)))&&!v._p&&(C.instance=v,C.state.loading=5),Es.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Es.set(s,l),v||N3(m,s,l,C.state))),a&&h===null)throw Error(i(528,""));return C}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=st(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 Jc(s){return'link[rel="stylesheet"]['+s+"]"}function ux(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function N3(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}),mi(a,"link",l),rt(a),s.head.appendChild(a))}function bl(s){return'[src="'+zi(s)+'"]'}function Qc(s){return"script[async]"+s}function hx(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,rt(h),h;var m=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),rt(h),mi(h,"style",m),wd(h,l.precedence,s),a.instance=h;case"stylesheet":m=yl(l.href);var v=s.querySelector(Jc(m));if(v)return a.state.loading|=4,a.instance=v,rt(v),v;h=ux(l),(m=Es.get(m))&&Ig(h,m),v=(s.ownerDocument||s).createElement("link"),rt(v);var C=v;return C._p=new Promise(function(I,K){C.onload=I,C.onerror=K}),mi(v,"link",h),a.state.loading|=4,wd(v,l.precedence,s),a.instance=v;case"script":return v=bl(l.src),(m=s.querySelector(Qc(v)))?(a.instance=m,rt(m),m):(h=l,(m=Es.get(v))&&(h=g({},l),Bg(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),rt(m),mi(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,wd(h,l.precedence,s));return a.instance}function wd(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,C=0;C<h.length;C++){var I=h[C];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 Ig(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Bg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var xd=null;function dx(s,a,l){if(xd===null){var h=new Map,m=xd=new Map;m.set(l,h)}else m=xd,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[un]||v[Ut]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var C=v.getAttribute(a)||"";C=s+C;var I=h.get(C);I?I.push(v):h.set(C,[v])}}return h}function fx(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function M3(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 px(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function O3(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(Jc(m));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Cd.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=v,rt(v);return}v=a.ownerDocument||a,h=ux(h),(m=Es.get(m))&&Ig(h,m),v=v.createElement("link"),rt(v);var C=v;C._p=new Promise(function(I,K){C.onload=I,C.onerror=K}),mi(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=Cd.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var $g=0;function D3(s,a){return s.stylesheets&&s.count===0&&Ed(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&Ed(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&$g===0&&($g=62500*p3());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Ed(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>$g?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Cd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ed(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var kd=null;function Ed(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,kd=new Map,a.forEach(j3,s),kd=null,Cd.call(s))}function j3(s,a){if(!(a.state.loading&4)){var l=kd.get(s);if(l)var h=l.get(null);else{l=new Map,kd.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var C=m[v];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(l.set(C.dataset.precedence,C),h=C)}h&&l.set(null,h)}m=a.instance,C=m.getAttribute("data-precedence"),v=l.get(C)||h,v===h&&l.set(null,m),l.set(C,m),this.count++,h=Cd.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 eu={$$typeof:z,Provider:null,Consumer:null,_currentValue:N,_currentValue2:N,_threadCount:0};function I3(s,a,l,h,m,v,C,I,K){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=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function mx(s,a,l,h,m,v,C,I,K,ne,me,_e){return s=new I3(s,a,l,C,K,ne,me,_e,I),a=1,v===!0&&(a|=24),v=is(3,null,null,a),s.current=v,v.stateNode=s,a=_m(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:l,cache:a},Sm(v),s}function gx(s){return s?(s=Zo,s):Zo}function _x(s,a,l,h,m,v){m=gx(m),h.context===null?h.context=m:h.pendingContext=m,h=ca(a),h.payload={element:l},v=v===void 0?null:v,v!==null&&(h.callback=v),l=ua(s,h,a),l!==null&&(Gi(l,s,a),Mc(l,s,a))}function vx(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Pg(s,a){vx(s,a),(s=s.alternate)&&vx(s,a)}function yx(s){if(s.tag===13||s.tag===31){var a=no(s,67108864);a!==null&&Gi(a,s,67108864),Pg(s,67108864)}}function bx(s){if(s.tag===13||s.tag===31){var a=ls();a=gt(a);var l=no(s,a);l!==null&&Gi(l,s,a),Pg(s,a)}}var Td=!0;function B3(s,a,l,h){var m=T.T;T.T=null;var v=R.p;try{R.p=2,zg(s,a,l,h)}finally{R.p=v,T.T=m}}function $3(s,a,l,h){var m=T.T;T.T=null;var v=R.p;try{R.p=8,zg(s,a,l,h)}finally{R.p=v,T.T=m}}function zg(s,a,l,h){if(Td){var m=Hg(h);if(m===null)Eg(s,a,h,Ad,l),wx(s,h);else if(z3(m,s,a,l,h))h.stopPropagation();else if(wx(s,h),a&4&&-1<P3.indexOf(s)){for(;m!==null;){var v=se(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var C=Ft(v.pendingLanes);if(C!==0){var I=v;for(I.pendingLanes|=2,I.entangledLanes|=2;C;){var K=1<<31-Be(C);I.entanglements[1]|=K,C&=~K}rr(v),(It&6)===0&&(ud=it()+500,Vc(0))}}break;case 31:case 13:I=no(v,2),I!==null&&Gi(I,v,2),dd(),Pg(v,2)}if(v=Hg(h),v===null&&Eg(s,a,h,Ad,l),v===m)break;m=v}m!==null&&h.stopPropagation()}else Eg(s,a,h,null,l)}}function Hg(s){return s=lt(s),Fg(s)}var Ad=null;function Fg(s){if(Ad=null,s=q(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=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 Ad=s,null}function Sx(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(Ei()){case vn:return 2;case cn:return 8;case bi:case zs:return 32;case _s:return 268435456;default:return 32}default:return 32}}var Ug=!1,Sa=null,wa=null,xa=null,tu=new Map,nu=new Map,Ca=[],P3="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 wx(s,a){switch(s){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":wa=null;break;case"mouseover":case"mouseout":xa=null;break;case"pointerover":case"pointerout":tu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(a.pointerId)}}function iu(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=se(a),a!==null&&yx(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function z3(s,a,l,h,m){switch(a){case"focusin":return Sa=iu(Sa,s,a,l,h,m),!0;case"dragenter":return wa=iu(wa,s,a,l,h,m),!0;case"mouseover":return xa=iu(xa,s,a,l,h,m),!0;case"pointerover":var v=m.pointerId;return tu.set(v,iu(tu.get(v)||null,s,a,l,h,m)),!0;case"gotpointercapture":return v=m.pointerId,nu.set(v,iu(nu.get(v)||null,s,a,l,h,m)),!0}return!1}function xx(s){var a=q(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,es(s.priority,function(){bx(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,es(s.priority,function(){bx(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 Rd(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=Hg(s.nativeEvent);if(l===null){l=s.nativeEvent;var h=new l.constructor(l.type,l);Ue=h,l.target.dispatchEvent(h),Ue=null}else return a=se(l),a!==null&&yx(a),s.blockedOn=l,!1;a.shift()}return!0}function Cx(s,a,l){Rd(s)&&l.delete(a)}function H3(){Ug=!1,Sa!==null&&Rd(Sa)&&(Sa=null),wa!==null&&Rd(wa)&&(wa=null),xa!==null&&Rd(xa)&&(xa=null),tu.forEach(Cx),nu.forEach(Cx)}function Ld(s,a){s.blockedOn===a&&(s.blockedOn=null,Ug||(Ug=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,H3)))}var Nd=null;function kx(s){Nd!==s&&(Nd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nd===s&&(Nd=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(Fg(h||l)===null)continue;break}var v=se(l);v!==null&&(s.splice(a,3),a-=3,Hm(v,{pending:!0,data:m,method:l.method,action:h},h,m))}}))}function Sl(s){function a(K){return Ld(K,s)}Sa!==null&&Ld(Sa,s),wa!==null&&Ld(wa,s),xa!==null&&Ld(xa,s),tu.forEach(a),nu.forEach(a);for(var l=0;l<Ca.length;l++){var h=Ca[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<Ca.length&&(l=Ca[0],l.blockedOn===null);)xx(l),l.blockedOn===null&&Ca.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],C=m[re]||null;if(typeof v=="function")C||kx(l);else if(C){var I=null;if(v&&v.hasAttribute("formAction")){if(m=v,C=v[re]||null)I=C.formAction;else if(Fg(m)!==null)continue}else I=C.action;typeof I=="function"?l[h+1]=I:(l.splice(h,3),h-=3),kx(l)}}}function Ex(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(C){return m=C})},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 Wg(s){this._internalRoot=s}Md.prototype.render=Wg.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=ls();_x(l,h,s,a,null,null)},Md.prototype.unmount=Wg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;_x(s.current,2,null,s,null,null),dd(),a[ot]=null}};function Md(s){this._internalRoot=s}Md.prototype.unstable_scheduleHydration=function(s){if(s){var a=Hs();s={blockedOn:null,target:s,priority:a};for(var l=0;l<Ca.length&&a!==0&&a<Ca[l].priority;l++);Ca.splice(l,0,s),l===0&&xx(s)}};var Tx=t.version;if(Tx!=="19.2.7")throw Error(i(527,Tx,"19.2.7"));R.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?_(s):null,s=s===null?null:s.stateNode,s};var F3={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Od=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Od.isDisabled&&Od.supportsFiber)try{An=Od.inject(F3),ie=Od}catch{}}return ru.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,h="",m=DS,v=jS,C=IS;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&&(C=a.onRecoverableError)),a=mx(s,1,!1,null,null,l,h,null,m,v,C,Ex),s[ot]=a.current,kg(s),new Wg(a)},ru.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var h=!1,m="",v=DS,C=jS,I=IS,K=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&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(I=l.onRecoverableError),l.formState!==void 0&&(K=l.formState)),a=mx(s,1,!0,a,l??null,h,m,K,v,C,I,Ex),a.context=gx(null),l=a.current,h=ls(),h=gt(h),m=ca(h),m.callback=null,ua(l,m,h),l=h,a.current.lanes=l,Lt(a,l),rr(a),s[ot]=a.current,kg(s),new Md(a)},ru.version="19.2.7",ru}var $x;function R6(){if($x)return Vg.exports;$x=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(),Vg.exports=A6(),Vg.exports}var L6=R6();var Px="popstate";function zx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function N6(e={}){function t(i,r){let o=r.state?.masked,{pathname:c,search:d,hash:p}=o||i.location;return Tv("",{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:Xu(r)}return O6(t,n,null,e)}function dn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function M6(){return Math.random().toString(36).substring(2,10)}function Hx(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 Tv(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||M6(),mask:r}}function Xu({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 O6(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,c=r.history,d="POP",p=null,f=_();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function _(){return(c.state||{idx:null}).idx}function g(){d="POP";let k=_(),A=k==null?null:k-f;f=k,p&&p({action:d,location:x.location,delta:A})}function b(k,A){d="PUSH";let B=zx(k)?k:Tv(x.location,k,A);f=_()+1;let z=Hx(B,f),E=x.createHref(B.mask||B);try{c.pushState(z,"",E)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;r.location.assign(E)}o&&p&&p({action:d,location:x.location,delta:1})}function S(k,A){d="REPLACE";let B=zx(k)?k:Tv(x.location,k,A);f=_();let z=Hx(B,f),E=x.createHref(B.mask||B);c.replaceState(z,"",E),o&&p&&p({action:d,location:x.location,delta:0})}function w(k){return D6(r,k)}let x={get action(){return d},get location(){return e(r,c)},listen(k){if(p)throw new Error("A history only accepts one active listener");return r.addEventListener(Px,g),p=k,()=>{r.removeEventListener(Px,g),p=null}},createHref(k){return t(r,k)},createURL:w,encodeLocation(k){let A=w(k);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:b,replace:S,go(k){return c.go(k)}};return x}function D6(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),dn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Xu(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function YE(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=Xr(o.pathname||"/",n);if(c==null)return null;let d=I6(e),p=null,f=V6(c);for(let _=0;p==null&&_<d.length;++_)p=G6(d[_],f,i);return p}function I6(e){let t=XE(e);return B6(t),t}function XE(e,t=[],n=[],i="",r=!1){let o=(c,d,p=r,f)=>{let _={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(_.relativePath.startsWith("/")){if(!_.relativePath.startsWith(i)&&p)return;dn(_.relativePath.startsWith(i),`Absolute route path "${_.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),_.relativePath=_.relativePath.slice(i.length)}let g=Vs([i,_.relativePath]),b=n.concat(_);c.children&&c.children.length>0&&(dn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),XE(c.children,t,b,g,p)),!(c.path==null&&!c.index)&&t.push({path:g,score:W6(g,c.index),routesMeta:b})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))o(c,d);else for(let p of ZE(c.path))o(c,d,!0,p)}),t}function ZE(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=ZE(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 B6(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:q6(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var $6=/^:[\w-]+$/,P6=3,z6=2,H6=1,F6=10,U6=-2,Fx=e=>e==="*";function W6(e,t){let n=e.split("/"),i=n.length;return n.some(Fx)&&(i+=U6),t&&(i+=z6),n.filter(r=>!Fx(r)).reduce((r,o)=>r+($6.test(o)?P6:o===""?H6:F6),i)}function q6(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 G6(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,_=o==="/"?t:t.slice(o.length)||"/",g=$f({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},_),b=p.route;if(!g&&f&&n&&!i[i.length-1].route.index&&(g=$f({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},_)),!g)return null;Object.assign(r,g.params),c.push({params:r,pathname:Vs([o,g.pathname]),pathnameBase:J6(Vs([o,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(o=Vs([o,g.pathnameBase]))}return c}function $f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=K6(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:_,isOptional:g},b)=>{if(_==="*"){let w=d[b]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[b];return g&&!S?f[_]=void 0:f[_]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:c,pattern:e}}function K6(e,t=!1,n=!0){Xs(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,_)=>{if(i.push({paramName:d,isOptional:p!=null}),p){let g=_.charAt(f+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 V6(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xs(!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 Xr(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 Y6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function X6(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?sc(e):e,o;return n?(n=JE(n),n.startsWith("/")?o=Ux(n.substring(1),"/"):o=Ux(n,t)):o=t,{pathname:o,search:Q6(i),hash:e4(r)}}function Ux(e,t){let n=Pf(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Jg(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 Z6(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Lb(e){let t=Z6(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function bp(e,t,n,i=!1){let r;typeof e=="string"?r=sc(e):(r={...e},dn(!r.pathname||!r.pathname.includes("?"),Jg("?","pathname","search",r)),dn(!r.pathname||!r.pathname.includes("#"),Jg("#","pathname","hash",r)),dn(!r.search||!r.search.includes("#"),Jg("#","search","hash",r)));let o=e===""||r.pathname==="",c=o?"/":r.pathname,d;if(c==null)d=n;else{let g=t.length-1;if(!i&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;r.pathname=b.join("/")}d=g>=0?t[g]:"/"}let p=X6(r,d),f=c&&c!=="/"&&c.endsWith("/"),_=(o||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(f||_)&&(p.pathname+="/"),p}var JE=e=>e.replace(/\/\/+/g,"/"),Vs=e=>JE(e.join("/")),Pf=e=>e.replace(/\/+$/,""),J6=e=>Pf(e).replace(/^\/*/,"/"),Q6=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,e4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,t4=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 n4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function i4(e){let t=e.map(n=>n.route.path).filter(Boolean);return Vs(t)||"/"}var QE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function e5(e,t){let n=e;if(typeof n!="string"||!Y6.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(QE)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Xr(c.pathname,t);c.origin===o.origin&&d!=null?n=d+c.search+c.hash:r=!0}catch{Xs(!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 t5=["POST","PUT","PATCH","DELETE"];new Set(t5);var s4=["GET",...t5];new Set(s4);var rc=y.createContext(null);rc.displayName="DataRouter";var Sp=y.createContext(null);Sp.displayName="DataRouterState";var n5=y.createContext(!1);function r4(){return y.useContext(n5)}var i5=y.createContext({isTransitioning:!1});i5.displayName="ViewTransition";var a4=y.createContext(new Map);a4.displayName="Fetchers";var o4=y.createContext(null);o4.displayName="Await";var gs=y.createContext(null);gs.displayName="Navigation";var ph=y.createContext(null);ph.displayName="Location";var yr=y.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Nb=y.createContext(null);Nb.displayName="RouteError";var s5="REACT_ROUTER_ERROR",l4="REDIRECT",c4="ROUTE_ERROR_RESPONSE";function u4(e){if(e.startsWith(`${s5}:${l4}:{`))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 h4(e){if(e.startsWith(`${s5}:${c4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new t4(t.status,t.statusText,t.data)}catch{}}function d4(e,{relative:t}={}){dn(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}=mh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Vs([n,o])),i.createHref({pathname:d,search:c,hash:r})}function ac(){return y.useContext(ph)!=null}function Ps(){return dn(ac(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(ph).location}var r5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function a5(e){y.useContext(gs).static||y.useLayoutEffect(e)}function oc(){let{isDataRoute:e}=y.useContext(yr);return e?k4():f4()}function f4(){dn(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(yr),{pathname:r}=Ps(),o=JSON.stringify(Lb(i)),c=y.useRef(!1);return a5(()=>{c.current=!0}),y.useCallback((p,f={})=>{if(Xs(c.current,r5),!c.current)return;if(typeof p=="number"){n.go(p);return}let _=bp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(_.pathname=_.pathname==="/"?t:Vs([t,_.pathname])),(f.replace?n.replace:n.push)(_,f.state,f)},[t,n,o,r,e])}y.createContext(null);function mh(e,{relative:t}={}){let{matches:n}=y.useContext(yr),{pathname:i}=Ps(),r=JSON.stringify(Lb(n));return y.useMemo(()=>bp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function p4(e,t){return o5(e,t)}function o5(e,t,n){dn(ac(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(gs),{matches:r}=y.useContext(yr),o=r[r.length-1],c=o?o.params:{},d=o?o.pathname:"/",p=o?o.pathnameBase:"/",f=o&&o.route;{let k=f&&f.path||"";c5(d,!f||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let _=Ps(),g;if(t){let k=typeof t=="string"?sc(t):t;dn(p==="/"||k.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 "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=_;let b=g.pathname||"/",S=b;if(p!=="/"){let k=p.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(k=>Object.assign(k,{route:n.manifest[k.route.id]||k.route})):YE(e,{pathname:S});Xs(f||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Xs(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 "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=y4(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Vs([p,i.encodeLocation?i.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:Vs([p,i.encodeLocation?i.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),r,n);return t&&x?y.createElement(ph.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},x):x}function m4(){let e=C4(),t=n4(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 g4=y.createElement(m4,null),l5=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=h4(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(yr.Provider,{value:this.props.routeContext},y.createElement(Nb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(_4,{error:e},t):t}};l5.contextType=n5;var Qg=new WeakMap;function _4({children:e,error:t}){let{basename:n}=y.useContext(gs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=u4(t.digest);if(i){let r=Qg.get(t);if(r)throw r;let o=e5(i.location,n);if(QE&&!Qg.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 Qg.set(t,c),c}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function v4({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(yr.Provider,{value:e},n)}function y4(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 _=r.findIndex(g=>g.route.id&&o?.[g.route.id]!==void 0);dn(_>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,_+1))}let c=!1,d=-1;if(n&&i){c=i.renderFallback;for(let _=0;_<r.length;_++){let g=r[_];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=_),g.route.id){let{loaderData:b,errors:S}=i,w=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!S||S[g.route.id]===void 0);if(g.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(_,{location:i.location,params:i.matches?.[0]?.params??{},pattern:i4(i.matches),errorInfo:g})}:void 0;return r.reduceRight((_,g,b)=>{let S,w=!1,x=null,k=null;i&&(S=o&&g.route.id?o[g.route.id]:void 0,x=g.route.errorElement||g4,c&&(d<0&&b===0?(c5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):d===b&&(w=!0,k=g.route.hydrateFallbackElement||null)));let A=t.concat(r.slice(0,b+1)),B=()=>{let z;return S?z=x:w?z=k:g.route.Component?z=y.createElement(g.route.Component,null):g.route.element?z=g.route.element:z=_,y.createElement(v4,{match:g,routeContext:{outlet:_,matches:A,isDataRoute:i!=null},children:z})};return i&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?y.createElement(l5,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:B(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:f}):B()},null)}function Mb(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 dn(t,Mb(e)),t}function S4(e){let t=y.useContext(Sp);return dn(t,Mb(e)),t}function w4(e){let t=y.useContext(yr);return dn(t,Mb(e)),t}function Ob(e){let t=w4(e),n=t.matches[t.matches.length-1];return dn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function x4(){return Ob("useRouteId")}function C4(){let e=y.useContext(Nb),t=S4("useRouteError"),n=Ob("useRouteError");return e!==void 0?e:t.errors?.[n]}function k4(){let{router:e}=b4("useNavigate"),t=Ob("useNavigate"),n=y.useRef(!1);return a5(()=>{n.current=!0}),y.useCallback(async(r,o={})=>{Xs(n.current,r5),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var Wx={};function c5(e,t,n){!t&&!Wx[e]&&(Wx[e]=!0,Xs(!1,n))}y.memo(E4);function E4({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return o5(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function e_({to:e,replace:t,state:n,relative:i}){dn(ac(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=y.useContext(gs);Xs(!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(yr),{pathname:c}=Ps(),d=oc(),p=bp(e,Lb(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 Ll(e){dn(!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 T4({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:c}){dn(!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:_="",hash:g="",state:b=null,key:S="default",mask:w}=n,x=y.useMemo(()=>{let k=Xr(f,d);return k==null?null:{location:{pathname:k,search:_,hash:g,state:b,key:S,mask:w},navigationType:i}},[d,f,_,g,b,S,i,w]);return Xs(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(ph.Provider,{children:t,value:x}))}function A4({children:e,location:t}){return p4(Av(e),t)}function Av(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,Av(i.props.children,o));return}dn(i.type===Ll,`[${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>`),dn(!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=Av(i.props.children,o)),n.push(c)}),n}var ff="get",pf="application/x-www-form-urlencoded";function wp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function R4(e){return wp(e)&&e.tagName.toLowerCase()==="button"}function L4(e){return wp(e)&&e.tagName.toLowerCase()==="form"}function N4(e){return wp(e)&&e.tagName.toLowerCase()==="input"}function M4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function O4(e,t){return e.button===0&&(!t||t==="_self")&&!M4(e)}var Dd=null;function D4(){if(Dd===null)try{new FormData(document.createElement("form"),0),Dd=!1}catch{Dd=!0}return Dd}var j4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function t_(e){return e!=null&&!j4.has(e)?(Xs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pf}"`),null):e}function I4(e,t){let n,i,r,o,c;if(L4(e)){let d=e.getAttribute("action");i=d?Xr(d,t):null,n=e.getAttribute("method")||ff,r=t_(e.getAttribute("enctype"))||pf,o=new FormData(e)}else if(R4(e)||N4(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?Xr(p,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||ff,r=t_(e.getAttribute("formenctype"))||t_(d.getAttribute("enctype"))||pf,o=new FormData(d,e),!D4()){let{name:f,type:_,value:g}=e;if(_==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,g)}}else{if(wp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ff,i=null,r=pf,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 Db(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function u5(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&&Xr(r.pathname,t)==="/"?r.pathname=`${Pf(t)}/_root.${i}`:r.pathname=`${Pf(r.pathname)}.${i}`,r}async function B4(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 $4(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 P4(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let c=await B4(o,n);return c.links?c.links():[]}return[]}));return U4(i.flat(1).filter($4).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function qx(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 _=i.routes[p.route.id];if(!_||!_.hasLoader)return!1;if(c(p,f)||d(p,f))return!0;if(p.route.shouldRevalidate){let g=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 g=="boolean")return g}return!0}):[]}function z4(e,t,{includeHydrateFallback:n}={}){return H4(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 H4(e){return[...new Set(e)]}function F4(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function U4(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(F4(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function jb(){let e=y.useContext(rc);return Db(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function W4(){let e=y.useContext(Sp);return Db(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ib=y.createContext(void 0);Ib.displayName="FrameworkContext";function Bb(){let e=y.useContext(Ib);return Db(e,"You must render this element inside a <HydratedRouter> element"),e}function q4(e,t){let n=y.useContext(Ib),[i,r]=y.useState(!1),[o,c]=y.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:f,onMouseLeave:_,onTouchStart:g}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=A=>{A.forEach(B=>{c(B.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return b.current&&k.observe(b.current),()=>{k.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:au(d,S),onBlur:au(p,w),onMouseEnter:au(f,S),onMouseLeave:au(_,w),onTouchStart:au(g,S)}]:[!1,b,{}]}function au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function G4({page:e,...t}){let n=r4(),{router:i}=jb(),r=y.useMemo(()=>YE(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?y.createElement(V4,{page:e,matches:r,...t}):y.createElement(Y4,{page:e,matches:r,...t}):null}function K4(e){let{manifest:t,routeModules:n}=Bb(),[i,r]=y.useState([]);return y.useEffect(()=>{let o=!1;return P4(e,t,n).then(c=>{o||r(c)}),()=>{o=!0}},[e,t,n]),i}function V4({page:e,matches:t,...n}){let i=Ps(),{future:r}=Bb(),{basename:o}=jb(),c=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=u5(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let _ of t)typeof _.route.shouldRevalidate=="function"?p=!0:f.push(_.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 Y4({page:e,matches:t,...n}){let i=Ps(),{future:r,manifest:o,routeModules:c}=Bb(),{basename:d}=jb(),{loaderData:p,matches:f}=W4(),_=y.useMemo(()=>qx(e,t,f,o,i,"data"),[e,t,f,o,i]),g=y.useMemo(()=>qx(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,k=!1;if(t.forEach(B=>{let z=o.routes[B.route.id];!z||!z.hasLoader||(!_.some(E=>E.route.id===B.route.id)&&B.route.id in p&&c[B.route.id]?.shouldRevalidate||z.hasClientLoader?k=!0:x.add(B.route.id))}),x.size===0)return[];let A=u5(e,d,r.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&A.searchParams.set("_routes",t.filter(B=>x.has(B.route.id)).map(B=>B.route.id).join(",")),[A.pathname+A.search]},[d,r.v8_trailingSlashAwareDataRequests,p,i,o,_,t,e,c]),S=y.useMemo(()=>z4(g,o),[g,o]),w=K4(g);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:k})=>y.createElement("link",{key:x,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function X4(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Z4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Z4&&(window.__reactRouterVersion="7.17.0")}catch{}function J4({basename:e,children:t,useTransitions:n,window:i}){let r=y.useRef();r.current==null&&(r.current=N6({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(T4,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:n})}var h5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Zu=y.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:c,mask:d,state:p,target:f,to:_,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:k,navigator:A,useTransitions:B}=y.useContext(gs),z=typeof _=="string"&&h5.test(_),E=e5(_,k);_=E.to;let M=d4(_,{relative:r}),j=Ps(),H=null;if(d){let D=bp(d,[],j.mask?j.mask.pathname:"/",!0);k!=="/"&&(D.pathname=D.pathname==="/"?k:Vs([k,D.pathname])),H=A.createHref(D)}let[U,Q,oe]=q4(i,w),Y=nO(_,{replace:c,mask:d,state:p,target:f,preventScrollReset:g,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:B});function $(D){t&&t(D),D.defaultPrevented||Y(D)}let L=!(E.isExternal||o),P=y.createElement("a",{...w,...oe,href:(L?H:void 0)||E.absoluteURL||M,onClick:L?$:t,ref:X4(x,Q),target:f,"data-discover":!z&&n==="render"?"true":void 0});return U&&!z?y.createElement(y.Fragment,null,P,y.createElement(G4,{page:M})):P});Zu.displayName="Link";var Q4=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:c,viewTransition:d,children:p,...f},_){let g=mh(c,{relative:f.relative}),b=Ps(),S=y.useContext(Sp),{navigator:w,basename:x}=y.useContext(gs),k=S!=null&&oO(g)&&d===!0,A=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,B=b.pathname,z=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(B=B.toLowerCase(),z=z?z.toLowerCase():null,A=A.toLowerCase()),z&&x&&(z=Xr(z,x)||z);const E=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let M=B===A||!r&&B.startsWith(A)&&B.charAt(E)==="/",j=z!=null&&(z===A||!r&&z.startsWith(A)&&z.charAt(A.length)==="/"),H={isActive:M,isPending:j,isTransitioning:k},U=M?t:void 0,Q;typeof i=="function"?Q=i(H):Q=[i,M?"active":null,j?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let oe=typeof o=="function"?o(H):o;return y.createElement(Zu,{...f,"aria-current":U,className:Q,ref:_,style:oe,to:c,viewTransition:d},typeof p=="function"?p(H):p)});Q4.displayName="NavLink";var eO=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:c=ff,action:d,onSubmit:p,relative:f,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=y.useContext(gs),k=rO(),A=aO(d,{relative:f}),B=c.toLowerCase()==="get"?"get":"post",z=typeof d=="string"&&h5.test(d),E=M=>{if(p&&p(M),M.defaultPrevented)return;M.preventDefault();let j=M.nativeEvent.submitter,H=j?.getAttribute("formmethod")||c,U=()=>k(j||M.currentTarget,{fetcherKey:t,method:H,navigate:n,replace:r,state:o,relative:f,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:b});x&&n!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:w,method:B,action:A,onSubmit:i?p:E,...S,"data-discover":!z&&e==="render"?"true":void 0})});eO.displayName="Form";function tO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function d5(e){let t=y.useContext(rc);return dn(t,tO(e)),t}function nO(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p,useTransitions:f}={}){let _=oc(),g=Ps(),b=mh(e,{relative:c});return y.useCallback(S=>{if(O4(S,t)){S.preventDefault();let w=n!==void 0?n:Xu(g)===Xu(b),x=()=>_(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 iO=0,sO=()=>`__${String(++iO)}__`;function rO(){let{router:e}=d5("useSubmit"),{basename:t}=y.useContext(gs),n=x4(),i=e.fetch,r=e.navigate;return y.useCallback(async(o,c={})=>{let{action:d,method:p,encType:f,formData:_,body:g}=I4(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:_,body:g,formMethod:c.method||p,formEncType:c.encType||f,flushSync:c.flushSync})}else await r(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:_,body:g,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 aO(e,{relative:t}={}){let{basename:n}=y.useContext(gs),i=y.useContext(yr);dn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...mh(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(_=>_==="")){d.delete("index"),p.filter(g=>g).forEach(g=>d.append("index",g));let _=d.toString();o.search=_?`?${_}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Vs([n,o.pathname])),Xu(o)}function oO(e,{relative:t}={}){let n=y.useContext(i5);dn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=d5("useViewTransitionState"),r=mh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Xr(n.currentLocation.pathname,i)||n.currentLocation.pathname,c=Xr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return $f(r.pathname,c)!=null||$f(r.pathname,o)!=null}var Va=VE();const lO=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let en=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function Gx(e){return(await f5(e)).theaters}async function f5(e){const t=await fetch("/api/v1/theaters",{signal:e});await li(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new en(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>Pb(i,t.status))}}async function cO(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await li(i),bO(await i.json(),i.status)}async function uO(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await li(t),SO(await t.json(),t.status)}async function hO(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 li(i),xO(await i.json(),i.status)}async function dO(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await li(t),wO(await t.json(),t.status)}async function p5(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await li(n);const i=await n.json();return Pb(i,n.status)}async function fO(e,t,n){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:t}),signal:n});return await li(i),Pb(await i.json(),i.status)}async function pO(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 li(n),AO(await n.json(),n.status)}async function m5(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 li(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new en(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 li(n),await n.json()}async function gO(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 li(i),await i.json()}async function _O(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await li(n)}async function Xi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await li(i);const r=await i.json();if(!Array.isArray(r.operations))throw new en(i.status,"Invalid operations response");return r.operations.map(o=>_5(o,i.status))}async function bo(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await li(i);const r=await i.json();if(!Array.isArray(r.groups))throw new en(i.status,"Invalid groups response");return r.groups.map(o=>$b(o,i.status))}async function vO(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await li(n);const i=await n.json();return $b(i.group,n.status)}async function n_(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 li(i);const r=await i.json();return $b(r.group,i.status)}async function yO(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await li(n)}async function g5(e,t,n){return mf(e,{title:t},n)}async function mf(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 li(i);const r=await i.json();return _5(r.operation,i.status)}function _5(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"||Ju(n)||Ju(n.payload))throw new en(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 $b(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 en(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function Pb(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"||Ju(n))throw new en(t,"Invalid Theater response");return{id:n.id,label:n.label,createdAt:n.createdAt,lastOpenedAt:n.lastOpenedAt,...typeof n.order=="number"&&Number.isInteger(n.order)&&n.order>=0?{order:n.order}:{},hasWiki:n.hasWiki,activeAdmiralCount:n.activeAdmiralCount}}function 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 en(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 SO(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 en(t,"Invalid environment response");return n}function wO(e,t){const n=e;if(!n||n.status!=="accepted")throw new en(t,"Invalid update response");return{status:"accepted"}}function xO(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 en(t,"Invalid release notes response");return{notes:n.notes.map(i=>CO(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function CO(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 en(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>kO(i,t)),localizationFallback:n.localizationFallback}}function kO(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 en(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>EO(i,t))}}function EO(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&&!TO(n.product))throw new en(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 TO(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function AO(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)||Ju(n))throw new en(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=>RO(i,t)),truncated:n.truncated===!0?!0:void 0}}function RO(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||Ju(n))throw new en(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function Ju(e){if(!e||typeof e!="object")return!1;const t=e;return lO.some(n=>n in t)}async function li(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 en(e.status,t)}function Kx(e,t){return e!==null&&e===t?e:null}const LO="__unassigned__";function NO(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(DO(i,t.get(i.theaterId)));return n}function MO(e,t){const n=v5(t);return n.length===0?e:e.filter(i=>{const r=jO(i);return n.every(o=>r.includes(o))})}function OO(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??LO,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 v5(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function DO(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function jO(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const IO=200,BO=.5,$O="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",PO=["monospace","serif","sans-serif"],Lu=new Map;function zO(e,t={}){const n=xp(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=Lu.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=PO.some(p=>{const f=Vx(c,`${y5(n)}, ${p}`),_=Vx(c,p);return Math.abs(f-_)>BO});return HO(i,d,t.maxEntries??IO),d}function y5(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function zf(e,t){const n=xp(e);return n?`${y5(n)}, ${t}`:t}function xp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Vx(e,t){return e.font=`28px ${t}`,e.measureText($O).width}function HO(e,t,n){if(Lu.size>=Math.max(1,n)){const i=Lu.keys().next().value;i&&Lu.delete(i)}Lu.set(e,t)}const Ul={min:12,max:18,step:1,defaultValue:14},Uu={source:"builtin",id:"manrope",size:Ul.defaultValue},Hf=[{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 FO(e){if(!e||typeof e!="object")return Uu;const t=e,n=UO(t.size);if(t.source==="builtin"&&qO(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=xp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Uu}function UO(e){return typeof e!="number"||!Number.isInteger(e)||e<Ul.min||e>Ul.max?Ul.defaultValue:e}function b5(e){return e.source==="system"?zf(e.familyName,Hf[0].family):WO(e.id).family}function WO(e){return Hf.find(t=>t.id===e)??Hf[0]}function qO(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const Rv="fleet-console.activeTheaterId",S5="fleet-console.commissioningSeen",w5="fleet-console.whatsNewSeenVersion",x5="fleet-console.notificationPreferences",C5=1,GO="instrument",jd={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Lv=new Set;let Yx=0,Nv=null,Xe={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:GO,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:wD(),codexReader:null,codexReaderExpanded:!1};function jo(){return Xe}function k5(e){return Lv.add(e),()=>{Lv.delete(e)}}function mt(e){Xe={...Xe,...e},vD()}function KO(e){Xe.operationsViewActive!==e&&mt({operationsViewActive:e})}function Ff(e){JO(e),mt({activeTheme:e})}function Mv(e){eD(e)}function VO(e){mt({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,...O5({...Xe,version:e.version})})}function YO(){mt({releaseNotesLoading:!0,releaseNotesError:null})}function XO(e){const t={...Xe,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Xe.selectedReleaseNoteKey&&j5(e.notes,Xe.selectedReleaseNoteKey)?Xe.selectedReleaseNoteKey:D5(e.notes)};mt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...O5(t)})}function ZO(e){mt({releaseNotesLoading:!1,releaseNotesError:e})}function JO(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function QO(){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 eD(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",b5(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function Ov(e){const t=M5(e,Xe.activeTheaterId);mt({theaters:e,activeTheaterId:t})}function tD(e){Ov(e.theaters)}function fs(e){mt({operations:e,operationsHydrated:!0})}function nD(e){const t=new Set(e.map(i=>i.id)),n=Xe.operations.filter(i=>!t.has(i.id));mt({operations:[...e,...n],operationsHydrated:!0})}function iD(e){const t=Xe.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Xe.operations];n[t]=e,mt({operations:n})}function So(e){mt({groups:e})}function sD(e){Cp(e),mt({activeTheaterId:e})}function Di(e){Xe.activeOperationId!==e&&mt({activeOperationId:e})}function rD(e,t){if(t==="idle"){E5(e);return}Xe.operationStatus[e]!==t&&mt({operationStatus:{...Xe.operationStatus,[e]:t}})}function E5(e){if(!(e in Xe.operationStatus))return;const t={...Xe.operationStatus};delete t[e],mt({operationStatus:t})}function aD(e){if(!e.operationId)return;const t=Xe.operations.find(c=>c.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Xe.theaters.find(c=>c.id===n)?.label??n??"Unknown",r=t.title,o=bD(e.kind);Yx+=1,mt({operationNotifications:{...Xe.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:Yx}}})}function T5(){mt({addingTheater:!0,theaterError:null})}function A5(e){const t=[e,...Xe.theaters.filter(n=>n.id!==e.id)];Cp(e.id),mt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function oD(){mt({addingTheater:!1,theaterError:null})}function Dv(e){mt({addingTheater:!1,theaterError:e})}function Qu(e){const t=Xe.operations.find(n=>n.id===e);t&&(Cp(t.theaterId),mt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:N5(Xe.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function lD(){Xe.pendingOperationFocus!==null&&mt({pendingOperationFocus:null})}function cD(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(jv);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:jv(i,r)})}function R5(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 uD(e,t,n,i,r){const o=new Set(r),c=R5(e,t,n,i),d=c.filter(p=>!o.has(p.id));return(d.length>0?d:c).map(p=>p.id)}function jv(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function i_(){mt({operationSearchOpen:!1})}function L5(){mt({operationSearchOpen:!Xe.operationSearchOpen})}function hD(){Xe.releaseNotes.length===0||Xe.whatsNewOpen||mt({whatsNewOpen:!0,selectedReleaseNoteKey:Xe.selectedReleaseNoteKey??D5(Xe.releaseNotes)})}function Id(){Xe.whatsNewOpen&&(Xe.automaticWhatsNewVersion&&ED(Xe.automaticWhatsNewVersion),mt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function Xx(e){j5(Xe.releaseNotes,e)&&mt({selectedReleaseNoteKey:e})}function ou(){CD(!0),Xe.onboardingOpen&&mt({onboardingOpen:!1})}function hr(e){mt({codexReader:e,codexReaderExpanded:!1})}function gf(){Xe.codexReader!==null&&mt({codexReaderExpanded:!0})}function dD(){mt({codexReaderExpanded:!1})}function s_(){mt({codexReader:null,codexReaderExpanded:!1})}function Zx(){if(Xe.bootstrapped)return;const e=Xe.theaters.length===0&&!xD();mt({bootstrapped:!0,onboardingOpen:e?!0:Xe.onboardingOpen})}function Jx(e){const t=Xe.theaters.filter(c=>c.id!==e),n=M5(t,Xe.activeTheaterId===e?null:Xe.activeTheaterId),i=yD(Xe.operationNotifications,e),r=new Set(Xe.operations.filter(c=>c.theaterId===e).map(c=>c.id)),o=Xe.activeOperationId&&r.has(Xe.activeOperationId)?null:Xe.activeOperationId;Cp(n),mt({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function fD(e){const t=N5(Xe.operationNotifications,e);t!==Xe.operationNotifications&&mt({operationNotifications:t})}function pD(e){const t={...Xe.notificationPreferences,globalMute:e};Fb(t),mt({notificationPreferences:t})}function mD(e){const t={...Xe.notificationPreferences,dnd:e};Fb(t),mt({notificationPreferences:t})}function gD(e){const t={...Xe.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Xe.notificationPreferences,mutedTheaterIds:t};Fb(n),mt({notificationPreferences:n})}function _D(e){return NO(e)}function vD(){for(const e of Lv)e()}function N5(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function yD(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 M5(e,t){const n=new Set(e.map(r=>r.id)),i=SD();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function bD(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function O5(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||kD()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:Hb(n.version,t)}}function D5(e){return e[0]?Hb(e[0].version,0):null}function j5(e,t){return e.some((n,i)=>Hb(n.version,i)===t)}function Hb(e,t){return`${e}:${t}`}function SD(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Rv)}catch{return null}}function Cp(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Rv,e):window.localStorage.removeItem(Rv)}catch{}}function wD(){if(typeof window>"u")return jd;try{const e=window.localStorage.getItem(x5);if(!e)return jd;const t=JSON.parse(e);return TD(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:jd}catch{return jd}}function xD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(S5)==="1"}catch{return!1}}function CD(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(S5,"1")}catch{}}function kD(){if(Nv!==null)return Nv;if(typeof window>"u")return null;try{return window.localStorage.getItem(w5)}catch{return null}}function ED(e){if(Nv=e,!(typeof window>"u"))try{window.localStorage.setItem(w5,e)}catch{}}function Fb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(x5,JSON.stringify({version:C5,preferences:e}))}catch{}}function TD(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==C5||!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 er(){return y.useSyncExternalStore(k5,jo,jo)}const AD=[{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"}]}],Nu="data-keyboard-shortcuts-open",RD='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function I5(){return document.body.getAttribute(Nu)==="true"}function LD(){return!I5()}function ND({onClose:e}){const t=y.useRef(null);y.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Nu);return document.body.setAttribute(Nu,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Nu):document.body.setAttribute(Nu,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(RD)??[]];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:"✕"})]}),AD.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 MD=1400,OD="https://github.com/sbluemin/fleet-harness",DD="https://github.com/sbluemin/fleet-harness/stargazers",jD="https://api.github.com/repos/sbluemin/fleet-harness",Ub="fleet-console.github-stars",ID=360*60*1e3,Qx='[role="menuitem"]:not([disabled])';function BD(){const e=er();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(PD,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(zD,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function $D({className:e="brand-foot-home"}){return u.jsxs(Zu,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(ZD,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function PD({latestVersion:e,updateAvailable:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),d=oc();B5(n,i,r,o,c);const p=f=>{c(!1),d(f),window.requestAnimationFrame(()=>{const _=document.querySelector("main h2, h2");_?.focus?.(),_&&document.activeElement!==_&&(_.setAttribute("tabindex","-1"),_.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(eC,{}),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(eC,{}),u.jsx("span",{children:"Settings"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(HD,{latestVersion:e})]}):null]}):null]})}function zD({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 B5(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(JD,{})}),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),hD()},children:[u.jsx(QD,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),p(!0)},children:[u.jsx(ej,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(FD,{menuItem:!0,version:t})]}):null,d?u.jsx(ND,{onClose:()=>{p(!1),i.current?.focus()}}):null]})}function B5(e,t,n,i,r){y.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(Qx)?.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(Qx)??[]];if(f.length===0)return;p.preventDefault();const _=f.findIndex(b=>b===document.activeElement),g=p.key==="Home"||p.key==="ArrowDown"&&_===f.length-1?0:p.key==="End"||p.key==="ArrowUp"&&_<=0?f.length-1:p.key==="ArrowDown"?_+1:_-1;f[g]?.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 HD({latestVersion:e}){const[t,n]=y.useState("idle"),[i,r]=y.useState(null),o=y.useRef(null),c=UD(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 dO()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},MD)}catch(p){const f=p instanceof en?p.message:"network_error";r(f),n(qD(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 FD({menuItem:e=!1,version:t}){const n=GD(),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:OD,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(tj,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:DD,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(nj,{}),i?u.jsx("span",{className:"brand-foot-github-stars-count",children:XD(n.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function UD(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"?WD(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 WD(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 qD(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function GD(){const[e,t]=y.useState(()=>{const n=KD();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return y.useEffect(()=>{if(VD())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(jD,{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}YD(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function KD(){try{const e=window.localStorage.getItem(Ub);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function VD(){try{const e=window.localStorage.getItem(Ub);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<ID}catch{return!1}}function YD(e){try{window.localStorage.setItem(Ub,JSON.stringify({count:e,at:Date.now()}))}catch{}}function XD(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function ZD(){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 eC(){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 JD(){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 QD(){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 ej(){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 tj(){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 nj(){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 Uf="fleet-console.rail.activePanelId",$5="fleet-console.rail.chromeExpanded",ij="fleet-console.repository.source",Iv=new Set;let js={activeRailPanelId:cj(),railChromeExpanded:uj(),panelExtraWidth:0};function Wb(e){return Iv.add(e),()=>{Iv.delete(e)}}function qb(){return js}function sj(e){const t=js.activeRailPanelId===e?null:e;kp({...js,activeRailPanelId:t,panelExtraWidth:0}),F5(t)}function rj(){js.activeRailPanelId!==null&&(kp({...js,activeRailPanelId:null,panelExtraWidth:0}),F5(null))}function aj(e){js.railChromeExpanded!==e&&(kp({...js,railChromeExpanded:e}),hj(e))}function P5(){aj(!js.railChromeExpanded)}function oj(e,t){if(e!==js.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!==js.panelExtraWidth&&kp({...js,panelExtraWidth:r})}function z5(){return y.useSyncExternalStore(Wb,qb).activeRailPanelId}function H5(){return y.useSyncExternalStore(Wb,qb).railChromeExpanded}function lj(){return y.useSyncExternalStore(Wb,qb).panelExtraWidth}function cj(){try{const e=localStorage.getItem(Uf);if(e==="diff"||e==="history"){try{localStorage.setItem(Uf,"repository"),e==="history"&&localStorage.setItem(ij,"history")}catch{}return"repository"}return e}catch{return null}}function uj(){try{return localStorage.getItem($5)!=="0"}catch{return!0}}function F5(e){try{e===null?localStorage.removeItem(Uf):localStorage.setItem(Uf,e)}catch{}}function hj(e){try{localStorage.setItem($5,e?"1":"0")}catch{}}function kp(e){js=e;for(const t of Iv)t()}function U5(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(()=>dj(e),[e]),f=y.useMemo(()=>fj(p,n),[p,n]),_=y.useMemo(()=>f.map((j,H)=>({row:j,index:H})),[f]),[g,b]=y.useState(()=>pj(p,e.selected)),S=p.find(j=>Wf(j.selection,e.selected))??null,w=_[Math.min(g,Math.max(0,_.length-1))]?.row??null,x=`${d}-built-ins`,k=`${d}-installed`;y.useEffect(()=>{o(e.size)},[e.size]),y.useEffect(()=>{g>=_.length&&b(Math.max(0,_.length-1))},[g,_.length]);const A=y.useCallback(j=>{const H=nC(j,t);o(H),c.current=c.current.catch(()=>{}).then(()=>e.onSizeCommit(H))},[e.onSizeCommit,t]),B=y.useCallback(j=>{f.length&&b(H=>(H+j+f.length)%f.length)},[f.length]),z=y.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),E=y.useCallback((j,H)=>{b(j),e.onSelectionChange(H)},[e]),M=j=>{j.key==="ArrowDown"?(j.preventDefault(),B(1)):j.key==="ArrowUp"?(j.preventDefault(),B(-1)):j.key==="Home"?(j.preventDefault(),b(0)):j.key==="End"?(j.preventDefault(),b(Math.max(0,f.length-1))):(j.key==="Enter"||j.key===" ")&&(j.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:j=>{i(j.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?W5(d,g):void 0,"aria-busy":e.loading||void 0,onKeyDown:M,children:[u.jsx(tC,{groupId:x,label:"Built-in",rows:_.filter(({row:j})=>j.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:E}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(tC,{groupId:k,label:"Installed on this machine",rows:_.filter(({row:j})=>j.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:E}),!e.loading&&!_.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:()=>A(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:()=>A(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:j=>o(nC(Number(j.currentTarget.value),t)),onPointerUp:j=>A(Number(j.currentTarget.value)),onKeyUp:j=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(j.key)&&A(Number(j.currentTarget.value))}})]})]})})}function tC({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:W5(o,f),type:"button",className:`fc-font-browser__row${Wf(p.selection,i?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Wf(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 dj(e){const t=new Set,n=e.builtIns.flatMap(o=>{const c=[o.id,o.label,...o.aliases??[]].map(Wu);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-${Wu(o.family)}`,label:o.family,family:o.family,previewFamily:zf(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!zO(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${Wu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:zf(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function fj(e,t){const n=Wu(t);return n?e.filter(i=>Wu(`${i.label} ${i.description??""}`).includes(n)):e}function Wu(e){return e.trim().toLocaleLowerCase()}function W5(e,t){return`${e}-option-${t}`}function pj(e,t){const n=e.findIndex(i=>Wf(i.selection,t));return n>=0?n:0}function Wf(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function nC(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 mj="/api/v1/settings/fonts/system";class Il extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function gj(e){if(!G5(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(_j)}}async function q5(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(mj,{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 gj(i)}function _j(e){if(!G5(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 vj(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function G5(e,t){return vj(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const iC=250,yj=5e3,sC=1,bj=1013,Sj=4e3,wj=4001;function xj(e){const t=new AbortController,n=new TextEncoder;let i=iC,r=null,o=null,c=null,d=!1;const p=()=>{o?.dispose(),o=null},f=(b,S)=>{c={cols:b,rows:S},r?.readyState===sC&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},_=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await kj(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await g(Cj(b,e.location,e.wsPath),e),i=iC}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await Tj(i,t.signal),i=Math.min(i*2,yj)}},g=async(b,S)=>{await new Promise((w,x)=>{const k=(S.webSocketFactory??Ej)(b);r=k,k.binaryType="arraybuffer",k.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(A=>{k.readyState===sC&&k.send(n.encode(A))}),c&&f(c.cols,c.rows)},k.onmessage=A=>{A.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(A.data))},k.onerror=()=>{x(new Error("Terminal WebSocket error"))},k.onclose=A=>{p(),r===k&&(r=null);const B=A?.code;B===Sj?(t.abort(),S.onStatus?.("closed","terminal_replaced")):B===wj?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):B===bj&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{d||(d=!0,_())},resize:f,dispose:()=>{t.abort(),p(),e.onStatus?.("closed"),r?.close(),r=null}}}function Cj(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function kj(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 Ej(e){return new WebSocket(e)}async function Tj(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var Aj=2,Rj=1,Lj=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,_=r-p-t;return{cols:Math.max(Aj,Math.floor(_/e.css.cell.width)),rows:Math.max(Rj,Math.floor(f/e.css.cell.height))}}};var r_=[[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]],Nj=[[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]],Kn;function Mj(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 Oj=class{constructor(){if(this.version="6",!Kn){Kn=new Uint8Array(65536),Kn.fill(1),Kn[0]=0,Kn.fill(0,1,32),Kn.fill(0,127,160),Kn.fill(2,4352,4448),Kn[9001]=2,Kn[9002]=2,Kn.fill(2,11904,42192),Kn[12351]=1,Kn.fill(2,44032,55204),Kn.fill(2,63744,64256),Kn.fill(2,65040,65050),Kn.fill(2,65072,65136),Kn.fill(2,65280,65377),Kn.fill(2,65504,65511);for(let t=0;t<r_.length;++t)Kn.fill(0,r_[t][0],r_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Kn[t]:Mj(t,Nj)?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=Gf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Gf.createPropertyValue(0,i,r)}},Dj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?rC.isErrorNoTelemetry(t)?new rC(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)}},jj=new Dj;function a_(e){Ij(e)||jj.onUnexpectedError(e)}var Bv="Canceled";function Ij(e){return e instanceof Bj?!0:e instanceof Error&&e.name===Bv&&e.message===Bv}var Bj=class extends Error{constructor(){super(Bv),this.name=this.message}},rC=class $v extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof $v)return t;let n=new $v;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function $j(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var Pj;(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})(Pj||={});var K5;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(E){yield E}e.single=r;function o(E){return t(E)?E:r(E)}e.wrap=o;function c(E){return E||n}e.from=c;function*d(E){for(let M=E.length-1;M>=0;M--)yield E[M]}e.reverse=d;function p(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(E){return E[Symbol.iterator]().next().value}e.first=f;function _(E,M){let j=0;for(let H of E)if(M(H,j++))return!0;return!1}e.some=_;function g(E,M){for(let j of E)if(M(j))return j}e.find=g;function*b(E,M){for(let j of E)M(j)&&(yield j)}e.filter=b;function*S(E,M){let j=0;for(let H of E)yield M(H,j++)}e.map=S;function*w(E,M){let j=0;for(let H of E)yield*M(H,j++)}e.flatMap=w;function*x(...E){for(let M of E)yield*M}e.concat=x;function k(E,M,j){let H=j;for(let U of E)H=M(H,U);return H}e.reduce=k;function*A(E,M,j=E.length){for(M<0&&(M+=E.length),j<0?j+=E.length:j>E.length&&(j=E.length);M<j;M++)yield E[M]}e.slice=A;function B(E,M=Number.POSITIVE_INFINITY){let j=[];if(M===0)return[j,E];let H=E[Symbol.iterator]();for(let U=0;U<M;U++){let Q=H.next();if(Q.done)return[j,e.empty()];j.push(Q.value)}return[j,{[Symbol.iterator](){return H}}]}e.consume=B;async function z(E){let M=[];for await(let j of E)M.push(j);return Promise.resolve(M)}e.asyncToArray=z})(K5||={});function V5(e){if(K5.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 zj(...e){return Y5(()=>V5(e))}function Y5(e){return{dispose:$j(()=>{e()})}}var X5=class Z5{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{V5(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?Z5.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)}};X5.DISABLE_DISPOSED_WARNING=!1;var Gb=X5,qf=class{constructor(){this._store=new Gb,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)}};qf.None=Object.freeze({dispose(){}});var Hj=globalThis.performance&&typeof globalThis.performance.now=="function",Fj=class J5{static create(t){return new J5(t)}constructor(t){this._now=Hj&&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}},Uj;(e=>{e.None=()=>qf.None;function t($,L){return g($,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n($){return(L,P=null,D)=>{let T=!1,R;return R=$(N=>{if(!T)return R?R.dispose():T=!0,L.call(P,N)},null,D),T&&R.dispose(),R}}e.once=n;function i($,L,P){return f((D,T=null,R)=>$(N=>D.call(T,L(N)),null,R),P)}e.map=i;function r($,L,P){return f((D,T=null,R)=>$(N=>{L(N),D.call(T,N)},null,R),P)}e.forEach=r;function o($,L,P){return f((D,T=null,R)=>$(N=>L(N)&&D.call(T,N),null,R),P)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(L,P=null,D)=>{let T=zj(...$.map(R=>R(N=>L.call(P,N))));return _(T,D)}}e.any=d;function p($,L,P,D){let T=P;return i($,R=>(T=L(T,R),T),D)}e.reduce=p;function f($,L){let P,D={onWillAddFirstListener(){P=$(T.fire,T)},onDidRemoveLastListener(){P?.dispose()}},T=new Na(D);return L?.add(T),T.event}function _($,L){return L instanceof Array?L.push($):L&&L.add($),$}function g($,L,P=100,D=!1,T=!1,R,N){let F,W,O,V=0,J,he={leakWarningThreshold:R,onWillAddFirstListener(){F=$(le=>{V++,W=L(W,le),D&&!O&&(fe.fire(W),W=void 0),J=()=>{let Te=W;W=void 0,O=void 0,(!D||V>1)&&fe.fire(Te),V=0},typeof P=="number"?(clearTimeout(O),O=setTimeout(J,P)):O===void 0&&(O=0,queueMicrotask(J))})},onWillRemoveListener(){T&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,F.dispose()}},fe=new Na(he);return N?.add(fe),fe.event}e.debounce=g;function b($,L=0,P){return e.debounce($,(D,T)=>D?(D.push(T),D):[T],L,void 0,!0,void 0,P)}e.accumulate=b;function S($,L=(D,T)=>D===T,P){let D=!0,T;return o($,R=>{let N=D||!L(R,T);return D=!1,T=R,N},P)}e.latch=S;function w($,L,P){return[e.filter($,L,P),e.filter($,D=>!L(D),P)]}e.split=w;function x($,L=!1,P=[],D){let T=P.slice(),R=$(W=>{T?T.push(W):F.fire(W)});D&&D.add(R);let N=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new Na({onWillAddFirstListener(){R||(R=$(W=>F.fire(W)),D&&D.add(R))},onDidAddFirstListener(){T&&(L?setTimeout(N):N())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return D&&D.add(F),F.event}e.buffer=x;function k($,L){return(P,D,T)=>{let R=L(new B);return $(function(N){let F=R.evaluate(N);F!==A&&P.call(D,F)},void 0,T)}}e.chain=k;let A=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(P=>(L(P),P)),this}filter(L){return this.steps.push(P=>L(P)?P:A),this}reduce(L,P){let D=P;return this.steps.push(T=>(D=L(D,T),D)),this}latch(L=(P,D)=>P===D){let P=!0,D;return this.steps.push(T=>{let R=P||!L(T,D);return P=!1,D=T,R?T:A}),this}evaluate(L){for(let P of this.steps)if(L=P(L),L===A)break;return L}}function z($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.on(L,D),R=()=>$.removeListener(L,D),N=new Na({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromNodeEventEmitter=z;function E($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.addEventListener(L,D),R=()=>$.removeEventListener(L,D),N=new Na({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromDOMEventEmitter=E;function M($){return new Promise(L=>n($)(L))}e.toPromise=M;function j($){let L=new Na;return $.then(P=>{L.fire(P)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=j;function H($,L){return $(P=>L.fire(P))}e.forward=H;function U($,L,P){return L(P),$(D=>L(D))}e.runAndSubscribe=U;class Q{constructor(L,P){this._observable=L,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new Na(D),P&&P.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,P){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function oe($,L){return new Q($,L).emitter.event}e.fromObservable=oe;function Y($){return(L,P,D)=>{let T=0,R=!1,N={beginUpdate(){T++},endUpdate(){T--,T===0&&($.reportChanges(),R&&(R=!1,L.call(P)))},handlePossibleChange(){},handleChange(){R=!0}};$.addObserver(N),$.reportChanges();let F={dispose(){$.removeObserver(N)}};return D instanceof Gb?D.add(F):Array.isArray(D)&&D.push(F),F}}e.fromObservableLight=Y})(Uj||={});var Pv=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 Fj,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}}};Pv.all=new Set,Pv._idPool=0;var Wj=Pv,qj=-1,Q5=class eT{constructor(t,n,i=(eT._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 Vj(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}};Q5._idPool=1;var Gj=Q5,Kj=class tT{constructor(t){this.value=t}static create(){let t=new Error;return new tT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
+
`).slice(2).join(`
|
|
17
|
+
`))}},Vj=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},Yj=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},Xj=0,o_=class{constructor(t){this.value=t,this.id=Xj++}},Zj=2,Jj,Na=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new Gj(t?.onListenerError??a_,this._options?.leakWarningThreshold??qj):void 0,this._perfMon=this._options?._profName?new Wj(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 Yj(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||a_)(f),qf.None}if(this._disposed)return qf.None;n&&(t=t.bind(n));let r=new o_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Kj.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof o_?(this._deliveryQueue??=new Qj,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Y5(()=>{o?.(),this._removeListener(r)});return i instanceof Gb?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*Zj<=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||a_;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 o_)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}},Qj=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}},Gf=class _f{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Na,this.onChange=this._onChange.event;let t=new Oj;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=_f.extractWidth(d);_f.extractShouldJoin(d)&&(p-=_f.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},l_=[[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]],eI=[[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]],c_=[[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]],tI=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],$r;function aC(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 nI=class{constructor(){if(this.version="11",!$r){$r=new Uint8Array(65536),$r.fill(1),$r[0]=0,$r.fill(0,1,32),$r.fill(0,127,160);for(let t=0;t<l_.length;++t)$r.fill(0,l_[t][0],l_[t][1]+1);for(let t=0;t<c_.length;++t)$r.fill(2,c_[t][0],c_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?$r[t]:aC(t,eI)?0:aC(t,tI)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=Gf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Gf.createPropertyValue(0,i,r)}},iI=class{activate(t){t.unicode.register(new nI)}dispose(){}};var sI=(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},rI=(e,t)=>(n,i)=>t(n,i,e),aI=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oC.isErrorNoTelemetry(e)?new oC(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)}},oI=new aI;function u_(e){lI(e)||oI.onUnexpectedError(e)}var Hv="Canceled";function lI(e){return e instanceof cI?!0:e instanceof Error&&e.name===Hv&&e.message===Hv}var cI=class extends Error{constructor(){super(Hv),this.name=this.message}},oC=class Fv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Fv)return t;let n=new Fv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},uI;(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})(uI||={});function hI(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var nT;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(E){yield E}e.single=r;function o(E){return t(E)?E:r(E)}e.wrap=o;function c(E){return E||n}e.from=c;function*d(E){for(let M=E.length-1;M>=0;M--)yield E[M]}e.reverse=d;function p(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(E){return E[Symbol.iterator]().next().value}e.first=f;function _(E,M){let j=0;for(let H of E)if(M(H,j++))return!0;return!1}e.some=_;function g(E,M){for(let j of E)if(M(j))return j}e.find=g;function*b(E,M){for(let j of E)M(j)&&(yield j)}e.filter=b;function*S(E,M){let j=0;for(let H of E)yield M(H,j++)}e.map=S;function*w(E,M){let j=0;for(let H of E)yield*M(H,j++)}e.flatMap=w;function*x(...E){for(let M of E)yield*M}e.concat=x;function k(E,M,j){let H=j;for(let U of E)H=M(H,U);return H}e.reduce=k;function*A(E,M,j=E.length){for(M<0&&(M+=E.length),j<0?j+=E.length:j>E.length&&(j=E.length);M<j;M++)yield E[M]}e.slice=A;function B(E,M=Number.POSITIVE_INFINITY){let j=[];if(M===0)return[j,E];let H=E[Symbol.iterator]();for(let U=0;U<M;U++){let Q=H.next();if(Q.done)return[j,e.empty()];j.push(Q.value)}return[j,{[Symbol.iterator](){return H}}]}e.consume=B;async function z(E){let M=[];for await(let j of E)M.push(j);return Promise.resolve(M)}e.asyncToArray=z})(nT||={});function iT(e){if(nT.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 sT(...e){return ki(()=>iT(e))}function ki(e){return{dispose:hI(()=>{e()})}}var rT=class aT{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{iT(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?aT.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)}};rT.DISABLE_DISPOSED_WARNING=!1;var Wl=rT,Zs=class{constructor(){this._store=new Wl,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Zs.None=Object.freeze({dispose(){}});var lu=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}},Kb=typeof process<"u"&&"title"in process,Ep=Kb?"node":navigator.userAgent,dI=Kb?"node":navigator.platform,fI=Ep.includes("Firefox"),pI=Ep.includes("Edge"),oT=/^((?!chrome|android).)*safari/i.test(Ep);function mI(){if(!oT)return 0;let e=Ep.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}dI.indexOf("Linux")>=0;var gI="",ti=0,ni=0,ii=0,kn=0,Rs={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 Mu;(e=>{function t(p,f){if(kn=(f.rgba&255)/255,kn===1)return{css:f.css,rgba:f.rgba};let _=f.rgba>>24&255,g=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;ti=S+Math.round((_-S)*kn),ni=w+Math.round((g-w)*kn),ii=x+Math.round((b-x)*kn);let k=Oi.toCss(ti,ni,ii),A=Oi.toRgba(ti,ni,ii);return{css:k,rgba:A}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,_){let g=Ao.ensureContrastRatio(p.rgba,f.rgba,_);if(g)return Oi.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[ti,ni,ii]=Ao.toChannels(f),{css:Oi.toCss(ti,ni,ii),rgba:f}}e.opaque=r;function o(p,f){return kn=Math.round(f*255),[ti,ni,ii]=Ao.toChannels(p.rgba),{css:Oi.toCss(ti,ni,ii,kn),rgba:Oi.toRgba(ti,ni,ii,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})(Mu||={});var _I;(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 ti=parseInt(r.slice(1,2).repeat(2),16),ni=parseInt(r.slice(2,3).repeat(2),16),ii=parseInt(r.slice(3,4).repeat(2),16),Oi.toColor(ti,ni,ii);case 5:return ti=parseInt(r.slice(1,2).repeat(2),16),ni=parseInt(r.slice(2,3).repeat(2),16),ii=parseInt(r.slice(3,4).repeat(2),16),kn=parseInt(r.slice(4,5).repeat(2),16),Oi.toColor(ti,ni,ii,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 ti=parseInt(o[1]),ni=parseInt(o[2]),ii=parseInt(o[3]),kn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Oi.toColor(ti,ni,ii,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),[ti,ni,ii,kn]=t.getImageData(0,0,1,1).data,kn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Oi.toRgba(ti,ni,ii,kn),css:r}}e.toColor=i})(_I||={});var Li;(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),_=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+_*.7152+g*.0722}e.relativeLuminance2=n})(Li||={});var Ao;(e=>{function t(c,d){if(kn=(d&255)/255,kn===1)return d;let p=d>>24&255,f=d>>16&255,_=d>>8&255,g=c>>24&255,b=c>>16&255,S=c>>8&255;return ti=g+Math.round((p-g)*kn),ni=b+Math.round((f-b)*kn),ii=S+Math.round((_-S)*kn),Oi.toRgba(ti,ni,ii)}e.blend=t;function n(c,d,p){let f=Li.relativeLuminance(c>>8),_=Li.relativeLuminance(d>>8);if(Pr(f,_)<p){if(_<f){let S=i(c,d,p),w=Pr(f,Li.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),k=Pr(f,Li.relativeLuminance(x>>8));return w>k?S:x}return S}let g=r(c,d,p),b=Pr(f,Li.relativeLuminance(g>>8));if(b<p){let S=i(c,d,p),w=Pr(f,Li.relativeLuminance(S>>8));return b>w?g:S}return g}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Pr(Li.relativeLuminance2(b,S,w),Li.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=Pr(Li.relativeLuminance2(b,S,w),Li.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,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Pr(Li.relativeLuminance2(b,S,w),Li.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=Pr(Li.relativeLuminance2(b,S,w),Li.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})(Ao||={});function go(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Pr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Pn(e){if(!e)throw new Error("value must not be falsy");return e}function Vb(e){return 57508<=e&&e<=57558}function vI(e){return 57520<=e&&e<=57527}function yI(e){return 57344<=e&&e<=63743}function bI(e){return 9472<=e&&e<=9631}function SI(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 wI(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!SI(e)&&!Vb(e)&&!yI(e)}function lT(e){return Vb(e)||bI(e)}function xI(){return{css:{canvas:Bd(),cell:Bd()},device:{canvas:Bd(),cell:Bd(),char:{width:0,height:0,left:0,top:0}}}}function Bd(){return{width:0,height:0}}function CI(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var gi=0,Qn=0,ar=!1,zr=!1,$d=!1,Ki,h_=0,kI=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,Qn=0,gi=0,zr=!1,ar=!1,$d=!1,Ki=this._themeService.colors,h_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));h_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(Qn=r.backgroundColorRGB.rgba>>8&16777215,zr=!0),r.foregroundColorRGB&&(gi=r.foregroundColorRGB.rgba>>8&16777215,ar=!0)}),$d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),$d){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Qn=(this.result.fg&16777215)<<8|255;break;default:Qn=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Qn=(this.result.bg&16777215)<<8|255;break}Qn=Ao.blend(Qn,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Qn=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(zr=!0,Ki.selectionForeground&&(gi=Ki.selectionForeground.rgba>>8&16777215,ar=!0),lT(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)gi=(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:gi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:gi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:gi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:gi=(this.result.fg&16777215)<<8|255;break;default:gi=this._themeService.colors.foreground.rgba}gi=Ao.blend(gi,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ar=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(Qn=r.backgroundColorRGB.rgba>>8&16777215,zr=!0),r.foregroundColorRGB&&(gi=r.foregroundColorRGB.rgba>>8&16777215,ar=!0)}),zr&&($d?Qn=e.bg&-16777216&-134217729|Qn|50331648:Qn=e.bg&-16777216|Qn|50331648),ar&&(gi=e.fg&-16777216&-67108865|gi|50331648),this.result.fg&67108864&&(zr&&!ar&&((this.result.bg&50331648)===0?gi=this.result.fg&-134217728|Ki.background.rgba>>8&16777215&16777215|50331648:gi=this.result.fg&-134217728|this.result.bg&67108863,ar=!0),!zr&&ar&&((this.result.fg&50331648)===0?Qn=this.result.bg&-67108864|Ki.foreground.rgba>>8&16777215&16777215|50331648:Qn=this.result.bg&-67108864|this.result.fg&67108863,zr=!0)),Ki=void 0,this.result.bg=zr?Qn:this.result.bg,this.result.fg=ar?gi:this.result.fg,this.result.ext&=536870911,this.result.ext|=h_<<29&3758096384}},EI=.5,cT=fI||pI?"bottom":"ideographic",TI={"▀":[{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}]},AI={"░":[[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]]},RI={"─":{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`}},eh={"":{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}};eh[""]=eh[""];eh[""]=eh[""];function LI(e,t,n,i,r,o,c,d){let p=TI[t];if(p)return NI(e,p,n,i,r,o),!0;let f=AI[t];if(f)return MI(e,f,n,i,r,o),!0;let _=RI[t];if(_)return OI(e,_,n,i,r,o,d),!0;let g=eh[t];return g?(DI(e,g,n,i,r,o,c,d),!0):!1}function NI(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 lC=new Map;function MI(e,t,n,i,r,o){let c=lC.get(t);c||(c=new Map,lC.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,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=f,g.height=_;let b=Pn(g.getContext("2d")),S=new ImageData(f,_),w,x,k,A;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),A=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,k,A]=d.substring(5,d.length-1).split(",").map(B=>parseFloat(B));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let B=0;B<_;B++)for(let z=0;z<f;z++)S.data[(B*f+z)*4]=w,S.data[(B*f+z)*4+1]=x,S.data[(B*f+z)*4+2]=k,S.data[(B*f+z)*4+3]=t[B][z]*(A*255);b.putImageData(S,0,0),p=Pn(e.createPattern(g,null)),c.set(d,p)}e.fillStyle=p,e.fillRect(n,i,r,o)}function OI(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 _=.15/o*r;f=p(.15,_)}else f=p;for(let _ of f.split(" ")){let g=_[0],b=uT[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let S=_.substring(1).split(",");!S[0]||!S[1]||b(e,hT(S,r,o,n,i,!0,c))}e.stroke(),e.closePath()}}function DI(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 _ of t.d.split(" ")){let g=_[0],b=uT[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let S=_.substring(1).split(",");!S[0]||!S[1]||b(e,hT(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 cC(e,t,n=0){return Math.max(Math.min(e,t),n)}var uT={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 hT(e,t,n,i,r,o,c,d=0,p=0){let f=e.map(_=>parseFloat(_)||parseInt(_));if(f.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<f.length;_+=2)f[_]*=t-d*c-p*c,o&&f[_]!==0&&(f[_]=cC(Math.round(f[_]+.5)-.5,t,0)),f[_]+=i+d*c;for(let _=1;_<f.length;_+=2)f[_]*=n,o&&f[_]!==0&&(f[_]=cC(Math.round(f[_]+.5)-.5,n,0)),f[_]+=r;return f}var uC=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={}}},hC=class{constructor(){this._data=new uC}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new uC),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()}},dT=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()}},jI=class extends dT{_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())}}},II=class extends dT{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},BI=!Kb&&"requestIdleCallback"in window?II:jI,Bl=class fT{constructor(){this.fg=0,this.bg=0,this.extended=new pT}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 fT;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}},pT=class mT{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 mT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},$I=globalThis.performance&&typeof globalThis.performance.now=="function",PI=class gT{static create(t){return new gT(t)}constructor(t){this._now=$I&&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}},Gr;(e=>{e.None=()=>Zs.None;function t($,L){return g($,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n($){return(L,P=null,D)=>{let T=!1,R;return R=$(N=>{if(!T)return R?R.dispose():T=!0,L.call(P,N)},null,D),T&&R.dispose(),R}}e.once=n;function i($,L,P){return f((D,T=null,R)=>$(N=>D.call(T,L(N)),null,R),P)}e.map=i;function r($,L,P){return f((D,T=null,R)=>$(N=>{L(N),D.call(T,N)},null,R),P)}e.forEach=r;function o($,L,P){return f((D,T=null,R)=>$(N=>L(N)&&D.call(T,N),null,R),P)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(L,P=null,D)=>{let T=sT(...$.map(R=>R(N=>L.call(P,N))));return _(T,D)}}e.any=d;function p($,L,P,D){let T=P;return i($,R=>(T=L(T,R),T),D)}e.reduce=p;function f($,L){let P,D={onWillAddFirstListener(){P=$(T.fire,T)},onDidRemoveLastListener(){P?.dispose()}},T=new on(D);return L?.add(T),T.event}function _($,L){return L instanceof Array?L.push($):L&&L.add($),$}function g($,L,P=100,D=!1,T=!1,R,N){let F,W,O,V=0,J,he={leakWarningThreshold:R,onWillAddFirstListener(){F=$(le=>{V++,W=L(W,le),D&&!O&&(fe.fire(W),W=void 0),J=()=>{let Te=W;W=void 0,O=void 0,(!D||V>1)&&fe.fire(Te),V=0},typeof P=="number"?(clearTimeout(O),O=setTimeout(J,P)):O===void 0&&(O=0,queueMicrotask(J))})},onWillRemoveListener(){T&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,F.dispose()}},fe=new on(he);return N?.add(fe),fe.event}e.debounce=g;function b($,L=0,P){return e.debounce($,(D,T)=>D?(D.push(T),D):[T],L,void 0,!0,void 0,P)}e.accumulate=b;function S($,L=(D,T)=>D===T,P){let D=!0,T;return o($,R=>{let N=D||!L(R,T);return D=!1,T=R,N},P)}e.latch=S;function w($,L,P){return[e.filter($,L,P),e.filter($,D=>!L(D),P)]}e.split=w;function x($,L=!1,P=[],D){let T=P.slice(),R=$(W=>{T?T.push(W):F.fire(W)});D&&D.add(R);let N=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new on({onWillAddFirstListener(){R||(R=$(W=>F.fire(W)),D&&D.add(R))},onDidAddFirstListener(){T&&(L?setTimeout(N):N())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return D&&D.add(F),F.event}e.buffer=x;function k($,L){return(P,D,T)=>{let R=L(new B);return $(function(N){let F=R.evaluate(N);F!==A&&P.call(D,F)},void 0,T)}}e.chain=k;let A=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(P=>(L(P),P)),this}filter(L){return this.steps.push(P=>L(P)?P:A),this}reduce(L,P){let D=P;return this.steps.push(T=>(D=L(D,T),D)),this}latch(L=(P,D)=>P===D){let P=!0,D;return this.steps.push(T=>{let R=P||!L(T,D);return P=!1,D=T,R?T:A}),this}evaluate(L){for(let P of this.steps)if(L=P(L),L===A)break;return L}}function z($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.on(L,D),R=()=>$.removeListener(L,D),N=new on({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromNodeEventEmitter=z;function E($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.addEventListener(L,D),R=()=>$.removeEventListener(L,D),N=new on({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromDOMEventEmitter=E;function M($){return new Promise(L=>n($)(L))}e.toPromise=M;function j($){let L=new on;return $.then(P=>{L.fire(P)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=j;function H($,L){return $(P=>L.fire(P))}e.forward=H;function U($,L,P){return L(P),$(D=>L(D))}e.runAndSubscribe=U;class Q{constructor(L,P){this._observable=L,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new on(D),P&&P.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,P){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function oe($,L){return new Q($,L).emitter.event}e.fromObservable=oe;function Y($){return(L,P,D)=>{let T=0,R=!1,N={beginUpdate(){T++},endUpdate(){T--,T===0&&($.reportChanges(),R&&(R=!1,L.call(P)))},handlePossibleChange(){},handleChange(){R=!0}};$.addObserver(N),$.reportChanges();let F={dispose(){$.removeObserver(N)}};return D instanceof Wl?D.add(F):Array.isArray(D)&&D.push(F),F}}e.fromObservableLight=Y})(Gr||={});var Uv=class Wv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Wv._idPool++}`,Wv.all.add(this)}start(t){this._stopWatch=new PI,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}}};Uv.all=new Set,Uv._idPool=0;var zI=Uv,HI=-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 WI(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 FI=_T,UI=class yT{constructor(t){this.value=t}static create(){let t=new Error;return new yT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
+
`).slice(2).join(`
|
|
23
|
+
`))}},WI=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},qI=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},GI=0,d_=class{constructor(t){this.value=t,this.id=GI++}},KI=2,VI,on=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new FI(t?.onListenerError??u_,this._options?.leakWarningThreshold??HI):void 0,this._perfMon=this._options?._profName?new zI(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 qI(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||u_)(f),Zs.None}if(this._disposed)return Zs.None;n&&(t=t.bind(n));let r=new d_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=UI.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof d_?(this._deliveryQueue??=new YI,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=ki(()=>{o?.(),this._removeListener(r)});return i instanceof Wl?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*KI<=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||u_;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}},YI=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}},dC={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}},cu=2,uu,Ma=class Nl{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new hC,this._cacheMapCombined=new hC,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=bT(t,this._config.deviceCellWidth*4+cu*2,this._config.deviceCellHeight+cu*2),this._tmpCtx=Pn(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 BI;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(Nl.maxAtlasPages&&this._pages.length>=Math.max(4,Nl.maxAtlasPages)){let n=this._pages.filter(f=>f.canvas.width*2<=(Nl.maxTextureSize||4096)).sort((f,_)=>_.canvas.width!==f.canvas.width?_.canvas.width-f.canvas.width:_.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,_)=>f>_?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 f_(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 f_(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 _ of c.glyphs)_.texturePage=n,_.sizeClipSpace.x=_.size.x/i,_.sizeClipSpace.y=_.size.y/i,_.texturePosition.x+=d,_.texturePosition.y+=p,_.texturePositionClipSpace.x=_.texturePosition.x/i,_.texturePositionClipSpace.y=_.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 uu=t.get(n,i,r,o),uu||(uu=this._drawToCache(n,i,r,o,c,d),t.set(n,i,r,o,uu)),uu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Rs;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let c=Bl.toColorRGB(n);o=Oi.toColor(c[0],c[1],c[2]);break;default:i?o=Mu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Mu.opaque(o)),o}_getForegroundColor(t,n,i,r,o,c,d,p,f,_){let g=this._getMinimumContrastColor(t,n,i,r,o,c,d,f,p,_);if(g)return g;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=Mu.opaque(b)),p&&(b=Mu.multiplyOpacity(b,EI)),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,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(f),b=g.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=Ao.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!x){g.setColor(t,r,null);return}let k=Oi.toColor(x>>24&255,x>>16&255,x>>8&255);return g.setColor(t,r,k),k}_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)+cu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+cu*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 dC;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),A=this._workAttributeData.getFgColor(),B=this._workAttributeData.getFgColorMode(),z=this._workAttributeData.getBgColor(),E=this._workAttributeData.getBgColorMode();if(g){let W=A;A=z,z=W;let O=B;B=E,E=O}let M=this._getBackgroundColor(E,z,g,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let j=_?this._config.fontWeightBold:this._config.fontWeight,H=S?"italic":"";this._tmpCtx.font=`${H} ${j} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=cT;let U=d.length===1&&Vb(d.charCodeAt(0)),Q=d.length===1&&vI(d.charCodeAt(0)),oe=this._getForegroundColor(n,E,z,i,B,A,g,b,_,lT(d.charCodeAt(0)));this._tmpCtx.fillStyle=oe.css;let Y=Q?0:cu*2,$=!1;this._config.customGlyphs!==!1&&($=LI(this._tmpCtx,d,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let L=!U,P;if(typeof t=="number"?P=this._unicodeService.wcwidth(t):P=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),O=W%2===1?.5:0;if(this._tmpCtx.lineWidth=W,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())L=!1,this._tmpCtx.strokeStyle=`rgb(${Bl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{L=!1;let Te=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Te<8&&(Te+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Te).css}this._tmpCtx.beginPath();let V=Y,J=Math.ceil(Y+this._config.deviceCharHeight)-O-(o?W*2:0),he=J+W,fe=J+W*2,le=this._workAttributeData.getUnderlineVariantOffset();for(let Te=0;Te<P;Te++){this._tmpCtx.save();let Re=V+Te*this._config.deviceCellWidth,$e=V+(Te+1)*this._config.deviceCellWidth,dt=Re+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Re,J),this._tmpCtx.lineTo($e,J),this._tmpCtx.moveTo(Re,fe),this._tmpCtx.lineTo($e,fe);break;case 3:let xe=W<=1?fe:Math.ceil(Y+this._config.deviceCharHeight-W/2)-O,Se=W<=1?J:Math.ceil(Y+this._config.deviceCharHeight+W/2)-O,Ee=new Path2D;Ee.rect(Re,J,this._config.deviceCellWidth,fe-J),this._tmpCtx.clip(Ee),this._tmpCtx.moveTo(Re-this._config.deviceCellWidth/2,he),this._tmpCtx.bezierCurveTo(Re-this._config.deviceCellWidth/2,Se,Re,Se,Re,he),this._tmpCtx.bezierCurveTo(Re,xe,dt,xe,dt,he),this._tmpCtx.bezierCurveTo(dt,Se,$e,Se,$e,he),this._tmpCtx.bezierCurveTo($e,xe,$e+this._config.deviceCellWidth/2,xe,$e+this._config.deviceCellWidth/2,he);break;case 4:let Ke=le===0?0:le>=W?W*2-le:W-le;le>=W||Ke===0?(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(Re+Ke,J),this._tmpCtx.lineTo($e,J)):(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(Re,J),this._tmpCtx.lineTo(Re+Ke,J),this._tmpCtx.moveTo(Re+Ke+W,J),this._tmpCtx.lineTo($e,J)),le=CI($e-Re,W,le);break;case 5:let de=.6,Ge=.3,Le=$e-Re,et=Math.floor(de*Le),Bt=Math.floor(Ge*Le),Tt=Le-et-Bt;this._tmpCtx.setLineDash([et,Bt,Tt]),this._tmpCtx.moveTo(Re,J),this._tmpCtx.lineTo($e,J);break;default:this._tmpCtx.moveTo(Re,J),this._tmpCtx.lineTo($e,J);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!$&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Te=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Te&&Te.actualBoundingBoxDescent>0){this._tmpCtx.save();let Re=new Path2D;Re.rect(V,J-Math.ceil(W/2),this._config.deviceCellWidth*P,fe-J+Math.ceil(W/2)),this._tmpCtx.clip(Re),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(d,Y,Y+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),O=W%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+O),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*P,Y+O),this._tmpCtx.stroke()}if($||this._tmpCtx.fillText(d,Y,Y+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let W=p_(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),M,oe,L);if(W)for(let O=1;O<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,Y,Y+this._config.deviceCharHeight-O),W=p_(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),M,oe,L),!!W);O++);}if(x){let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),O=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+Math.floor(this._config.deviceCharHeight/2)-O),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*P,Y+Math.floor(this._config.deviceCharHeight/2)-O),this._tmpCtx.stroke()}this._tmpCtx.restore();let D=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=XI(D):T=p_(D,M,oe,L),T)return dC;let R=this._findGlyphBoundingBox(D,this._workBoundingBox,p,Q,$,Y),N,F;for(;;){if(this._activePages.length===0){let W=this._createNewPage();N=W,F=W.currentRow,F.height=R.size.y;break}N=this._activePages[this._activePages.length-1],F=N.currentRow;for(let W of this._activePages)R.size.y<=W.currentRow.height&&(N=W,F=W.currentRow);for(let W=this._activePages.length-1;W>=0;W--)for(let O of this._activePages[W].fixedRows)O.height<=F.height&&R.size.y<=O.height&&(N=this._activePages[W],F=O);if(R.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new f_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),N=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+R.size.x>=N.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+R.size.y>=N.canvas.height||F.height>R.size.y+2){let W=!1;if(N.currentRow.y+N.currentRow.height+R.size.y>=N.canvas.height){let O;for(let V of this._activePages)if(V.currentRow.y+V.currentRow.height+R.size.y<V.canvas.height){O=V;break}if(O)N=O;else if(Nl.maxAtlasPages&&this._pages.length>=Nl.maxAtlasPages&&F.y+R.size.y<=N.canvas.height&&F.height>=R.size.y&&F.x+R.size.x<=N.canvas.width)W=!0;else{let V=this._createNewPage();N=V,F=V.currentRow,F.height=R.size.y,W=!0}}W||(N.currentRow.height>0&&N.fixedRows.push(N.currentRow),F={x:0,y:N.currentRow.y+N.currentRow.height,height:R.size.y},N.fixedRows.push(F),N.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+R.size.x<=N.canvas.width)break;F===N.currentRow?(F.x=0,F.y+=F.height,F.height=0):N.fixedRows.splice(N.fixedRows.indexOf(F),1)}return R.texturePage=this._pages.indexOf(N),R.texturePosition.x=F.x,R.texturePosition.y=F.y,R.texturePositionClipSpace.x=F.x/N.canvas.width,R.texturePositionClipSpace.y=F.y/N.canvas.height,R.sizeClipSpace.x/=N.canvas.width,R.sizeClipSpace.y/=N.canvas.height,F.height=Math.max(F.height,R.size.y),F.x+=R.size.x,N.ctx.putImageData(D,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),N.addGlyph(R),N.version++,R}_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 _=0;_<d;_++){for(let g=0;g<p;g++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.top=_,f=!0;break}}if(f)break}n.left=0,f=!1;for(let _=0;_<c+p;_++){for(let g=0;g<d;g++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.left=_,f=!0;break}}if(f)break}n.right=p,f=!1;for(let _=c+p-1;_>=c;_--){for(let g=0;g<d;g++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.right=_,f=!0;break}}if(f)break}n.bottom=d,f=!1;for(let _=d-1;_>=0;_--){for(let g=0;g<p;g++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.bottom=_,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)}}}},f_=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=bT(t,n,n),this.ctx=Pn(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 p_(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,_=Math.floor((Math.abs(r-d)+Math.abs(o-p)+Math.abs(c-f))/12),g=!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)<_?e.data[b+3]=0:g=!1;return g}function XI(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function bT(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function ZI(e,t,n,i,r,o,c,d){let p={foreground:o.foreground,background:o.background,cursor:Rs,cursorAccent:Rs,selectionForeground:Rs,selectionBackgroundTransparent:Rs,selectionBackgroundOpaque:Rs,selectionInactiveBackgroundTransparent:Rs,selectionInactiveBackgroundOpaque:Rs,overviewRulerBorder:Rs,scrollbarSliderBackground:Rs,scrollbarSliderHoverBackground:Rs,scrollbarSliderActiveBackground:Rs,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio: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 fC(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 JI(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ds=[];function ST(e,t,n,i,r,o,c,d,p){let f=ZI(i,r,o,c,t,n,d,p);for(let b=0;b<Ds.length;b++){let S=Ds[b],w=S.ownedBy.indexOf(e);if(w>=0){if(fC(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Ds.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<Ds.length;b++){let S=Ds[b];if(fC(S.config,f))return S.ownedBy.push(e),S.atlas}let _=e._core,g={atlas:new Ma(document,f,_.unicodeService),config:f,ownedBy:[e]};return Ds.push(g),g.atlas}function pC(e){for(let t=0;t<Ds.length;t++){let n=Ds[t].ownedBy.indexOf(e);if(n!==-1){Ds[t].ownedBy.length===1?(Ds[t].atlas.dispose(),Ds.splice(t,1)):Ds[t].ownedBy.splice(n,1);break}}}var Pd=600,QI=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=Pd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Pd-(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=Pd-(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})},Pd)},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 mC(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 ki(()=>i?.disconnect())}function e8(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var gC=class wT extends Bl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pT,this.combinedData=""}static fromCharData(t){let n=new wT;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?e8(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()]}},xT=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function CT(e,t,n){let i=Pn(e.createProgram());if(e.attachShader(i,Pn(_C(e,e.VERTEX_SHADER,t))),e.attachShader(i,Pn(_C(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 _C(e,t,n){let i=Pn(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 t8(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 n8=class{constructor(t){this.texture=t,this.version=-1}},i8=`#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 s8(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 Oa=11,wl=Oa*Float32Array.BYTES_PER_ELEMENT,r8=2,wn=0,rn,m_=0,hu=0,a8=class extends Zs{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Ma.maxAtlasPages===void 0&&(Ma.maxAtlasPages=Math.min(32,Pn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Ma.maxTextureSize=Pn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Pn(CT(o,i8,s8(Ma.maxAtlasPages))),this._register(ki(()=>o.deleteProgram(this._program))),this._projectionLocation=Pn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Pn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Pn(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(ki(()=>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(ki(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=Pn(o.createBuffer()),this._register(ki(()=>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 _=new Int32Array(Ma.maxAtlasPages);for(let g=0;g<Ma.maxAtlasPages;g++)_[g]=g;o.uniform1iv(this._textureLocation,_),o.uniformMatrix4fv(this._projectionLocation,!1,xT),this._atlasTextures=[];for(let g=0;g<Ma.maxAtlasPages;g++){let b=new n8(Pn(o.createTexture()));this._register(ki(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+g),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[g]=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,_){if(wn=(i*this._terminal.cols+n)*Oa,r===0||r===void 0){t.fill(0,wn,wn+Oa-1-r8);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),m_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==_&&rn.offset.x>m_?(hu=rn.offset.x-m_,t[wn]=-(rn.offset.x-hu)+this._dimensions.device.char.left,t[wn+1]=-rn.offset.y+this._dimensions.device.char.top,t[wn+2]=(rn.size.x-hu)/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+hu/this._atlas.pages[rn.texturePage].canvas.width,t[wn+6]=rn.texturePositionClipSpace.y,t[wn+7]=rn.sizeClipSpace.x-hu/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&&wI(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*Oa;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+=Oa}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*Oa,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*Oa);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/Oa)}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}},o8=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 l8(){return new o8}var Kf=4,vf=1,yf=2,g_=3,c8=2147483648,u8=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=l8()}resize(t,n){let i=t*n*Kf;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)}},h8=`#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
|
+
}`,d8=`#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
|
+
}`,qr=8,__=qr*Float32Array.BYTES_PER_ELEMENT,f8=20*qr,vC=class{constructor(){this.attributes=new Float32Array(f8),this.count=0}},Hr=0,yC=0,bC=0,SC=0,wC=0,xC=0,CC=0,p8=class extends Zs{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new vC,this._verticesCursor=new vC;let r=this._gl;this._program=Pn(CT(r,h8,d8)),this._register(ki(()=>r.deleteProgram(this._program))),this._projectionLocation=Pn(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(ki(()=>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(ki(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=Pn(r.createBuffer()),this._register(ki(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,__,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,__,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,__,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,xT),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++)_=(r*t.cols+o)*Kf,g=e.cells[_+vf],b=e.cells[_+yf],S=!!(b&67108864),(g!==d||b!==p&&(f||S))&&((d!==0||f&&p!==0)&&(w=i++*qr,this._updateRectangle(n,w,p,d,c,o,r)),c=o,d=g,p=b,f=S);(d!==0||f&&p!==0)&&(w=i++*qr,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++*qr,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++*qr,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++*qr,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++*qr,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:Hr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Hr=(n&16777215)<<8;break;default:Hr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Hr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Hr=(i&16777215)<<8;break;default:Hr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=t8(e.attributes,this._terminal.rows*this._terminal.cols*qr)),yC=r*this._dimensions.device.cell.width,bC=c*this._dimensions.device.cell.height,SC=(Hr>>24&255)/255,wC=(Hr>>16&255)/255,xC=(Hr>>8&255)/255,CC=1,this._addRectangle(e.attributes,t,yC,bC,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,SC,wC,xC,CC)}_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])}},m8=class extends Zs{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(ki(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Pn(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=ST(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=cT,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}`}},g8=class extends m8{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&&JI(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,qv=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}};qv.INSTANCE=new qv;var kT=qv;function _8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}kT.INSTANCE.onDidChangeZoomLevel;kT.INSTANCE.onDidChangeFullscreen;var lc=typeof navigator=="object"?navigator.userAgent:"";lc.indexOf("Firefox")>=0;lc.indexOf("AppleWebKit")>=0;var v8=lc.indexOf("Chrome")>=0;!v8&&lc.indexOf("Safari")>=0;lc.indexOf("Electron/")>=0;lc.indexOf("Android")>=0;var v_=!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)");v_=e.matches,_8(Co,e,({matches:n})=>{v_&&t.matches||(v_=n)})}var $l="en",y_=!1,ET=!1,zd,bf=$l,kC=$l,y8,Ur,Ro=globalThis,hs;typeof Ro.vscode<"u"&&typeof Ro.vscode.process<"u"?hs=Ro.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(hs=process);var b8=typeof hs?.versions?.electron=="string",S8=b8&&hs?.type==="renderer";if(typeof hs=="object"){hs.platform,hs.platform,y_=hs.platform==="linux",y_&&hs.env.SNAP&&hs.env.SNAP_REVISION,hs.env.CI||hs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,zd=$l,bf=$l;let e=hs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);zd=t.userLocale,kC=t.osLocale,bf=t.resolvedLanguage||$l,y8=t.languagePack?.translationsConfigFile}catch{}ET=!0}else typeof navigator=="object"&&!S8?(Ur=navigator.userAgent,Ur.indexOf("Windows")>=0,Ur.indexOf("Macintosh")>=0,(Ur.indexOf("Macintosh")>=0||Ur.indexOf("iPad")>=0||Ur.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,y_=Ur.indexOf("Linux")>=0,Ur?.indexOf("Mobi")>=0,bf=globalThis._VSCODE_NLS_LANGUAGE||$l,zd=navigator.language.toLowerCase(),kC=zd):console.error("Unable to resolve platform.");var EC=ET,gr=Ur,Ea=bf,w8;(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})(w8||={});var x8=typeof Ro.postMessage=="function"&&!Ro.importScripts;(()=>{if(x8){let e=[];Ro.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}),Ro.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var C8=!!(gr&&gr.indexOf("Chrome")>=0);gr&&gr.indexOf("Firefox")>=0;!C8&&gr&&gr.indexOf("Safari")>=0;gr&&gr.indexOf("Edg/")>=0;gr&&gr.indexOf("Android")>=0;var xl=typeof navigator=="object"?navigator:{};EC||document.queryCommandSupported&&document.queryCommandSupported("copy")||xl&&xl.clipboard&&xl.clipboard.writeText,EC||xl&&xl.clipboard&&xl.clipboard.readText;var Yb=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}},b_=new Yb,TC=new Yb,AC=new Yb;new Array(230);var k8;(e=>{function t(d){return b_.keyCodeToStr(d)}e.toString=t;function n(d){return b_.strToKeyCode(d)}e.fromString=n;function i(d){return TC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return AC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return TC.strToKeyCode(d)||AC.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 b_.keyCodeToStr(d)}e.toElectronAccelerator=c})(k8||={});var TT=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),E8;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof T8?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:TT})})(E8||={});var T8=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?TT:(this._emitter||(this._emitter=new on),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},A8;(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})(A8||={});var RC=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 Gr.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())}};RC.EMPTY=RC.fromArray([]);var{getWindow:R8}=(function(){let e=new Map,t={window:Co,disposables:new Wl};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 Zs.None;let d=new Wl,p={window:c,disposables:d.add(new Wl)};return e.set(c.vscodeWindowId,p),d.add(ki(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(Gv(c,N8.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 R8(c).document}}})(),L8=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 Gv(e,t,n,i){return new L8(e,t,n,i)}var N8={BEFORE_UNLOAD:"beforeunload"},M8=class extends Zs{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 lu,this._charAtlasDisposable=this._register(new lu),this._observerDisposable=this._register(new lu),this._model=new u8,this._workCell=new gC,this._workCell2=new gC,this._rectangleRenderer=this._register(new lu),this._glyphRenderer=this._register(new lu),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 _={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",_),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new kI(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new g8(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=xI(),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(Gv(this._canvas,"webglcontextlost",g=>{console.log("webglcontextlost event received"),g.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(g)},3e3)})),this._register(Gv(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,pC(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=mC(this._canvas,this._coreBrowserService.window,(g,b)=>this._setCanvasDevicePixelDimensions(g,b)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=mC(this._canvas,g,(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(ki(()=>{for(let g of this._renderLayers)g.dispose();this._canvas.parentElement?.removeChild(this._canvas),pC(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 p8(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new a8(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=ST(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=sT(Gr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Gr.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 QI(()=>{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,k,A,B,z,E,M;t=LC(t,i.rows-1,0),n=LC(n,i.rows-1,0);let j=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,U=H-i.buffer.ydisp,Q=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),oe=-1,Y=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let $=!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,g=0,f=this._characterJoinerService.getJoinedCharacters(d),E=0;E<i.cols;E++){if(o=this._cellColorResolver.result.bg,p.loadCell(E,r),E===0&&(o=this._cellColorResolver.result.bg),_=!1,b=E>=g,S=E,f.length>0&&E===f[0][0]&&b){w=f.shift();let L=this._model.selection.isCellSelected(this._terminal,w[0],d);for(z=w[0]+1;z<w[1];z++)b&&=L===this._model.selection.isCellSelected(this._terminal,z,d);b&&=!x||Q<w[0]||Q>=w[1],b?(_=!0,r=new O8(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):g=w[1]}if(k=r.getChars(),A=r.getCode(),z=(c*i.cols+E)*Kf,this._cellColorResolver.resolve(r,E,d,this.dimensions.device.cell.width),Y&&d===H&&(E===Q&&(this._model.cursor={x:Q,y:U,width:r.getWidth(),style:this._coreBrowserService.isFocused?j:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},oe=Q+r.getWidth()-1),E>=Q&&E<=oe&&(this._coreBrowserService.isFocused&&j==="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)),A!==0&&(this._model.lineLengths[c]=E+1),!(this._model.cells[z]===A&&this._model.cells[z+vf]===this._cellColorResolver.result.bg&&this._model.cells[z+yf]===this._cellColorResolver.result.fg&&this._model.cells[z+g_]===this._cellColorResolver.result.ext)&&($=!0,k.length>1&&(A|=c8),this._model.cells[z]=A,this._model.cells[z+vf]=this._cellColorResolver.result.bg,this._model.cells[z+yf]=this._cellColorResolver.result.fg,this._model.cells[z+g_]=this._cellColorResolver.result.ext,B=r.getWidth(),this._glyphRenderer.value.updateCell(E,c,A,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,B,o),_)){for(r=this._workCell,E++;E<=S;E++)M=(c*i.cols+E)*Kf,this._glyphRenderer.value.updateCell(E,c,0,0,0,0,gI,0,0),this._model.cells[M]=0,this._model.cells[M+vf]=this._cellColorResolver.result.bg,this._model.cells[M+yf]=this._cellColorResolver.result.fg,this._model.cells[M+g_]=this._cellColorResolver.result.ext;E--}}$&&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})}},O8=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 LC(e,t,n=0){return Math.max(Math.min(e,t),n)}var NC="di$target",MC="di$dependencies",S_=new Map;function br(e){if(S_.has(e))return S_.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");D8(t,n,r)};return t._id=e,S_.set(e,t),t}function D8(e,t,n){t[NC]===t?t[MC].push({id:e,index:n}):(t[MC]=[{id:e,index:n}],t[NC]=t)}br("BufferService");br("CoreMouseService");br("CoreService");br("CharsetService");br("InstantiationService");br("LogService");var j8=br("OptionsService");br("OscLinkService");br("UnicodeService");br("DecorationService");var I8={trace:0,debug:1,info:2,warn:3,error:4,off:5},B8="xterm.js: ",OC=class extends Zs{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=I8[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?"":B8)+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)}};OC=sI([rI(0,j8)],OC);var $8=class extends Zs{constructor(t){if(oT&&mI()<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,_=o._decorationService;o._logService;let g=o._themeService;this._renderer=this._register(new M8(t,d,p,f,i,_,r,g,this._preserveDrawingBuffer)),this._register(Gr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Gr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Gr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Gr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(ki(()=>{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 AT=Object.defineProperty,P8=Object.getOwnPropertyDescriptor,z8=(e,t)=>{for(var n in t)AT(e,n,{get:t[n],enumerable:!0})},Tn=(e,t,n,i)=>{for(var r=i>1?void 0:i?P8(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&&AT(t,n,r),r},De=(e,t)=>(n,i)=>t(n,i,e),DC="Terminal input",Kv={get:()=>DC,set:e=>DC=e},jC="Too much output to announce, navigate to rows manually to read",Vv={get:()=>jC,set:e=>jC=e};function H8(e){return e.replace(/\r?\n/g,"\r")}function F8(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function U8(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function W8(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");RT(r,t,n,i)}}function RT(e,t,n,i){e=H8(e),e=F8(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function LT(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 IC(e,t,n,i,r){LT(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function ja(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Tp(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 q8=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}},G8=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 k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=k-w;for(;f<A;){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||(k===2?S<128?f--:t[i++]=S:k===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let _=n-4,g=f;for(;g<n;){for(;g<_&&!((r=e[g])&128)&&!((o=e[g+1])&128)&&!((c=e[g+2])&128)&&!((d=e[g+3])&128);)t[i++]=r,t[i++]=o,t[i++]=c,t[i++]=d,g+=4;if(r=e[g++],r<128)t[i++]=r;else if((r&224)===192){if(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(p=(r&31)<<6|o&63,p<128){g--;continue}t[i++]=p}else if((r&240)===224){if(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[g++],(c&192)!==128){g--;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(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=c,i;if(d=e[g++],(d&192)!==128){g--;continue}if(p=(r&7)<<18|(o&63)<<12|(c&63)<<6|d&63,p<65536||p>1114111)continue;t[i++]=p}}return i}},NT="",$a=" ",gh=class MT{constructor(){this.fg=0,this.bg=0,this.extended=new Vf}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 MT;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}},Vf=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}},Is=class DT extends gh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vf,this.combinedData=""}static fromCharData(t){let n=new DT;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?ja(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()]}},BC="di$target",Yv="di$dependencies",w_=new Map;function K8(e){return e[Yv]||[]}function ci(e){if(w_.has(e))return w_.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");V8(t,n,r)};return t._id=e,w_.set(e,t),t}function V8(e,t,n){t[BC]===t?t[Yv].push({id:e,index:n}):(t[Yv]=[{id:e,index:n}],t[BC]=t)}var $i=ci("BufferService"),jT=ci("CoreMouseService"),Ho=ci("CoreService"),Y8=ci("CharsetService"),Xb=ci("InstantiationService"),IT=ci("LogService"),Pi=ci("OptionsService"),BT=ci("OscLinkService"),X8=ci("UnicodeService"),_h=ci("DecorationService"),Xv=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 _=0;_<c;_++)if(!(p===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=_,d=o.extended.urlId;continue}else f=o.extended.urlId!==d;else p!==-1&&(f=!0);if(f||p!==-1&&_===c-1){let g=this._oscLinkService.getLinkData(d)?.uri;if(g){let b={start:{x:p+1,y:e},end:{x:_+(!f&&_===c-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:g,range:b,activate:(w,x)=>r?r.activate(w,x,b):Z8(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=_,d=o.extended.urlId):(p=-1,d=-1)}}t(i)}};Xv=Tn([De(0,$i),De(1,Pi),De(2,BT)],Xv);function Z8(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 Ap=ci("CharSizeService"),Jr=ci("CoreBrowserService"),Zb=ci("MouseService"),Qr=ci("RenderService"),J8=ci("SelectionService"),$T=ci("CharacterJoinerService"),cc=ci("ThemeService"),PT=ci("LinkProviderService"),Q8=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$C.isErrorNoTelemetry(e)?new $C(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)}},e7=new Q8;function Sf(e){t7(e)||e7.onUnexpectedError(e)}var Zv="Canceled";function t7(e){return e instanceof n7?!0:e instanceof Error&&e.name===Zv&&e.message===Zv}var n7=class extends Error{constructor(){super(Zv),this.name=this.message}};function i7(e){return new Error(`Illegal argument: ${e}`)}var $C=class Jv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Jv)return t;let n=new Jv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Qv=class zT extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,zT.prototype)}};function cs(e,t=0){return e[e.length-(1+t)]}var s7;(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})(s7||={});function r7(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var HT;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(E){yield E}e.single=r;function o(E){return t(E)?E:r(E)}e.wrap=o;function c(E){return E||n}e.from=c;function*d(E){for(let M=E.length-1;M>=0;M--)yield E[M]}e.reverse=d;function p(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(E){return E[Symbol.iterator]().next().value}e.first=f;function _(E,M){let j=0;for(let H of E)if(M(H,j++))return!0;return!1}e.some=_;function g(E,M){for(let j of E)if(M(j))return j}e.find=g;function*b(E,M){for(let j of E)M(j)&&(yield j)}e.filter=b;function*S(E,M){let j=0;for(let H of E)yield M(H,j++)}e.map=S;function*w(E,M){let j=0;for(let H of E)yield*M(H,j++)}e.flatMap=w;function*x(...E){for(let M of E)yield*M}e.concat=x;function k(E,M,j){let H=j;for(let U of E)H=M(H,U);return H}e.reduce=k;function*A(E,M,j=E.length){for(M<0&&(M+=E.length),j<0?j+=E.length:j>E.length&&(j=E.length);M<j;M++)yield E[M]}e.slice=A;function B(E,M=Number.POSITIVE_INFINITY){let j=[];if(M===0)return[j,E];let H=E[Symbol.iterator]();for(let U=0;U<M;U++){let Q=H.next();if(Q.done)return[j,e.empty()];j.push(Q.value)}return[j,{[Symbol.iterator](){return H}}]}e.consume=B;async function z(E){let M=[];for await(let j of E)M.push(j);return Promise.resolve(M)}e.asyncToArray=z})(HT||={});function Io(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 a7(...e){return fn(()=>Io(e))}function fn(e){return{dispose:r7(()=>{e()})}}var FT=class UT{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?UT.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)}};FT.DISABLE_DISPOSED_WARNING=!1;var Ha=FT,pt=class{constructor(){this._store=new Ha,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)}};pt.None=Object.freeze({dispose(){}});var Zl=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}},Kr=typeof window=="object"?window:globalThis,ey=class ty{constructor(t){this.element=t,this.next=ty.Undefined,this.prev=ty.Undefined}};ey.Undefined=new ey(void 0);var mn=ey,PC=class{constructor(){this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===mn.Undefined}clear(){let e=this._first;for(;e!==mn.Undefined;){let t=e.next;e.prev=mn.Undefined,e.next=mn.Undefined,e=t}this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new mn(e);if(this._first===mn.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!==mn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mn.Undefined&&e.next!==mn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mn.Undefined&&e.next===mn.Undefined?(this._first=mn.Undefined,this._last=mn.Undefined):e.next===mn.Undefined?(this._last=this._last.prev,this._last.next=mn.Undefined):e.prev===mn.Undefined&&(this._first=this._first.next,this._first.prev=mn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==mn.Undefined;)yield e.element,e=e.next}},o7=globalThis.performance&&typeof globalThis.performance.now=="function",l7=class WT{static create(t){return new WT(t)}constructor(t){this._now=o7&&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}},vi;(e=>{e.None=()=>pt.None;function t($,L){return g($,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n($){return(L,P=null,D)=>{let T=!1,R;return R=$(N=>{if(!T)return R?R.dispose():T=!0,L.call(P,N)},null,D),T&&R.dispose(),R}}e.once=n;function i($,L,P){return f((D,T=null,R)=>$(N=>D.call(T,L(N)),null,R),P)}e.map=i;function r($,L,P){return f((D,T=null,R)=>$(N=>{L(N),D.call(T,N)},null,R),P)}e.forEach=r;function o($,L,P){return f((D,T=null,R)=>$(N=>L(N)&&D.call(T,N),null,R),P)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(L,P=null,D)=>{let T=a7(...$.map(R=>R(N=>L.call(P,N))));return _(T,D)}}e.any=d;function p($,L,P,D){let T=P;return i($,R=>(T=L(T,R),T),D)}e.reduce=p;function f($,L){let P,D={onWillAddFirstListener(){P=$(T.fire,T)},onDidRemoveLastListener(){P?.dispose()}},T=new Ce(D);return L?.add(T),T.event}function _($,L){return L instanceof Array?L.push($):L&&L.add($),$}function g($,L,P=100,D=!1,T=!1,R,N){let F,W,O,V=0,J,he={leakWarningThreshold:R,onWillAddFirstListener(){F=$(le=>{V++,W=L(W,le),D&&!O&&(fe.fire(W),W=void 0),J=()=>{let Te=W;W=void 0,O=void 0,(!D||V>1)&&fe.fire(Te),V=0},typeof P=="number"?(clearTimeout(O),O=setTimeout(J,P)):O===void 0&&(O=0,queueMicrotask(J))})},onWillRemoveListener(){T&&V>0&&J?.()},onDidRemoveLastListener(){J=void 0,F.dispose()}},fe=new Ce(he);return N?.add(fe),fe.event}e.debounce=g;function b($,L=0,P){return e.debounce($,(D,T)=>D?(D.push(T),D):[T],L,void 0,!0,void 0,P)}e.accumulate=b;function S($,L=(D,T)=>D===T,P){let D=!0,T;return o($,R=>{let N=D||!L(R,T);return D=!1,T=R,N},P)}e.latch=S;function w($,L,P){return[e.filter($,L,P),e.filter($,D=>!L(D),P)]}e.split=w;function x($,L=!1,P=[],D){let T=P.slice(),R=$(W=>{T?T.push(W):F.fire(W)});D&&D.add(R);let N=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new Ce({onWillAddFirstListener(){R||(R=$(W=>F.fire(W)),D&&D.add(R))},onDidAddFirstListener(){T&&(L?setTimeout(N):N())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return D&&D.add(F),F.event}e.buffer=x;function k($,L){return(P,D,T)=>{let R=L(new B);return $(function(N){let F=R.evaluate(N);F!==A&&P.call(D,F)},void 0,T)}}e.chain=k;let A=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(P=>(L(P),P)),this}filter(L){return this.steps.push(P=>L(P)?P:A),this}reduce(L,P){let D=P;return this.steps.push(T=>(D=L(D,T),D)),this}latch(L=(P,D)=>P===D){let P=!0,D;return this.steps.push(T=>{let R=P||!L(T,D);return P=!1,D=T,R?T:A}),this}evaluate(L){for(let P of this.steps)if(L=P(L),L===A)break;return L}}function z($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.on(L,D),R=()=>$.removeListener(L,D),N=new Ce({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromNodeEventEmitter=z;function E($,L,P=D=>D){let D=(...F)=>N.fire(P(...F)),T=()=>$.addEventListener(L,D),R=()=>$.removeEventListener(L,D),N=new Ce({onWillAddFirstListener:T,onDidRemoveLastListener:R});return N.event}e.fromDOMEventEmitter=E;function M($){return new Promise(L=>n($)(L))}e.toPromise=M;function j($){let L=new Ce;return $.then(P=>{L.fire(P)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=j;function H($,L){return $(P=>L.fire(P))}e.forward=H;function U($,L,P){return L(P),$(D=>L(D))}e.runAndSubscribe=U;class Q{constructor(L,P){this._observable=L,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new Ce(D),P&&P.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,P){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function oe($,L){return new Q($,L).emitter.event}e.fromObservable=oe;function Y($){return(L,P,D)=>{let T=0,R=!1,N={beginUpdate(){T++},endUpdate(){T--,T===0&&($.reportChanges(),R&&(R=!1,L.call(P)))},handlePossibleChange(){},handleChange(){R=!0}};$.addObserver(N),$.reportChanges();let F={dispose(){$.removeObserver(N)}};return D instanceof Ha?D.add(F):Array.isArray(D)&&D.push(F),F}}e.fromObservableLight=Y})(vi||={});var ny=class iy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${iy._idPool++}`,iy.all.add(this)}start(t){this._stopWatch=new l7,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}}};ny.all=new Set,ny._idPool=0;var c7=ny,u7=-1,qT=class GT{constructor(t,n,i=(GT._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 f7(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}};qT._idPool=1;var h7=qT,d7=class KT{constructor(t){this.value=t}static create(){let t=new Error;return new KT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
+
`).slice(2).join(`
|
|
88
|
+
`))}},f7=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},p7=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},m7=0,x_=class{constructor(e){this.value=e,this.id=m7++}},g7=2,_7,Ce=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new h7(t?.onListenerError??Sf,this._options?.leakWarningThreshold??u7):void 0,this._perfMon=this._options?._profName?new c7(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 p7(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Sf)(f),pt.None}if(this._disposed)return pt.None;n&&(t=t.bind(n));let r=new x_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=d7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof x_?(this._deliveryQueue??=new v7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=fn(()=>{o?.(),this._removeListener(r)});return i instanceof Ha?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*g7<=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||Sf;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}},v7=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}},sy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ce,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ce,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}};sy.INSTANCE=new sy;var Jb=sy;function y7(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Jb.INSTANCE.onDidChangeZoomLevel;function b7(e){return Jb.INSTANCE.getZoomFactor(e)}Jb.INSTANCE.onDidChangeFullscreen;var uc=typeof navigator=="object"?navigator.userAgent:"",ry=uc.indexOf("Firefox")>=0,S7=uc.indexOf("AppleWebKit")>=0,Qb=uc.indexOf("Chrome")>=0,w7=!Qb&&uc.indexOf("Safari")>=0;uc.indexOf("Electron/")>=0;uc.indexOf("Android")>=0;var C_=!1;if(typeof Kr.matchMedia=="function"){let e=Kr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Kr.matchMedia("(display-mode: fullscreen)");C_=e.matches,y7(Kr,e,({matches:n})=>{C_&&t.matches||(C_=n)})}var Pl="en",ay=!1,oy=!1,wf=!1,VT=!1,Hd,xf=Pl,zC=Pl,x7,Wr,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 C7=typeof ds?.versions?.electron=="string",k7=C7&&ds?.type==="renderer";if(typeof ds=="object"){ay=ds.platform==="win32",oy=ds.platform==="darwin",wf=ds.platform==="linux",wf&&ds.env.SNAP&&ds.env.SNAP_REVISION,ds.env.CI||ds.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Hd=Pl,xf=Pl;let e=ds.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Hd=t.userLocale,zC=t.osLocale,xf=t.resolvedLanguage||Pl,x7=t.languagePack?.translationsConfigFile}catch{}VT=!0}else typeof navigator=="object"&&!k7?(Wr=navigator.userAgent,ay=Wr.indexOf("Windows")>=0,oy=Wr.indexOf("Macintosh")>=0,(Wr.indexOf("Macintosh")>=0||Wr.indexOf("iPad")>=0||Wr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,wf=Wr.indexOf("Linux")>=0,Wr?.indexOf("Mobi")>=0,xf=globalThis._VSCODE_NLS_LANGUAGE||Pl,Hd=navigator.language.toLowerCase(),zC=Hd):console.error("Unable to resolve platform.");var YT=ay,fr=oy,E7=wf,HC=VT,_r=Wr,Ta=xf,T7;(e=>{function t(){return Ta}e.value=t;function n(){return Ta.length===2?Ta==="en":Ta.length>=3?Ta[0]==="e"&&Ta[1]==="n"&&Ta[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ta==="en"}e.isDefault=i})(T7||={});var A7=typeof Lo.postMessage=="function"&&!Lo.importScripts;(()=>{if(A7){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 R7=!!(_r&&_r.indexOf("Chrome")>=0);_r&&_r.indexOf("Firefox")>=0;!R7&&_r&&_r.indexOf("Safari")>=0;_r&&_r.indexOf("Edg/")>=0;_r&&_r.indexOf("Android")>=0;var Cl=typeof navigator=="object"?navigator:{};HC||document.queryCommandSupported&&document.queryCommandSupported("copy")||Cl&&Cl.clipboard&&Cl.clipboard.writeText,HC||Cl&&Cl.clipboard&&Cl.clipboard.readText;var e0=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}},k_=new e0,FC=new e0,UC=new e0,L7=new Array(230),XT;(e=>{function t(d){return k_.keyCodeToStr(d)}e.toString=t;function n(d){return k_.strToKeyCode(d)}e.fromString=n;function i(d){return FC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return UC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return FC.strToKeyCode(d)||UC.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 k_.keyCodeToStr(d)}e.toElectronAccelerator=c})(XT||={});var N7=class ZT{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 ZT&&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 M7([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},M7=class{constructor(e){if(e.length===0)throw i7("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 O7(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return XT.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(ry)switch(t){case 59:return 85;case 60:if(E7)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fr)return 57;break}else if(S7&&(fr&&t===93||!fr&&t===92))return 57;return L7[t]||0}var D7=fr?256:2048,j7=512,I7=1024,B7=fr?2048:256,WC=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=O7(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|=D7),this.altKey&&(t|=j7),this.shiftKey&&(t|=I7),this.metaKey&&(t|=B7),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new N7(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},qC=new WeakMap;function $7(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 P7=class{static getSameOriginWindowChain(e){let t=qC.get(e);if(!t){t=[],qC.set(e,t);let n=e,i;do i=$7(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}}},Fd=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=P7.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},GC=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(Qb){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?ry&&!fr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")w7&&YT?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?ry&&!fr?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()}},JT=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),z7;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof H7?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:JT})})(z7||={});var H7=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?JT:(this._emitter||(this._emitter=new Ce),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},t0=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 Qv("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Qv("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},F7=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 Qv("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=fn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},U7;(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})(U7||={});var KC=class Ns{static fromArray(t){return new Ns(n=>{n.emitMany(t)})}static fromPromise(t){return new Ns(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ns(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ns(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Ce,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 vi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ns(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ns.map(this,t)}static filter(t,n){return new Ns(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ns.filter(this,t)}static coalesce(t){return Ns.filter(t,n=>!!n)}coalesce(){return Ns.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ns.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};KC.EMPTY=KC.fromArray([]);var{getWindow:dr,getWindowId:W7,onDidRegisterWindow:q7}=(function(){let e=new Map,t={window:Kr,disposables:new Ha};e.set(Kr.vscodeWindowId,t);let n=new Ce,i=new Ce,r=new Ce;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 pt.None;let d=new Ha,p={window:c,disposables:d.add(new Ha)};return e.set(c.vscodeWindowId,p),d.add(fn(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(nt(c,ei.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:Kr},getDocument(c){return dr(c).document}}})(),G7=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 G7(e,t,n,i)}var VC=function(e,t,n,i){return nt(e,t,n,i)},n0,K7=class extends F7{constructor(e){super(),this.defaultTarget=e&&dr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},YC=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){Sf(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(YC.sort),c.shift().execute();i.set(o,!1)};n0=(o,c,d=0)=>{let p=W7(o),f=new YC(c,d),_=e.get(p);return _||(_=[],e.set(p,_)),_.push(f),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function V7(e){let t=e.getBoundingClientRect(),n=dr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var ei={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"},Y7=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 qu(e){return new Y7(e)}var QT=class{constructor(){this._hooks=new Ha,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(fn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=dr(e)}this._hooks.add(nt(o,ei.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(nt(o,ei.POINTER_UP,c=>this.stopMonitoring(!0)))}};function X7(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 cr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(cr||={});var Ou=class xi extends pt{constructor(){super(),this.dispatched=!1,this.targets=new PC,this.ignoreTargets=new PC,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(vi.runAndSubscribe(q7,({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:Kr,disposables:this._store}))}static addTarget(t){if(!xi.isTouchDevice())return pt.None;xi.INSTANCE||(xi.INSTANCE=new xi);let n=xi.INSTANCE.targets.push(t);return fn(n)}static ignoreTarget(t){if(!xi.isTouchDevice())return pt.None;xi.INSTANCE||(xi.INSTANCE=new xi);let n=xi.INSTANCE.ignoreTargets.push(t);return fn(n)}static isTouchDevice(){return"ontouchstart"in Kr||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(cr.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<xi.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let _=this.newGestureEvent(cr.Tap,p.initialTarget);_.pageX=cs(p.rollingPageX),_.pageY=cs(p.rollingPageY),this.dispatchEvent(_)}else if(f>=xi.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let _=this.newGestureEvent(cr.Contextmenu,p.initialTarget);_.pageX=cs(p.rollingPageX),_.pageY=cs(p.rollingPageY),this.dispatchEvent(_)}else if(r===1){let _=cs(p.rollingPageX),g=cs(p.rollingPageY),b=cs(p.rollingTimestamps)-p.rollingTimestamps[0],S=_-p.rollingPageX[0],w=g-p.rollingPageY[0],x=[...this.targets].filter(k=>p.initialTarget instanceof Node&&k.contains(p.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,_,Math.abs(w)/b,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(cr.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===cr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>xi.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===cr.Change||t.type===cr.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=n0(t,()=>{let _=Date.now(),g=_-i,b=0,S=0,w=!0;r+=xi.SCROLL_FRICTION*g,d+=xi.SCROLL_FRICTION*g,r>0&&(w=!1,b=o*r*g),d>0&&(w=!1,S=p*d*g);let x=this.newGestureEvent(cr.Change);x.translationX=b,x.translationY=S,n.forEach(k=>k.dispatchEvent(x)),w||this.inertia(t,n,_,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(cr.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)}};Ou.SCROLL_FRICTION=-.005,Ou.HOLD_DELAY=700,Ou.CLEAR_TAP_COUNT_TIME=400,Tn([X7],Ou,"isTouchDevice",1);var Z7=Ou,i0=class extends pt{onclick(e,t){this._register(nt(e,ei.CLICK,n=>t(new Fd(dr(e),n))))}onmousedown(e,t){this._register(nt(e,ei.MOUSE_DOWN,n=>t(new Fd(dr(e),n))))}onmouseover(e,t){this._register(nt(e,ei.MOUSE_OVER,n=>t(new Fd(dr(e),n))))}onmouseleave(e,t){this._register(nt(e,ei.MOUSE_LEAVE,n=>t(new Fd(dr(e),n))))}onkeydown(e,t){this._register(nt(e,ei.KEY_DOWN,n=>t(new WC(n))))}onkeyup(e,t){this._register(nt(e,ei.KEY_UP,n=>t(new WC(n))))}oninput(e,t){this._register(nt(e,ei.INPUT,t))}onblur(e,t){this._register(nt(e,ei.BLUR,t))}onfocus(e,t){this._register(nt(e,ei.FOCUS,t))}onchange(e,t){this._register(nt(e,ei.CHANGE,t))}ignoreGesture(e){return Z7.ignoreTarget(e)}},XC=11,J7=class extends i0{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=XC+"px",this.domNode.style.height=XC+"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 QT),this._register(VC(this.bgDomNode,ei.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(VC(this.domNode,ei.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new K7),this._pointerdownScheduleRepeatTimer=this._register(new t0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,dr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Q7=class ly{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 ly(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 ly(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}}},eB=class extends pt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Q7(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 JC(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=JC.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)))}},ZC=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function E_(e,t){let n=t-e;return function(i){return e+n*iB(i)}}function tB(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var JC=class cy{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),tB(E_(t,r),E_(o,n),.33)}return E_(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 ZC(i,r,!1)}return new ZC(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return cy.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new cy(t,n,r,i)}};function nB(e){return Math.pow(e,3)}function iB(e){return 1-nB(1-e)}var sB=class extends pt{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 t0)}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":"")))}},rB=140,eA=class extends i0{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 sB(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new QT),this._shouldRender=!0,this.domNode=qu(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,ei.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new J7(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=qu(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,ei.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=V7(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(YT&&c>rB){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()}},tA=class uy{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 uy(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))),_=(d-f)/(r-i),g=o*_;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:_,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=uy._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)}},aB=class extends eA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tA(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}},oB=class extends eA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tA(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}},lB=500,QC=50,cB=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},hy=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(Qb){let n=dr(t.browserEvent),i=b7(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 cB(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),_=Math.max(r,c),g=Math.max(o,d);_%p===0&&g%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};hy.INSTANCE=new hy;var uB=hy,hB=class extends i0{constructor(e,t,n){super(),this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ce),this.onWillScroll=this._onWillScroll.event,this._options=fB(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 oB(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new aB(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=qu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=qu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=qu(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 t0),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,fr&&(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 GC(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Io(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new GC(n))};this._mouseWheelToDispose.push(nt(this._listenOnDomNode,ei.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=uB.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=!fr&&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=QC*r,_=d.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,_)}if(o){let f=QC*o,_=d.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,_)}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(),lB)}},dB=class extends hB{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 fB(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,fr&&(t.className+=" mac"),t}var dy=class extends pt{constructor(e,t,n,i,r,o,c,d){super(),this._bufferService=n,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new eB({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>n0(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new dB(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(vi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(fn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(fn(()=>this._styleElement.remove())),this._register(vi.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}};dy=Tn([De(2,$i),De(3,Jr),De(4,jT),De(5,cc),De(6,Pi),De(7,Qr)],dy);var fy=class extends pt{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(fn(()=>{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()}};fy=Tn([De(1,$i),De(2,Jr),De(3,_h),De(4,Qr)],fy);var pB=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)}},or={full:0,left:0,center:0,right:0},Aa={full:0,left:0,center:0,right:0},du={full:0,left:0,center:0,right:0},Yf=class extends pt{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 pB,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(fn(()=>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);Aa.full=this._canvas.width,Aa.left=e,Aa.center=t,Aa.right=e,this._refreshDrawHeightConstants(),du.full=1,du.left=1,du.center=1+Aa.left,du.right=1+Aa.left+Aa.center}_refreshDrawHeightConstants(){or.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);or.left=t,or.center=t,or.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.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(du[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-or[e.position||"full"]/2),Aa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+or[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}))}};Yf=Tn([De(2,$i),De(3,_h),De(4,Qr),De(5,Pi),De(6,cc),De(7,Jr)],Yf);var ve;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
90
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ve||={});var Cf;(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=""))(Cf||={});var nA;(e=>e.ST=`${ve.ESC}\\`)(nA||={});var py=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};py=Tn([De(2,$i),De(3,Pi),De(4,Ho),De(5,Qr)],py);var si=0,ri=0,ai=0,En=0,ek={css:"#00000000",rgba:0},zn;(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})(zn||={});var an;(e=>{function t(p,f){if(En=(f.rgba&255)/255,En===1)return{css:f.css,rgba:f.rgba};let _=f.rgba>>24&255,g=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;si=S+Math.round((_-S)*En),ri=w+Math.round((g-w)*En),ai=x+Math.round((b-x)*En);let k=zn.toCss(si,ri,ai),A=zn.toRgba(si,ri,ai);return{css:k,rgba:A}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,_){let g=kf.ensureContrastRatio(p.rgba,f.rgba,_);if(g)return zn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[si,ri,ai]=kf.toChannels(f),{css:zn.toCss(si,ri,ai),rgba:f}}e.opaque=r;function o(p,f){return En=Math.round(f*255),[si,ri,ai]=kf.toChannels(p.rgba),{css:zn.toCss(si,ri,ai,En),rgba:zn.toRgba(si,ri,ai,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 gn;(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 si=parseInt(r.slice(1,2).repeat(2),16),ri=parseInt(r.slice(2,3).repeat(2),16),ai=parseInt(r.slice(3,4).repeat(2),16),zn.toColor(si,ri,ai);case 5:return si=parseInt(r.slice(1,2).repeat(2),16),ri=parseInt(r.slice(2,3).repeat(2),16),ai=parseInt(r.slice(3,4).repeat(2),16),En=parseInt(r.slice(4,5).repeat(2),16),zn.toColor(si,ri,ai,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 si=parseInt(o[1]),ri=parseInt(o[2]),ai=parseInt(o[3]),En=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),zn.toColor(si,ri,ai,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),[si,ri,ai,En]=t.getImageData(0,0,1,1).data,En!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:zn.toRgba(si,ri,ai,En),css:r}}e.toColor=i})(gn||={});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),_=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+_*.7152+g*.0722}e.relativeLuminance2=n})(Ni||={});var kf;(e=>{function t(c,d){if(En=(d&255)/255,En===1)return d;let p=d>>24&255,f=d>>16&255,_=d>>8&255,g=c>>24&255,b=c>>16&255,S=c>>8&255;return si=g+Math.round((p-g)*En),ri=b+Math.round((f-b)*En),ai=S+Math.round((_-S)*En),zn.toRgba(si,ri,ai)}e.blend=t;function n(c,d,p){let f=Ni.relativeLuminance(c>>8),_=Ni.relativeLuminance(d>>8);if(Fr(f,_)<p){if(_<f){let S=i(c,d,p),w=Fr(f,Ni.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),k=Fr(f,Ni.relativeLuminance(x>>8));return w>k?S:x}return S}let g=r(c,d,p),b=Fr(f,Ni.relativeLuminance(g>>8));if(b<p){let S=i(c,d,p),w=Fr(f,Ni.relativeLuminance(S>>8));return b>w?g:S}return g}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Fr(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=Fr(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,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Fr(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=Fr(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})(kf||={});function _o(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Fr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var mB=class extends gh{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()]}},Xf=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 _=this._getJoinedRanges(i,c,o,t,r);for(let g=0;g<_.length;g++)n.push(_[g])}r=f,c=o,d=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||$a.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(i,c,o,t,r);for(let _=0;_<f.length;_++)n.push(f[_])}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++)Xf._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||$a.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}};Xf=Tn([De(0,$i)],Xf);function gB(e){return 57508<=e&&e<=57558}function _B(e){return 9472<=e&&e<=9631}function vB(e){return gB(e)||_B(e)}function yB(){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}}var my=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,_){let g=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,k=0,A="",B=0,z=0,E=0,M=0,j=!1,H=0,U=!1,Q=0,oe=0,Y=[],$=f!==-1&&_!==-1;for(let L=0;L<w;L++){e.loadCell(L,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let D=!1,T=L>=oe,R=L,N=this._workCell;if(b.length>0&&L===b[0][0]&&T){let Ee=b.shift(),Ke=this._isCellInSelection(Ee[0],t);for(B=Ee[0]+1;B<Ee[1];B++)T&&=Ke===this._isCellInSelection(B,t);T&&=!n||o<Ee[0]||o>=Ee[1],T?(D=!0,N=new mB(this._workCell,e.translateToString(!0,Ee[0],Ee[1]),Ee[1]-Ee[0]),R=Ee[1]-1,P=N.getWidth()):oe=Ee[1]}let F=this._isCellInSelection(L,t),W=n&&L===o,O=$&&L>=f&&L<=_,V=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Ee=>{V=!0});let J=N.getChars()||$a;if(J===" "&&(N.isUnderline()||N.isOverline())&&(J=" "),Q=P*d-p.get(J,N.isBold(),N.isItalic()),!x)x=this._document.createElement("span");else if(k&&(F&&U||!F&&!U&&N.bg===z)&&(F&&U&&S.selectionForeground||N.fg===E)&&N.extended.ext===M&&O===j&&Q===H&&!W&&!D&&!V&&T){N.isInvisible()?A+=$a:A+=J,k++;continue}else k&&(x.textContent=A),x=this._document.createElement("span"),k=0,A="";if(z=N.bg,E=N.fg,M=N.extended.ext,j=O,H=Q,U=F,D&&o>=L&&o<=R&&(o=L),!this._coreService.isCursorHidden&&W&&this._coreService.isCursorInitialized){if(Y.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&Y.push("xterm-cursor-blink"),Y.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":Y.push("xterm-cursor-outline");break;case"block":Y.push("xterm-cursor-block");break;case"bar":Y.push("xterm-cursor-bar");break;case"underline":Y.push("xterm-cursor-underline");break}}if(N.isBold()&&Y.push("xterm-bold"),N.isItalic()&&Y.push("xterm-italic"),N.isDim()&&Y.push("xterm-dim"),N.isInvisible()?A=$a:A=N.getChars()||$a,N.isUnderline()&&(Y.push(`xterm-underline-${N.extended.underlineStyle}`),A===" "&&(A=" "),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${gh.toColorRGB(N.getUnderlineColor()).join(",")})`;else{let Ee=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&Ee<8&&(Ee+=8),x.style.textDecorationColor=S.ansi[Ee].css}N.isOverline()&&(Y.push("xterm-overline"),A===" "&&(A=" ")),N.isStrikethrough()&&Y.push("xterm-strikethrough"),O&&(x.style.textDecoration="underline");let he=N.getFgColor(),fe=N.getFgColorMode(),le=N.getBgColor(),Te=N.getBgColorMode(),Re=!!N.isInverse();if(Re){let Ee=he;he=le,le=Ee;let Ke=fe;fe=Te,Te=Ke}let $e,dt,xe=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Ee=>{Ee.options.layer!=="top"&&xe||(Ee.backgroundColorRGB&&(Te=50331648,le=Ee.backgroundColorRGB.rgba>>8&16777215,$e=Ee.backgroundColorRGB),Ee.foregroundColorRGB&&(fe=50331648,he=Ee.foregroundColorRGB.rgba>>8&16777215,dt=Ee.foregroundColorRGB),xe=Ee.options.layer==="top")}),!xe&&F&&($e=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,le=$e.rgba>>8&16777215,Te=50331648,xe=!0,S.selectionForeground&&(fe=50331648,he=S.selectionForeground.rgba>>8&16777215,dt=S.selectionForeground)),xe&&Y.push("xterm-decoration-top");let Se;switch(Te){case 16777216:case 33554432:Se=S.ansi[le],Y.push(`xterm-bg-${le}`);break;case 50331648:Se=zn.toColor(le>>16,le>>8&255,le&255),this._addStyle(x,`background-color:#${tk((le>>>0).toString(16),"0",6)}`);break;default:Re?(Se=S.foreground,Y.push("xterm-bg-257")):Se=S.background}switch($e||N.isDim()&&($e=an.multiplyOpacity(Se,.5)),fe){case 16777216:case 33554432:N.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(x,Se,S.ansi[he],N,$e,void 0)||Y.push(`xterm-fg-${he}`);break;case 50331648:let Ee=zn.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(x,Se,Ee,N,$e,dt)||this._addStyle(x,`color:#${tk(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Se,S.foreground,N,$e,dt)||Re&&Y.push("xterm-fg-257")}Y.length&&(x.className=Y.join(" "),Y.length=0),!W&&!D&&!V&&T?k++:x.textContent=A,Q!==this.defaultSpacing&&(x.style.letterSpacing=`${Q}px`),g.push(x),L=R}return x&&k&&(x.textContent=A),g}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||vB(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]}};my=Tn([De(1,$T),De(2,Pi),De(3,Jr),De(4,Ho),De(5,_h),De(6,cc)],my);function tk(e,t,n){for(;e.length<n;)e=t+e;return e}var bB=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}},SB=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 wB(){return new SB}var T_="xterm-dom-renderer-owner-",Ts="xterm-rows",Wd="xterm-fg-",nk="xterm-bg-",fu="xterm-focus",qd="xterm-selection",xB=1,gy=class extends pt{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=_,this._coreService=g,this._coreBrowserService=b,this._themeService=S,this._terminalClass=xB++,this._rowElements=[],this._selectionRenderModel=wB(),this.onRequestRedraw=this._register(new Ce).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ts),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(qd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=yB(),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(my,document),this._element.classList.add(T_+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(fn(()=>{this._element.classList.remove(T_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new bB(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Ts} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Ts} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Ts} .xterm-dim { color: ${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} .${Ts}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Ts}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ts}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${qd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${qd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${qd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Wd}${o} { color: ${c.css}; }${this._terminalSelector} .${Wd}${o}.xterm-dim { color: ${an.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${nk}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Wd}257 { color: ${an.opaque(e.background).css}; }${this._terminalSelector} .${Wd}257.xterm-dim { color: ${an.multiplyOpacity(an.opaque(e.background),.5).css}; }${this._terminalSelector} .${nk}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(fu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(fu),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 _=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,_)),o!==c){let g=r===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,g))}}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,_=this._rowElements[p],g=n.lines.get(f);if(!_||!g)break;_.replaceChildren(...this._rowFactory.createRow(g,f,f===i,c,d,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T_}${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),_=this._optionsService.rawOptions.cursorBlink,g=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],k=d.lines.get(w);if(!x||!k)break;x.replaceChildren(...this._rowFactory.createRow(k,w,w===p,g,b,f,_,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};gy=Tn([De(7,Xb),De(8,Ap),De(9,Pi),De(10,$i),De(11,Ho),De(12,Jr),De(13,cc)],gy);var _y=class extends pt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ce),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kB(this._optionsService))}catch{this._measureStrategy=this._register(new CB(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())}};_y=Tn([De(2,Pi)],_y);var iA=class extends pt{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)}},CB=class extends iA{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}},kB=class extends iA{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}},EB=class extends pt{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 TB(this._window)),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ce),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(vi.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}},TB=class extends pt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Zl),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(fn(()=>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)}},AB=class extends pt{constructor(){super(),this.linkProviders=[],this._register(fn(()=>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 s0(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 RB(e,t,n,i,r,o,c,d,p){if(!o)return;let f=s0(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 vy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return RB(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=s0(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])}}};vy=Tn([De(0,Qr),De(1,Ap)],vy);var LB=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=[]}},sA={};z8(sA,{getSafariVersion:()=>MB,isChromeOS:()=>lA,isFirefox:()=>rA,isIpad:()=>OB,isIphone:()=>DB,isLegacyEdge:()=>NB,isLinux:()=>r0,isMac:()=>Zf,isNode:()=>Rp,isSafari:()=>aA,isWindows:()=>oA});var Rp=typeof process<"u"&&"title"in process,vh=Rp?"node":navigator.userAgent,yh=Rp?"node":navigator.platform,rA=vh.includes("Firefox"),NB=vh.includes("Edge"),aA=/^((?!chrome|android).)*safari/i.test(vh);function MB(){if(!aA)return 0;let e=vh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(yh),OB=yh==="iPad",DB=yh==="iPhone",oA=["Windows","Win16","Win32","WinCE"].includes(yh),r0=yh.indexOf("Linux")>=0,lA=/\bCrOS\b/.test(vh),cA=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()}},jB=class extends cA{_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())}}},IB=class extends cA{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Jf=!Rp&&"requestIdleCallback"in window?IB:jB,BB=class{constructor(){this._queue=new Jf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},yy=class extends pt{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 Zl),this._pausedResizeTask=new BB,this._observerDisposable=this._register(new Zl),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 Ce),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ce),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ce),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new LB((f,_)=>this._renderRows(f,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new $B(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(fn(()=>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=fn(()=>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()}};yy=Tn([De(2,Pi),De(3,Ap),De(4,Ho),De(5,_h),De(6,$i),De(7,Jr),De(8,cc)],yy);var $B=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 PB(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return FB(r,o,e,t,n,i)+Lp(o,t,n,i)+UB(r,o,e,t,n,i);let c;if(o===t)return c=r>e?"D":"C",nh(Math.abs(r-e),th(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),p=HB(o>t?e:r,n)+(d-1)*n.cols+1+zB(o>t?r:e);return nh(p,th(c,i))}function zB(e,t){return e-1}function HB(e,t){return t.cols-e}function FB(e,t,n,i,r,o){return Lp(t,i,r,o).length===0?"":nh(hA(e,t,e,t-Bo(t,r),!1,r).length,th("D",o))}function Lp(e,t,n,i){let r=e-Bo(e,n),o=t-Bo(t,n),c=Math.abs(r-o)-WB(e,t,n);return nh(c,th(uA(e,t),i))}function UB(e,t,n,i,r,o){let c;Lp(t,i,r,o).length>0?c=i-Bo(i,r):c=t;let d=i,p=qB(e,t,n,i,r,o);return nh(hA(e,c,n,d,p==="C",r).length,th(p,o))}function WB(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=uA(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 qB(e,t,n,i,r,o){let c;return Lp(n,i,r,o).length>0?c=i-Bo(i,r):c=t,e<n&&c<=i||e>=n&&c<i?"C":"D"}function uA(e,t){return e>t?"A":"B"}function hA(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 th(e,t){let n=t?"O":"[";return ve.ESC+n+e}function nh(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var GB=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 ik(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 A_=50,KB=15,VB=50,YB=500,XB=" ",ZB=new RegExp(XB,"g"),by=class extends pt{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 Ce),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ce),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ce),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 GB(this._bufferService),this._activeSelectionMode=0,this._register(fn(()=>{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(ZB," ")).join(oA?`\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())),r0&&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=ik(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=s0(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,-A_),A_),t/=A_,t/Math.abs(t)+Math.round(t*(KB-1)))}shouldForceSelection(e){return Zf?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(),VB)}_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&&!(Zf&&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<YB&&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=PB(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,_=0,g=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 k=e[0],A=e[0];o.getWidth(k)===0&&(_++,k--),o.getWidth(A)===2&&(g++,A++);let B=o.getString(A).length;for(B>1&&(S+=B-1,p+=B-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,k--):z>1&&(b+=z-1,d-=z-1),d--,k--}for(;A<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(A+1,this._workCell));){o.loadCell(A+1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,A++):z>1&&(S+=z-1,p+=z-1),p++,A++}}p++;let w=d+f-_+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 k=r.lines.get(e[1]-1);if(k&&o.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let A=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(A){let B=this._bufferService.cols-A.start;w-=B,x+=B}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let k=r.lines.get(e[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let A=this._getWordAt([0,e[1]+1],!1,!1,!0);A&&(x+=A.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=ik(n,this._bufferService.cols)}};by=Tn([De(3,$i),De(4,Ho),De(5,Zb),De(6,Pi),De(7,Qr),De(8,Jr)],by);var sk=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={}}},rk=class{constructor(){this._color=new sk,this._css=new sk}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()}},Vn=Object.freeze((()=>{let e=[gn.toColor("#2e3436"),gn.toColor("#cc0000"),gn.toColor("#4e9a06"),gn.toColor("#c4a000"),gn.toColor("#3465a4"),gn.toColor("#75507b"),gn.toColor("#06989a"),gn.toColor("#d3d7cf"),gn.toColor("#555753"),gn.toColor("#ef2929"),gn.toColor("#8ae234"),gn.toColor("#fce94f"),gn.toColor("#729fcf"),gn.toColor("#ad7fa8"),gn.toColor("#34e2e2"),gn.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:zn.toCss(i,r,o),rgba:zn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:zn.toCss(i,i,i),rgba:zn.toRgba(i,i,i)})}return e})()),wo=gn.toColor("#ffffff"),Du=gn.toColor("#000000"),ak=gn.toColor("#ffffff"),ok=Du,pu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},JB=wo,Sy=class extends pt{constructor(e){super(),this._optionsService=e,this._contrastCache=new rk,this._halfContrastCache=new rk,this._onChangeColors=this._register(new Ce),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:wo,background:Du,cursor:ak,cursorAccent:ok,selectionForeground:void 0,selectionBackgroundTransparent:pu,selectionBackgroundOpaque:an.blend(Du,pu),selectionInactiveBackgroundTransparent:pu,selectionInactiveBackgroundOpaque:an.blend(Du,pu),scrollbarSliderBackground:an.opacity(wo,.2),scrollbarSliderHoverBackground:an.opacity(wo,.4),scrollbarSliderActiveBackground:an.opacity(wo,.5),overviewRulerBorder:wo,ansi:Vn.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=Yt(e.foreground,wo),t.background=Yt(e.background,Du),t.cursor=an.blend(t.background,Yt(e.cursor,ak)),t.cursorAccent=an.blend(t.background,Yt(e.cursorAccent,ok)),t.selectionBackgroundTransparent=Yt(e.selectionBackground,pu),t.selectionBackgroundOpaque=an.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Yt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=an.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Yt(e.selectionForeground,ek):void 0,t.selectionForeground===ek&&(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=Yt(e.scrollbarSliderBackground,an.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Yt(e.scrollbarSliderHoverBackground,an.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Yt(e.scrollbarSliderActiveBackground,an.opacity(t.foreground,.5)),t.overviewRulerBorder=Yt(e.overviewRulerBorder,JB),t.ansi=Vn.slice(),t.ansi[0]=Yt(e.black,Vn[0]),t.ansi[1]=Yt(e.red,Vn[1]),t.ansi[2]=Yt(e.green,Vn[2]),t.ansi[3]=Yt(e.yellow,Vn[3]),t.ansi[4]=Yt(e.blue,Vn[4]),t.ansi[5]=Yt(e.magenta,Vn[5]),t.ansi[6]=Yt(e.cyan,Vn[6]),t.ansi[7]=Yt(e.white,Vn[7]),t.ansi[8]=Yt(e.brightBlack,Vn[8]),t.ansi[9]=Yt(e.brightRed,Vn[9]),t.ansi[10]=Yt(e.brightGreen,Vn[10]),t.ansi[11]=Yt(e.brightYellow,Vn[11]),t.ansi[12]=Yt(e.brightBlue,Vn[12]),t.ansi[13]=Yt(e.brightMagenta,Vn[13]),t.ansi[14]=Yt(e.brightCyan,Vn[14]),t.ansi[15]=Yt(e.brightWhite,Vn[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]=Yt(e.extendedAnsi[i],Vn[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()}}};Sy=Tn([De(0,Pi)],Sy);function Yt(e,t){if(e!==void 0)try{return gn.toColor(e)}catch{}return t}var QB=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)}},e9=class{constructor(){this._services=new QB,this._services.set(Xb,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=K8(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)}},t9={trace:0,debug:1,info:2,warn:3,error:4,off:5},n9="xterm.js: ",wy=class extends pt{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=t9[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?"":n9)+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)}};wy=Tn([De(0,Pi)],wy);var lk=class extends pt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ce),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ce),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ce),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}},ft=3,$n=Object.freeze(new gh),Gd=0,R_=2,ju=class dA{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ft);let r=n||Is.fromCharData([0,NT,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*ft+0],i=n&2097151;return[this._data[t*ft+1],n&2097152?this._combined[t]:i?ja(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*ft+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ft+0]=t|2097152|n[2]<<22):this._data[t*ft+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ft+0]>>22}hasWidth(t){return this._data[t*ft+0]&12582912}getFg(t){return this._data[t*ft+1]}getBg(t){return this._data[t*ft+2]}hasContent(t){return this._data[t*ft+0]&4194303}getCodePoint(t){let n=this._data[t*ft+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ft+0]&2097152}getString(t){let n=this._data[t*ft+0];return n&2097152?this._combined[t]:n&2097151?ja(n&2097151):""}isProtected(t){return this._data[t*ft+2]&536870912}loadCell(t,n){return Gd=t*ft,n.content=this._data[Gd+0],n.fg=this._data[Gd+1],n.bg=this._data[Gd+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*ft+0]=n.content,this._data[t*ft+1]=n.fg,this._data[t*ft+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*ft+0]=n|i<<22,this._data[t*ft+1]=r.fg,this._data[t*ft+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*ft+0];r&2097152?this._combined[t]+=ja(n):r&2097151?(this._combined[t]=ja(r&2097151)+ja(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*ft+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*R_<this._data.buffer.byteLength;let i=t*ft;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*R_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*R_<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 dA(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*ft+0]&4194303)return t+(this._data[t*ft+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ft+0]&4194303||this._data[t*ft+2]&50331648)return t+(this._data[t*ft+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<ft;f++)this._data[(i+p)*ft+f]=c[(n+p)*ft+f];c[(n+p)*ft+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}else for(let p=0;p<r;p++){for(let f=0;f<ft;f++)this._data[(i+p)*ft+f]=c[(n+p)*ft+f];c[(n+p)*ft+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*ft+0],d=c&2097151,p=c&2097152?this._combined[n]:d?ja(d):$a;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 i9(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 _=[e.get(d)];for(;p<e.length&&f.isWrapped;)_.push(f),f=e.get(++p);if(!o&&i>=d&&i<p){d+=_.length-1;continue}let g=0,b=ih(_,g,t),S=1,w=0;for(;S<_.length;){let k=ih(_,S,t),A=k-w,B=n-b,z=Math.min(A,B);_[g].copyCellsFrom(_[S],w,b,z,!1),b+=z,b===n&&(g++,b=0),w+=z,w===k&&(S++,w=0),b===0&&g!==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 k=_.length-1;k>0&&(k>g||_[k].getTrimmedLength()===0);k--)x++;x>0&&(c.push(d+_.length-x),c.push(x)),d+=_.length-1}return c}function s9(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 r9(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 a9(e,t,n){let i=[],r=e.map((p,f)=>ih(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=ih(e,c,t);o>p&&(o-=p,c++);let f=e[c].getWidth(o-1)===2;f&&o--;let _=f?n-1:n;i.push(_),d+=_}return i}function ih(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 fA=class pA{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=pA._nextId++,this._onDispose=this.register(new Ce),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}};fA._nextId=1;var o9=fA,Xn={},xo=Xn.B;Xn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Xn.A={"#":"£"};Xn.B=void 0;Xn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Xn.C=Xn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Xn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Xn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Xn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Xn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Xn.E=Xn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Xn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Xn.H=Xn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Xn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ck=4294967295,uk=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,NT,1,0]),this._whitespaceCell=Is.fromCharData([0,$a,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Jf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new lk(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 Vf),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 Vf),this._whitespaceCell}getBlankLine(e,t){return new ju(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>ck?ck: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 lk(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 ju(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 ju(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=i9(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell($n),n);if(i.length>0){let r=s9(this.lines,i);r9(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 ju(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(),_=a9(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+g):b=Math.max(0,this.lines.length-this.lines.maxLength+g);let S=[];for(let z=0;z<g;z++){let E=this.getBlankLine($n,!0);S.push(E)}S.length>0&&(r.push({start:c+p.length+o,newLines:S}),o+=S.length),p.push(...S);let w=_.length-1,x=_[w];x===0&&(w--,x=_[w]);let k=p.length-g-1,A=f;for(;k>=0;){let z=Math.min(A,x);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[k],A-z,x-z,z,!0),x-=z,x===0&&(w--,x=_[w]),A-=z,A===0){k--;let E=Math.max(k,0);A=ih(p,E,this._cols)}}for(let z=0;z<p.length;z++)_[z]<e&&p[z].setCell(_[z],i);let B=g-b;for(;B-- >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+g,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,_=0,g=r[_];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(g&&g.start>f+b){for(let k=g.newLines.length-1;k>=0;k--)this.lines.set(x--,g.newLines[k]);x++,c.push({index:f+1,amount:g.newLines.length}),b+=g.newLines.length,g=r[++_]}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 o9(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)}},l9=class extends pt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ce),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 uk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new uk(!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)}},mA=2,gA=1,xy=class extends pt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,mA),this.rows=Math.max(e.rawOptions.rows||0,gA),this.buffers=this._register(new l9(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))}};xy=Tn([De(0,Pi)],xy);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:Zf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},c9=["normal","bold","100","200","300","400","500","600","700","800","900"],u9=class extends pt{constructor(e){super(),this._onOptionChange=this._register(new Ce),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(fn(()=>{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]),!h9(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=c9.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 h9(e){return e==="block"||e==="underline"||e==="bar"}function Iu(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]&&Iu(e[i],t-1);return n}var hk=Object.freeze({insertMode:!1}),dk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Cy=class extends pt{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 Ce),this.onData=this._onData.event,this._onUserInput=this._register(new Ce),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ce),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Iu(hk),this.decPrivateModes=Iu(dk)}reset(){this.modes=Iu(hk),this.decPrivateModes=Iu(dk)}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))}};Cy=Tn([De(0,$i),De(1,IT),De(2,Pi)],Cy);var fk={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 L_(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 N_=String.fromCharCode,pk={DEFAULT:e=>{let t=[L_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${N_(t[0])}${N_(t[1])}${N_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${L_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${L_(e,!0)};${e.x};${e.y}${t}`}},ky=class extends pt{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 Ce),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(fk))this.addProtocol(i,fk[i]);for(let i of Object.keys(pk))this.addEncoding(i,pk[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)}};ky=Tn([De(0,$i),De(1,Ho),De(2,Pi)],ky);var M_=[[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]],d9=[[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]],Yn;function f9(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 p9=class{constructor(){if(this.version="6",!Yn){Yn=new Uint8Array(65536),Yn.fill(1),Yn[0]=0,Yn.fill(0,1,32),Yn.fill(0,127,160),Yn.fill(2,4352,4448),Yn[9001]=2,Yn[9002]=2,Yn.fill(2,11904,42192),Yn[12351]=1,Yn.fill(2,44032,55204),Yn.fill(2,63744,64256),Yn.fill(2,65040,65050),Yn.fill(2,65072,65136),Yn.fill(2,65280,65377),Yn.fill(2,65504,65511);for(let e=0;e<M_.length;++e)Yn.fill(0,M_[e][0],M_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Yn[e]:f9(e,d9)?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 Ef{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ce,this.onChange=this._onChange.event;let t=new p9;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=Ef.extractWidth(d);Ef.extractShouldJoin(d)&&(p-=Ef.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},m9=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 mk(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 mu=2147483647,g9=256,_A=class Ey{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>g9)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 Ey;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 Ey(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>mu?mu: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>mu?mu: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,mu):t}},gu=[],_9=class{constructor(){this._state=0,this._active=gu,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=gu}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=gu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||gu,!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",Tp(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=gu,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+=Tp(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}},_u=[],v9=class{constructor(){this._handlers=Object.create(null),this._active=_u,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_u}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=_u,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||_u,!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",Tp(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=_u,this._ident=0}},Bu=new _A;Bu.addParam(0);var gk=class{constructor(e){this._handler=e,this._data="",this._params=Bu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Bu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Tp(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=Bu,this._data="",this._hitLimit=!1,n));return this._params=Bu,this._data="",this._hitLimit=!1,t}},y9=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}},Os=160,b9=(function(){let e=new y9(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(Os,0,2,0),e.add(Os,8,5,8),e.add(Os,6,0,6),e.add(Os,11,0,11),e.add(Os,13,13,13),e})(),S9=class extends pt{constructor(e=b9){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 _A,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(fn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new _9),this._dcsParser=this._register(new v9),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:Os)],r>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){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 _=this._escHandlers[this._collect<<8|i],g=_?_.length-1:-1;for(;g>=0&&(c=_[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,_,g,r,d),c;g<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<Os){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<Os){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}}},w9=/^([\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})$/,x9=/^[\da-f]+$/;function _k(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=w9.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),x9.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 O_(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 C9(e,t=16){let[n,i,r]=e;return`rgb:${O_(n,t)}/${O_(i,t)}/${O_(r,t)}`}var k9={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ra=131072,vk=10;function yk(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 bk=5e3,Sk=0,E9=class extends pt{constructor(e,t,n,i,r,o,c,d,p=new S9){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 q8,this._utf8Decoder=new G8,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=$n.clone(),this._eraseAttrDataInternal=$n.clone(),this._onRequestBell=this._register(new Ce),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ce),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ce),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ce),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ce),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ce),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ce),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ce),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ce),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 Ty(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,_)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:_.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:_,data:g})}),this._parser.setDcsHandlerFallback((f,_,g)=>{_==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:_,payload:g})}),this._parser.setPrintHandler((f,_,g)=>this.print(f,_,g)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Cf.IND,()=>this.index()),this._parser.setExecuteHandler(Cf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Cf.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 Xn)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 gk((f,_)=>this.requestStatusString(f,_)))}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"),bk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${bk} 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>Ra&&(o=this._parseStack.position+Ra)}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<Ra&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ra))),c||this._dirtyRowTracker.clearRange(),e.length>Ra)for(let f=o;f<e.length;f+=Ra){let _=f+Ra<e.length?f+Ra:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(f,_),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,_),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,g))return this._preserveStack(i,r,g,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,_=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let A=o[String.fromCharCode(i)];A&&(i=A.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=ko.extractWidth(w);let x=ko.extractShouldJoin(w),k=x?ko.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(ja(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-k>d){if(p){let A=g,B=this._activeBuffer.x-k;for(this._activeBuffer.x=k,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&g instanceof ju&&g.copyCellsFrom(A,B,0,k,!1);B<d;)A.setCellFromCodepoint(B++,0,1,_)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let A=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-A,i,r);for(let B=r-k;--B>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(f&&(g.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(_)),g.getWidth(d-1)===2&&g.setCellFromCodepoint(d-1,0,1,_)),g.setCellFromCodepoint(this._activeBuffer.x++,i,r,_),r>0)for(;--r;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>yk(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new gk(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 _=o.codePointAt(f)||0;c[d++]=_,f+=_>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(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,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:_}=d,g=this._optionsService.rawOptions,b=(x,k)=>(c.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${x};${k}$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(g.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,g.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(g.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===_)):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|=gh.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(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=$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(!yk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>vk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>vk&&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(wk(o))if(r==="?")t.push({type:0,index:o});else{let c=_k(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=_k(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]);wk(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(k9[e[0]],Xn[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(`${ve.ESC}${c}${ve.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ty=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&&(Sk=e,e=t,t=Sk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ty=Tn([De(0,$i)],Ty);function wk(e){return 0<=e&&e<256}var T9=5e7,xk=12,A9=50,R9=class extends pt{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 Ce),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>T9)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>=xk?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>=xk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>A9&&(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()}},Ay=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)))}};Ay=Tn([De(0,$i)],Ay);var Ck=!1,L9=class extends pt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Zl),this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ce),this._instantiationService=new e9,this.optionsService=this._register(new u9(e)),this._instantiationService.setService(Pi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(xy)),this._instantiationService.setService($i,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(wy)),this._instantiationService.setService(IT,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Cy)),this._instantiationService.setService(Ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ky)),this._instantiationService.setService(jT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ko)),this._instantiationService.setService(X8,this.unicodeService),this._charsetService=this._instantiationService.createInstance(m9),this._instantiationService.setService(Y8,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Ay),this._instantiationService.setService(BT,this._oscLinkService),this._inputHandler=this._register(new E9(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(vi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(vi.forward(this._bufferService.onResize,this._onResize)),this._register(vi.forward(this.coreService.onData,this._onData)),this._register(vi.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 R9((t,n)=>this._inputHandler.parse(t,n))),this._register(vi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ce),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&&!Ck&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Ck=!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,mA),t=Math.max(t,gA),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(mk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(mk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=fn(()=>{for(let t of e)t.dispose()})}}},N9={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 M9(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(r.key=ve.ESC+r.key);break;case 9:if(e.shiftKey){r.key=ve.ESC+"[Z";break}r.key=ve.HT,r.cancel=!0;break;case 13:r.key=e.altKey?ve.ESC+ve.CR:ve.CR,r.cancel=!0;break;case 27:r.key=ve.ESC,e.altKey&&(r.key=ve.ESC+ve.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"D":t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"C":t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"A":t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"B":t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=ve.ESC+"[2~");break;case 46:o?r.key=ve.ESC+"[3;"+(o+1)+"~":r.key=ve.ESC+"[3~";break;case 36:o?r.key=ve.ESC+"[1;"+(o+1)+"H":t?r.key=ve.ESC+"OH":r.key=ve.ESC+"[H";break;case 35:o?r.key=ve.ESC+"[1;"+(o+1)+"F":t?r.key=ve.ESC+"OF":r.key=ve.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=ve.ESC+"[5;"+(o+1)+"~":r.key=ve.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=ve.ESC+"[6;"+(o+1)+"~":r.key=ve.ESC+"[6~";break;case 112:o?r.key=ve.ESC+"[1;"+(o+1)+"P":r.key=ve.ESC+"OP";break;case 113:o?r.key=ve.ESC+"[1;"+(o+1)+"Q":r.key=ve.ESC+"OQ";break;case 114:o?r.key=ve.ESC+"[1;"+(o+1)+"R":r.key=ve.ESC+"OR";break;case 115:o?r.key=ve.ESC+"[1;"+(o+1)+"S":r.key=ve.ESC+"OS";break;case 116:o?r.key=ve.ESC+"[15;"+(o+1)+"~":r.key=ve.ESC+"[15~";break;case 117:o?r.key=ve.ESC+"[17;"+(o+1)+"~":r.key=ve.ESC+"[17~";break;case 118:o?r.key=ve.ESC+"[18;"+(o+1)+"~":r.key=ve.ESC+"[18~";break;case 119:o?r.key=ve.ESC+"[19;"+(o+1)+"~":r.key=ve.ESC+"[19~";break;case 120:o?r.key=ve.ESC+"[20;"+(o+1)+"~":r.key=ve.ESC+"[20~";break;case 121:o?r.key=ve.ESC+"[21;"+(o+1)+"~":r.key=ve.ESC+"[21~";break;case 122:o?r.key=ve.ESC+"[23;"+(o+1)+"~":r.key=ve.ESC+"[23~";break;case 123:o?r.key=ve.ESC+"[24;"+(o+1)+"~":r.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=ve.DEL:e.keyCode===219?r.key=ve.ESC:e.keyCode===220?r.key=ve.FS:e.keyCode===221&&(r.key=ve.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let c=N9[e.keyCode]?.[e.shiftKey?1:0];if(c)r.key=ve.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=ve.ESC+p}else if(e.keyCode===32)r.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),r.key=ve.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=ve.US),e.key==="@"&&(r.key=ve.NUL));break}return r}var Nn=0,O9=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Jf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Jf,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||(Nn=this._search(t),Nn===-1)||this._getKey(this._array[Nn])!==t)return!1;do if(this._array[Nn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Nn),!0;while(++Nn<this._array.length&&this._getKey(this._array[Nn])===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&&(Nn=this._search(e),!(Nn<0||Nn>=this._array.length)&&this._getKey(this._array[Nn])===e))do yield this._array[Nn];while(++Nn<this._array.length&&this._getKey(this._array[Nn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Nn=this._search(e),!(Nn<0||Nn>=this._array.length)&&this._getKey(this._array[Nn])===e))do t(this._array[Nn]);while(++Nn<this._array.length&&this._getKey(this._array[Nn])===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}},D_=0,kk=0,D9=class extends pt{constructor(){super(),this._decorations=new O9(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Ce),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ce),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(fn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new j9(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=>{D_=r.options.x??0,kk=D_+(r.options.width??1),e>=D_&&e<kk&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},j9=class extends Ha{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ce),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ce),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=gn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=gn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},I9=1e3,B9=class{constructor(e,t=I9){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)}},Ek=20,Qf=class extends pt{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 B9(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(fn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Ek+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ek+1&&(this._liveRegion.textContent+=Vv.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,_=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(f);if(!g)return console.warn("columns is null. Race condition?"),null;let b=p<g.length?g[p]:g.slice(-1)[0]+1;return b>=this._terminal.cols&&(++_,b=0),{row:_,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})`}};Qf=Tn([De(1,Xb),De(2,Jr),De(3,Qr)],Qf);var Ry=class extends pt{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 Ce),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ce),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(fn(()=>{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&&$9(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}}};Ry=Tn([De(1,Zb),De(2,Qr),De(3,$i),De(4,PT)],Ry);function $9(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 P9=class extends L9{constructor(e={}){super(e),this._linkifier=this._register(new Zl),this.browser=sA,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Zl),this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ce),this.onKey=this._onKey.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ce),this.onBell=this._onBell.event,this._onFocus=this._register(new Ce),this._onBlur=this._register(new Ce),this._onA11yCharEmitter=this._register(new Ce),this._onA11yTabEmitter=this._register(new Ce),this._onWillOpen=this._register(new Ce),this._setup(),this._decorationService=this._instantiationService.createInstance(D9),this._instantiationService.setService(_h,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(AB),this._instantiationService.setService(PT,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Xv)),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(vi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(vi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(vi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(vi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(fn(()=>{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(`${ve.ESC}]${i};${C9(r)}${nA.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=zn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=zn.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(Qf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,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()&&U8(t,this._selectionService)}));let e=t=>W8(t,this.textarea,this.coreService,this.optionsService);this._register(nt(this.textarea,"paste",e)),this._register(nt(this.element,"paste",e)),rA?this._register(nt(this.element,"mousedown",t=>{t.button===2&&IC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(nt(this.element,"contextmenu",t=>{IC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),r0&&this._register(nt(this.element,"auxclick",t=>{t.button===1&<(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",Kv.get()),lA||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(EB,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Jr,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(_y,this._document,this._helperContainer),this._instantiationService.setService(Ap,this._charSizeService),this._themeService=this._instantiationService.createInstance(Sy),this._instantiationService.setService(cc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xf),this._instantiationService.setService($T,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(yy,this.rows,this.screenElement)),this._instantiationService.setService(Qr,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(py,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(vy),this._instantiationService.setService(Zb,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Ry,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(dy,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(by,this.element,this.screenElement,i)),this._instantiationService.setService(J8,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(vi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(fy,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(Qf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(gy,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=ve.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){RT(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=M9(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ve.ETX||n.key===ve.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(z9(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(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function z9(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var H9=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)}},F9=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)}},Tk=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 F9(t)}getNullCell(){return new Is}},U9=class extends pt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ce),this.onBufferChange=this._onBufferChange.event,this._normal=new Tk(this._core.buffers.normal,"normal"),this._alternate=new Tk(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)}},W9=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)}},q9=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}},G9=["cols","rows"],lr=0,K9=class extends pt{constructor(e){super(),this._core=this._register(new P9(e)),this._addonManager=this._register(new H9),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(G9.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 W9(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new q9(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 U9(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 Kv.get()},set promptLabel(e){Kv.set(e)},get tooMuchOutput(){return Vv.get()},set tooMuchOutput(e){Vv.set(e)}}}_verifyIntegers(...e){for(lr of e)if(lr===1/0||isNaN(lr)||lr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(lr of e)if(lr&&(lr===1/0||isNaN(lr)||lr%1!==0||lr<0))throw new Error("This API only accepts positive integers")}};function V9(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)},_=()=>{i=!1,o!==null&&clearTimeout(o),c!==null&&(clearTimeout(c),c=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},g=()=>{t=!1,o===null&&(p(),i=!1)},b=()=>{t=!1,r=!1,p(),d()},S=w=>{if(o===null){if(t||n||X9(w)){i=!0,n&&!t?_():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),i&&_()},onCompositionCancel:g,handleKeyEvent(w){return Y9(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 Y9(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function X9(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function Z9({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,c=!1;const d=()=>{o=!1,c=!1},p=b=>{Ak(b)&&(o=!0,c=!1)},f=()=>{o&&(c=!0)},_=b=>{const S=o&&c&&Ak(b);if(d(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},g=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),n.addEventListener("mouseup",_),n.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),g.dispose(),t.removeEventListener("mousedown",p,!0),n.removeEventListener("mouseup",_),n.removeEventListener("blur",d))}}}function Ak(e){return e.button===0}function J9(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 Q9={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:J9((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},e$="Symbols Nerd Font Mono",Kd=`ui-monospace, "SF Mono", Menlo, "${e$}", monospace`,a0=14,vA=10,yA=22,t$={min:vA,max:yA},n$="cascadia",sh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Kd}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Kd}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Kd}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Kd}`,meta:"Variable · Adobe mono"}],ql=sh[0];function i$(e){return sh.find(t=>t.id===e)??ql}function rh(){return{source:"curated",id:n$,customName:"",family:ql.family,size:a0}}function o0(e,t){const n=i$(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:u0(t)}}function l0(e,t){const n=a$(e);return{source:"custom",id:null,customName:n,family:zf(n,ql.family),size:u0(t)}}function bA(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=u0(typeof t.size=="number"?t.size:a0);return t.source==="custom"&&typeof t.customName=="string"?l0(t.customName,n):typeof t.id=="string"&&r$(t.id)?o0(t.id,n):null}function c0(e){if(!e)return rh();try{const t=bA(JSON.parse(e));if(t!==null)return t}catch{}return rh()}function s$(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function u0(e){return Number.isFinite(e)?Math.min(yA,Math.max(vA,Math.round(e))):a0}function r$(e){return sh.some(t=>t.id===e)}function a$(e){return xp(e)}const ep="fleet-plugin.terminal.renderer",Gl="fleet-plugin.terminal.font",Rk="fleet-console.terminalRenderer",Lk="fleet-console.terminalFont",Ly=new Set;let Fa=y$(),ah=null,No=0;function o$(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(ep)!==null||window.localStorage.getItem(Gl)!==null)return;const e=window.localStorage.getItem(Rk),t=window.localStorage.getItem(Lk),n=e==="webgl"||e==="dom"?e:"webgl",i=c0(t);window.localStorage.setItem(ep,n),window.localStorage.setItem(Gl,s$(i)),window.localStorage.removeItem(Rk),window.localStorage.removeItem(Lk)}catch{}}function l$(e){No+=1,ah=e,f$()}function SA(){return y.useSyncExternalStore(v$,Nk,Nk)}function c$(e){g$(e),Jl({renderer:e})}function u$(e){const t=o0(e,Fa.font.size);No+=1,Jl({font:t}),Np(t)}function h$(e){const t=l0(e,Fa.font.size);No+=1,Jl({font:t}),Np(t)}function d$(e){const t=Fa.font.source==="custom"?l0(Fa.font.customName,e):o0(Fa.font.id,e);No+=1,Jl({font:t}),Np(t)}async function f$(){if(!ah)return;const e=No;try{const t=await ah.read("terminal");if(t!==null){const n=bA(t.font);if(n!==null){if(e!==No)return;Jl({font:n});try{window.localStorage.removeItem(Gl)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Gl)}catch{}if(n!==null){const i=c0(n);if(e!==No)return;Jl({font:i}),Np(i);try{window.localStorage.removeItem(Gl)}catch{}}}}catch{}}async function Np(e){if(ah)try{await ah.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function p$(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(ep);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function m$(){if(typeof window>"u")return rh();try{return c0(window.localStorage.getItem(Gl))}catch{return rh()}}function g$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ep,e)}catch{}}function _$(){for(const e of Ly)e()}function Jl(e){Fa={...Fa,...e},_$()}function v$(e){return Ly.add(e),()=>{Ly.delete(e)}}function Nk(){return Fa}function y$(){return typeof window>"u"?{renderer:"webgl",font:rh()}:(o$(),{renderer:p$(),font:m$()})}function Mk({baseY:e,viewportY:t}){return t>=e}function b$(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:f,viewportY:_}=e.getViewport();n=Math.max(0,f-_)},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=Mk(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,p()},preserveAfterGeometryChange:f=>{f(),c(),d()},restoreAfterOutputParsing:()=>{if(t){p();return}Mk(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function S$({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!w$(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function w$(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 x$="Symbols Nerd Font Mono",C$=`1em "${x$}"`,k$=650;let Vd=null;function wA(){return Vd||(Vd=T$(),Vd)}async function E$(){await A$(wA(),k$)}async function T$(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(C$)}catch{}}async function A$(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 R$=80,L$=16,N$=250,M$=1024*1024,O$=120,D$={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)"},j$={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)"},I$={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 h0({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,zoom:c=1}){const d=i,{renderer:p,font:f}=SA(),_=y.useRef(null),g=y.useRef(null),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(null),k=y.useRef(null),[A,B]=y.useState(c),z=y.useRef(r);z.current=r;const E=y.useRef(o);E.current=o;const[M,j]=y.useState("connecting"),[H,U]=y.useState(0);y.useEffect(()=>{const Y=_.current;if(!Y)return;let $=!1,L=null,P=null,D=null;return(async()=>{if(await E$(),$)return;const R=Ok(d),N=new K9({...Q9,fontFamily:f.family,fontSize:f.size*A,theme:R});g.current=N;const F=new Lj;k.current=F,N.loadAddon(F),N.open(Y),Dk(Y,R);const W=Z9({terminal:N,selectionTarget:Y,windowTarget:window,clipboard:navigator.clipboard});N.loadAddon(new iI),N.unicode.activeVersion="11";const O=V9(()=>N.input(`
|
|
98
|
+
`)),V=Y.querySelector("textarea.xterm-helper-textarea, textarea")??Y;V.addEventListener("compositionstart",O.onCompositionStart),V.addEventListener("compositionend",O.onCompositionEnd),V.addEventListener("focusout",O.onCompositionCancel);const J=S$({getPlatform:()=>navigator.platform,getSelection:()=>N.getSelection(),writeText:xe=>navigator.clipboard.writeText(xe)});N.attachCustomKeyEventHandler(xe=>J.handleKeyEvent(xe)&&O.handleKeyEvent(xe));const he=b$({getViewport:()=>N.buffer.active,scrollToBottom:()=>B$(N),scrollToLine:xe=>$$(N,xe),requestFrame:xe=>window.requestAnimationFrame(xe),cancelFrame:xe=>window.cancelAnimationFrame(xe)});x.current=he;const fe=P$(Y,V,he.recordUserViewportChange),le=F$(N,E.current!==!1,he.restoreAfterOutputParsing);w.current=le;const Te=xj({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:xe=>N.onData(Se=>{he.resumeFollowing(),xe(Se)}),write:le.write},onExit:()=>z.current?.(),onStatus:(xe,Se)=>{j(Se?`${xe}: ${Se}`:xe)}});b.current=Te;const Re=()=>{he.preserveAfterGeometryChange(()=>{F.fit(),Te.resize(N.cols,N.rows),N.refresh(0,N.rows-1)})},$e=()=>{P&&clearTimeout(P),P=setTimeout(()=>{P=null,$||Re()},R$)},dt=async()=>{await document.fonts?.ready,!$&&(Re(),Te.start(),E.current!==!1&&N.focus())};L=new ResizeObserver($e),L.observe(Y),dt(),D=()=>{P&&clearTimeout(P),V.removeEventListener("compositionstart",O.onCompositionStart),V.removeEventListener("compositionend",O.onCompositionEnd),V.removeEventListener("focusout",O.onCompositionCancel),O.dispose(),Te.dispose(),W.dispose(),fe.dispose(),le.dispose(),he.dispose(),g.current=null,b.current=null,w.current=null,x.current=null,k.current=null;try{N.dispose()}catch{}},U(xe=>xe+1)})(),()=>{$=!0,L?.disconnect(),D?.()}},[e,t,n]),y.useEffect(()=>{w.current?.setActive(o!==!1),o&&(g.current?.focus(),x.current?.resumeFollowing())},[o]),y.useEffect(()=>{const Y=g.current;if(!Y)return;let $=!1;if(p==="webgl")try{const L=new $8;S.current=L,L.onContextLoss(()=>{if(!$){try{L.dispose()}catch{}S.current===L&&(S.current=null)}}),Y.loadAddon(L)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{$=!0;const L=S.current;if(L){S.current=null;try{L.dispose()}catch{}}}},[p,e,H]),y.useEffect(()=>{const Y=g.current,$=_.current;if(!Y||!$)return;const L=Ok(d);Y.options.theme=L,Dk($,L)},[d,H]),y.useEffect(()=>{const Y=g.current;Y&&(Y.options.fontFamily=f.family,jk(Y,k.current,b.current,x.current))},[f.family,H]),y.useEffect(()=>{if(c===A)return;const Y=setTimeout(()=>B(c),O$);return()=>clearTimeout(Y)},[c,A]),y.useEffect(()=>{const Y=g.current;Y&&(Y.options.fontSize=f.size*A,jk(Y,k.current,b.current,x.current))},[A,f.size,H]);const Q=M.startsWith("live"),oe=A===1?void 0:{width:`${A*100}%`,height:`${A*100}%`,transform:`scale(${1/A})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[Q?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),M]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:_,style:oe})})]})})}function Ok(e){return e==="carbon"?I$:e==="maritime"?j$:D$}function Dk(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function B$(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function $$(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function P$(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=z$(S,i)},_=()=>{r&&c()},g=()=>{const S=r;r=!1,S&&c()},b=S=>{H$(S)&&c()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",p,{capture:!0,passive:!0}),i.addEventListener("touchend",g),i.addEventListener("touchcancel",g),i.addEventListener("pointerdown",f,!0),i.addEventListener("scroll",_),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",p,!0),i.removeEventListener("touchend",g),i.removeEventListener("touchcancel",g),i.removeEventListener("pointerdown",f,!0),i.removeEventListener("scroll",_),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function z$(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function H$(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function F$(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 g=U$(d,c);d=[],c=0,e.write(g,()=>{r||n()})},_=()=>{r||o||c===0||(o=setTimeout(f,i?L$:N$))};return{write:g=>{if(!(r||g.byteLength===0)){if(d.push(g),c+=g.byteLength,c>=M$){f();return}_()}},setActive:g=>{if(i!==g){if(i=g,p(),i){f();return}_()}},dispose:()=>{f(),r=!0,d=[],c=0,p()}}}function U$(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 jk(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 W$=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),q$=50*1024;function oh(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(oh):Object.entries(e).some(([t,n])=>W$.has(t.toLowerCase())||oh(n))}function G$(e){if(oh(e)||!$o(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(Y$);return t.every(n=>n!==null)?{clis:t}:null}function K$(e){return oh(e)||!$o(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"&&xA(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&$o(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&X$(e.artifact.html)<=q$?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function V$(e){return!oh(e)&&$o(e)&&xA(e.error)?e.error:null}function Y$(e){if(!$o(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=>$o(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 xA(e){return $o(e)&&typeof e.code=="string"&&typeof e.message=="string"}function $o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function X$(e){return new TextEncoder().encode(e).byteLength}class Ny extends Error{constructor(t,n){super(n),this.code=t}code}const hc=e=>`analysis/${encodeURIComponent(e)}`;function Z$(e,t,n,i){const r=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${r.toString()}`}async function J$(e){const t=await Mp(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=G$(n);if(i)return i;throw Op(t.status,n)}async function CA(e,t){try{const n=await Mp(e,`${hc(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 Q$(e,t,n){await d0(e,`${hc(t)}/start`,n)}async function eP(e,t,n){await d0(e,`${hc(t)}/message`,{text:n})}async function j_(e,t){await d0(e,`${hc(t)}/stop`,{})}async function kA(e,t){const n=await Mp(e,`${hc(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw Op(n.status,await n.json().catch(()=>null))}function tP(e,t,n){return e.subscribe("terminal",`${hc(t)}/stream`,i=>{try{const r=K$(JSON.parse(i.data));r&&n(r)}catch{}})}async function d0(e,t,n){const i=await Mp(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw Op(i.status,await i.json().catch(()=>null))}async function Mp(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Ci?Op(i.status,i.body):i}}function Op(e,t){const n=V$(t);return new Ny(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const nP=32,My={catalog:null,cliId:"",model:"",effort:"",started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],error:null};function iP(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...Ik(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 vu(e,t.message,t.now);if(t.type==="session-lost")return{...vu(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...vu(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{...vu(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...My,catalog:i,...Ik(i)}:My}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:sP(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)].slice(0,nP)}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,error:null}:vu(e,n.error.message,t.now)}function Ik(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 vu(e,t,n){return{...e,busy:!1,phase:"error",runEndedAt:n,error:t}}function sP(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 tp=new Map;function EA(e){const t=rP(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 rP(e,t){const n=tp.get(e);if(n)return n;const i=cP(e,t);return tp.set(e,i),i}function aP(e){tp.get(e)?.dispose()}const oP=2e3,lP=12e4;function cP(e,t){let n=My,i=!1,r=null,o=null,c=null,d=null,p=null,f=0,_=0;const g=new Set,b=E=>{if(i)return;const M=iP(n,E);if(M!==n){n=M;for(const j of g)j()}},S=()=>{o!==null&&(clearTimeout(o),o=null)},w=()=>{S(),o=setTimeout(()=>{o=null,b({type:"error",message:"Analysis response timed out.",now:Date.now()})},lP)},x=()=>{S(),f+=1,_+=1;const E=r;r=null,E?.()},k=()=>{x(),b({type:"session-lost",now:Date.now()})},A=async()=>{if(r)return;const E=++f;let M=null;const j=new Promise(H=>{M=H});r=tP(t,e,H=>{if(!(E!==f||i)){if(H.type==="connected"){b({type:"event",event:H,now:Date.now()}),M?.(),M=null;return}if(H.type==="error"&&Bk(H.error.code)){M?.(),M=null,k();return}(H.type==="complete"||H.type==="error")&&S(),b({type:"event",event:H,now:Date.now()})}}),await Promise.race([j,new Promise(H=>setTimeout(H,oP))])},z={getSnapshot:()=>n,subscribe:E=>(g.add(E),()=>g.delete(E)),dispatch:b,send:async E=>{if(p)try{await p}catch{return}d&&await d;const M=E.trim();if(!M||n.busy||i)return;const j=!n.started,H=++_,U={cliId:n.cliId,model:n.model,effort:n.effort};if(b({type:"sending",started:j,text:M,now:Date.now()}),j){const Q=Q$(t,e,U);c=Q;try{await Q}catch(oe){if(i||H!==_)return;if(!(oe instanceof Ny&&oe.code==="analysis_session_exists")){b({type:"start-failed",message:yu(oe),now:Date.now()});return}}finally{c===Q&&(c=null)}if(i||H!==_||!n.started||(await A(),H!==_||!n.started))return}try{if(await eP(t,e,M),H!==_||!n.busy||!n.started)return;w()}catch(Q){if(i||H!==_)return;Q instanceof Ny&&Bk(Q.code)?k():b({type:"error",message:yu(Q),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 E=j_(t,e).catch(M=>{b({type:"stop-failed",message:yu(M),now:Date.now()})});d=E,await E,d===E&&(d=null)},reset:async()=>{if(p)return p;if(i)return;const E=n.started||n.phase!=="idle"||n.entries.length>0||n.artifacts.length>0;x();const M=(async()=>{d&&await d,c&&await c.catch(()=>{}),E&&await j_(t,e),await kA(t,e).catch(()=>{}),b({type:"reset"})})().catch(j=>{throw b({type:"error",message:`Reset failed: ${yu(j)}`,now:Date.now()}),j});p=M;try{await M}finally{p===M&&(p=null)}},dispose:()=>{i||(i=!0,tp.delete(e),x(),g.clear(),n.started&&j_(t,e).catch(()=>{}))}};return J$(t).then(E=>b({type:"catalog",catalog:E})).catch(E=>b({type:"error",message:yu(E),now:Date.now()})),z}function yu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function Bk(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function uP({context:e}){const{state:t,dispatch:n}=EA(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(),_=y.useRef(null);y.useEffect(()=>{r&&c(r)},[r]);const g=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&&!_.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:_,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===g?.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(TA,{createdAt:S.createdAt})]},S.id)})}):null]}),u.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{p(!1),n({type:"clear-artifacts"}),kA(e.api,e.operationId).catch(()=>{})},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:g?u.jsx(hP,{artifact:g,theme:e.theme},g.id):null})]})}function hP({artifact:e,theme:t}){if(!e.id)return null;const n=getComputedStyle(document.documentElement),i=n.getPropertyValue("--ink-veil").trim()||"Canvas",r=n.getPropertyValue("--ink-pearl").trim()||"CanvasText";return 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(TA,{createdAt:e.createdAt})]}),u.jsx("iframe",{title:e.title,src:Z$(e.id,t,i,r),sandbox:"allow-scripts"})]})}function TA({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"})}function f0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fo=f0();function AA(e){Fo=e}var Gu={exec:()=>null};function Dt(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(Ii.caret,"$1"),n=n.replace(r,c),i},getRegex:()=>new RegExp(n,t)};return i}var dP=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ii={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")},fP=/^(?:[ \t]*(?:\n|$))+/,pP=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,mP=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gP=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,p0=/(?:[*+-]|\d{1,9}[.)])/,RA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,LA=Dt(RA).replace(/bull/g,p0).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(),_P=Dt(RA).replace(/bull/g,p0).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(),m0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vP=/^[^\n]+/,g0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,yP=Dt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",g0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bP=Dt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,p0).getRegex(),Dp="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",_0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,SP=Dt("^ {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",_0).replace("tag",Dp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),NA=Dt(m0).replace("hr",bh).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",Dp).getRegex(),wP=Dt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",NA).getRegex(),v0={blockquote:wP,code:pP,def:yP,fences:mP,heading:gP,hr:bh,html:SP,lheading:LA,list:bP,newline:fP,paragraph:NA,table:Gu,text:vP},$k=Dt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bh).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",Dp).getRegex(),xP={...v0,lheading:_P,table:$k,paragraph:Dt(m0).replace("hr",bh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$k).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",Dp).getRegex()},CP={...v0,html:Dt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_0).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:Gu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Dt(m0).replace("hr",bh).replace("heading",` *#{1,6} *[^
|
|
99
|
+
]`).replace("lheading",LA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},kP=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EP=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,MA=/^( {2,}|\\)\n(?!\s*$)/,TP=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,jp=/[\p{P}\p{S}]/u,y0=/[\s\p{P}\p{S}]/u,OA=/[^\s\p{P}\p{S}]/u,AP=Dt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,y0).getRegex(),DA=/(?!~)[\p{P}\p{S}]/u,RP=/(?!~)[\s\p{P}\p{S}]/u,LP=/(?:[^\s\p{P}\p{S}]|~)/u,NP=Dt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",dP?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),jA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,MP=Dt(jA,"u").replace(/punct/g,jp).getRegex(),OP=Dt(jA,"u").replace(/punct/g,DA).getRegex(),IA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",DP=Dt(IA,"gu").replace(/notPunctSpace/g,OA).replace(/punctSpace/g,y0).replace(/punct/g,jp).getRegex(),jP=Dt(IA,"gu").replace(/notPunctSpace/g,LP).replace(/punctSpace/g,RP).replace(/punct/g,DA).getRegex(),IP=Dt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,OA).replace(/punctSpace/g,y0).replace(/punct/g,jp).getRegex(),BP=Dt(/\\(punct)/,"gu").replace(/punct/g,jp).getRegex(),$P=Dt(/^<(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(),PP=Dt(_0).replace("(?:-->|$)","-->").getRegex(),zP=Dt("^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",PP).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),np=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,HP=Dt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",np).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BA=Dt(/^!?\[(label)\]\[(ref)\]/).replace("label",np).replace("ref",g0).getRegex(),$A=Dt(/^!?\[(ref)\](?:\[\])?/).replace("ref",g0).getRegex(),FP=Dt("reflink|nolink(?!\\()","g").replace("reflink",BA).replace("nolink",$A).getRegex(),Pk=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,b0={_backpedal:Gu,anyPunctuation:BP,autolink:$P,blockSkip:NP,br:MA,code:EP,del:Gu,emStrongLDelim:MP,emStrongRDelimAst:DP,emStrongRDelimUnd:IP,escape:kP,link:HP,nolink:$A,punctuation:AP,reflink:BA,reflinkSearch:FP,tag:zP,text:TP,url:Gu},UP={...b0,link:Dt(/^!?\[(label)\]\((.*?)\)/).replace("label",np).getRegex(),reflink:Dt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",np).getRegex()},Oy={...b0,emStrongRDelimAst:jP,emStrongLDelim:OP,url:Dt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Pk).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:Dt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Pk).getRegex()},WP={...Oy,br:Dt(MA).replace("{2,}","*").getRegex(),text:Dt(Oy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yd={normal:v0,gfm:xP,pedantic:CP},bu={normal:b0,gfm:Oy,breaks:WP,pedantic:UP},qP={"&":"&","<":"<",">":">",'"':""","'":"'"},zk=e=>qP[e];function ur(e,t){if(t){if(Ii.escapeTest.test(e))return e.replace(Ii.escapeReplace,zk)}else if(Ii.escapeTestNoEncode.test(e))return e.replace(Ii.escapeReplaceNoEncode,zk);return e}function Hk(e){try{e=encodeURI(e).replace(Ii.percentDecode,"%")}catch{return null}return e}function Fk(e,t){let n=e.replace(Ii.findPipe,(o,c,d)=>{let p=!1,f=c;for(;--f>=0&&d[f]==="\\";)p=!p;return p?"|":" |"}),i=n.split(Ii.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(Ii.slashPipe,"|");return i}function Su(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 GP(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 Uk(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 KP(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
100
|
+
`).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(`
|
|
101
|
+
`)}var ip=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:Su(n,`
|
|
102
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=KP(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=Su(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:Su(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Su(t[0],`
|
|
104
|
+
`).split(`
|
|
105
|
+
`),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(`
|
|
106
|
+
`),_=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
108
|
+
${f}`:f,r=r?`${r}
|
|
109
|
+
${_}`:_;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(_,o,!0),this.lexer.state.top=g,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
|
|
110
|
+
`+n.join(`
|
|
111
|
+
`),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+`
|
|
112
|
+
`+n.join(`
|
|
113
|
+
`),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(`
|
|
114
|
+
`);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="",_="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let g=t[2].split(`
|
|
115
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),b=e.split(`
|
|
116
|
+
`,1)[0],S=!g.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+`
|
|
117
|
+
`,e=e.substring(b.length+1),p=!0),!p){let A=this.rules.other.nextBulletRegex(w),B=this.rules.other.hrRegex(w),z=this.rules.other.fencesBeginRegex(w),E=this.rules.other.headingBeginRegex(w),M=this.rules.other.htmlBeginRegex(w);for(;e;){let j=e.split(`
|
|
118
|
+
`,1)[0],H;if(b=j,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),H=b):H=b.replace(this.rules.other.tabCharGlobal," "),z.test(b)||E.test(b)||M.test(b)||A.test(b)||B.test(b))break;if(H.search(this.rules.other.nonSpaceChar)>=w||!b.trim())_+=`
|
|
119
|
+
`+H.slice(w);else{if(S||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(g)||E.test(g)||B.test(g))break;_+=`
|
|
120
|
+
`+b}!S&&!b.trim()&&(S=!0),f+=j+`
|
|
121
|
+
`,e=e.substring(j.length+1),g=H.slice(w)}}r.loose||(c?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0));let x=null,k;this.options.gfm&&(x=this.rules.other.listIsTask.exec(_),x&&(k=x[0]!=="[ ] ",_=_.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!x,checked:k,loose:!1,text:_,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(g=>g.type==="space"),_=f.length>0&&f.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=_}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=Fk(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
122
|
+
`):[],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(Fk(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)===`
|
|
123
|
+
`?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=Su(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=GP(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)),Uk(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 Uk(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 _=[...i[0]][0].length,g=e.slice(0,r+i.index+_+c);if(Math.min(r,c)%2){let S=g.slice(1,-1);return{type:"em",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}let b=g.slice(2,-2);return{type:"strong",raw:g,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}}}},Gs=class Dy{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 ip,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:Ii,block:Yd.normal,inline:bu.normal};this.options.pedantic?(n.block=Yd.pedantic,n.inline=bu.pedantic):this.options.gfm&&(n.block=Yd.gfm,this.options.breaks?n.inline=bu.breaks:n.inline=bu.gfm),this.tokenizer.rules=n}static get rules(){return{block:Yd,inline:bu}}static lex(t,n){return new Dy(n).lex(t)}static lexInline(t,n){return new Dy(n).inlineTokens(t)}lex(t){t=t.replace(Ii.carriageReturn,`
|
|
124
|
+
`),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(Ii.tabCharGlobal," ").replace(Ii.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+=`
|
|
125
|
+
`: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(`
|
|
126
|
+
`)?"":`
|
|
127
|
+
`)+r.raw,c.text+=`
|
|
128
|
+
`+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(`
|
|
129
|
+
`)?"":`
|
|
130
|
+
`)+r.raw,c.text+=`
|
|
131
|
+
`+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(`
|
|
132
|
+
`)?"":`
|
|
133
|
+
`)+r.raw,c.text+=`
|
|
134
|
+
`+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(`
|
|
135
|
+
`)?"":`
|
|
136
|
+
`)+r.raw,c.text+=`
|
|
137
|
+
`+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(_=>(p=_.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 _=n.at(-1);p.type==="text"&&_?.type==="text"?(_.raw+=p.raw,_.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 _=1/0,g=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},g),typeof b=="number"&&b>=0&&(_=Math.min(_,b))}),_<1/0&&_>=0&&(f=t.substring(0,_+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 _=n.at(-1);_?.type==="text"?(_.raw+=p.raw,_.text+=p.text):n.push(p);continue}if(t){let _="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return n}},sp=class{options;parser;constructor(e){this.options=e||Fo}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Ii.notSpaceStart)?.[0],r=e.replace(Ii.endingNewline,"")+`
|
|
138
|
+
`;return i?'<pre><code class="language-'+ur(i)+'">'+(n?r:ur(r,!0))+`</code></pre>
|
|
139
|
+
`:"<pre><code>"+(n?r:ur(r,!0))+`</code></pre>
|
|
140
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
141
|
+
${this.parser.parse(e)}</blockquote>
|
|
142
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
143
|
+
`}hr(e){return`<hr>
|
|
144
|
+
`}list(e){let t=e.ordered,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+`>
|
|
145
|
+
`+i+"</"+r+`>
|
|
146
|
+
`}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+" "+ur(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>
|
|
147
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
148
|
+
`}table(e){let t="",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>
|
|
149
|
+
<thead>
|
|
150
|
+
`+t+`</thead>
|
|
151
|
+
`+i+`</table>
|
|
152
|
+
`}tablerow({text:e}){return`<tr>
|
|
153
|
+
${e}</tr>
|
|
154
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
155
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ur(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=Hk(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+ur(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=Hk(e);if(r===null)return ur(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${ur(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ur(e.text)}},S0=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""}},Ks=class jy{options;renderer;textRenderer;constructor(t){this.options=t||Fo,this.options.renderer=this.options.renderer||new sp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new S0}static parse(t,n){return new jy(n).parse(t)}static parseInline(t,n){return new jy(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+=`
|
|
156
|
+
`+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}},$u=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?Gs.lex:Gs.lexInline}provideParser(){return this.block?Ks.parse:Ks.parseInline}},PA=class{defaults=f0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ks;Renderer=sp;TextRenderer=S0;Lexer=Gs;Tokenizer=ip;Hooks=$u;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 sp(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 _=d.apply(r,f);return _===!1&&(_=p.apply(r,f)),_||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new ip(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 _=d.apply(r,f);return _===!1&&(_=p.apply(r,f)),_}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new $u;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];$u.passThroughHooks.has(o)?r[c]=f=>{if(this.defaults.async&&$u.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await d.call(r,f);return p.call(r,g)})();let _=d.call(r,f);return p.call(r,_)}:r[c]=(...f)=>{if(this.defaults.async)return(async()=>{let g=await d.apply(r,f);return g===!1&&(g=await p.apply(r,f)),g})();let _=d.apply(r,f);return _===!1&&(_=p.apply(r,f)),_}}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 Gs.lex(e,t??this.defaults)}parser(e,t){return Ks.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?Gs.lex:Gs.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?Ks.parse:Ks.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?Gs.lex:Gs.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?Ks.parse:Ks.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+=`
|
|
157
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+ur(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Po=new PA;function Xt(e,t){return Po.parse(e,t)}Xt.options=Xt.setOptions=function(e){return Po.setOptions(e),Xt.defaults=Po.defaults,AA(Xt.defaults),Xt};Xt.getDefaults=f0;Xt.defaults=Fo;Xt.use=function(...e){return Po.use(...e),Xt.defaults=Po.defaults,AA(Xt.defaults),Xt};Xt.walkTokens=function(e,t){return Po.walkTokens(e,t)};Xt.parseInline=Po.parseInline;Xt.Parser=Ks;Xt.parser=Ks.parse;Xt.Renderer=sp;Xt.TextRenderer=S0;Xt.Lexer=Gs;Xt.lexer=Gs.lex;Xt.Tokenizer=ip;Xt.Hooks=$u;Xt.parse=Xt;Xt.options;Xt.setOptions;Xt.use;Xt.walkTokens;Xt.parseInline;Ks.parse;Gs.lex;const{entries:zA,setPrototypeOf:Wk,isFrozen:VP,getPrototypeOf:YP,getOwnPropertyDescriptor:XP}=Object;let{freeze:Bi,seal:$s,create:Ml}=Object,{apply:Iy,construct:By}=typeof Reflect<"u"&&Reflect;Bi||(Bi=function(t){return t});$s||($s=function(t){return t});Iy||(Iy=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)});By||(By=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 wu=Hn(Array.prototype.forEach),ZP=Hn(Array.prototype.lastIndexOf),qk=Hn(Array.prototype.pop),xu=Hn(Array.prototype.push),JP=Hn(Array.prototype.splice),Mi=Array.isArray,Pu=Hn(String.prototype.toLowerCase),I_=Hn(String.prototype.toString),Gk=Hn(String.prototype.match),El=Hn(String.prototype.replace),Kk=Hn(String.prototype.indexOf),QP=Hn(String.prototype.trim),ez=Hn(Number.prototype.toString),tz=Hn(Boolean.prototype.toString),Vk=typeof BigInt>"u"?null:Hn(BigInt.prototype.toString),Yk=typeof Symbol>"u"?null:Hn(Symbol.prototype.toString),xn=Hn(Object.prototype.hasOwnProperty),Cu=Hn(Object.prototype.toString),_i=Hn(RegExp.prototype.test),Xd=nz(TypeError);function Hn(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 Iy(e,t,i)}}function nz(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return By(e,n)}}function ht(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pu;if(Wk&&Wk(e,null),!Mi(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(VP(t)||(t[i]=o),r=o)}e[r]=!0}return e}function iz(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 zA(e))xn(e,n)&&(Mi(i)?t[n]=iz(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Yi(i):t[n]=i);return t}function sz(e){switch(typeof e){case"string":return e;case"number":return ez(e);case"boolean":return tz(e);case"bigint":return Vk?Vk(e):"0";case"symbol":return Yk?Yk(e):"Symbol()";case"undefined":return Cu(e);case"function":case"object":{if(e===null)return Cu(e);const t=e,n=Ol(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:Cu(i)}return Cu(e)}default:return Cu(e)}}function Ol(e,t){for(;e!==null;){const i=XP(e,t);if(i){if(i.get)return Hn(i.get);if(typeof i.value=="function")return Hn(i.value)}e=YP(e)}function n(){return null}return n}function rz(e){try{return _i(e,""),!0}catch{return!1}}const Xk=Bi(["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"]),B_=Bi(["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"]),$_=Bi(["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"]),az=Bi(["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"]),P_=Bi(["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"]),oz=Bi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Zk=Bi(["#text"]),Jk=Bi(["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"]),z_=Bi(["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"]),Qk=Bi(["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"]),Zd=Bi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lz=$s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),cz=$s(/<%[\w\W]*|[\w\W]*%>/gm),uz=$s(/\$\{[\w\W]*/gm),hz=$s(/^data-[\-\w.\u00B7-\uFFFF]+$/),dz=$s(/^aria-[\-\w]+$/),HA=$s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fz=$s(/^(?:\w+script|data):/i),pz=$s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),FA=$s(/^html$/i),mz=$s(/^[a-z][.\w]*(-[.\w]+)+$/i);var e2=Object.freeze({__proto__:null,ARIA_ATTR:dz,ATTR_WHITESPACE:pz,CUSTOM_ELEMENT:mz,DATA_ATTR:hz,DOCTYPE_NAME:FA,ERB_EXPR:cz,IS_ALLOWED_URI:HA,IS_SCRIPT_OR_DATA:fz,MUSTACHE_EXPR:lz,TMPLIT_EXPR:uz});const ku={element:1,text:3,progressingInstruction:7,comment:8,document:9},gz=function(){return typeof window>"u"?null:window},_z=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}},t2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function UA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gz();const t=Oe=>UA(Oe);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==ku.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:_=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:b,trustedTypes:S}=e,w=p.prototype,x=Ol(w,"cloneNode"),k=Ol(w,"remove"),A=Ol(w,"nextSibling"),B=Ol(w,"childNodes"),z=Ol(w,"parentNode");if(typeof c=="function"){const Oe=n.createElement("template");Oe.content&&Oe.content.ownerDocument&&(n=Oe.content.ownerDocument)}let E,M="";const{implementation:j,createNodeIterator:H,createDocumentFragment:U,getElementsByTagName:Q}=n,{importNode:oe}=i;let Y=t2();t.isSupported=typeof zA=="function"&&typeof z=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$,ERB_EXPR:L,TMPLIT_EXPR:P,DATA_ATTR:D,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:F}=e2;let{IS_ALLOWED_URI:W}=e2,O=null;const V=ht({},[...Xk,...B_,...$_,...P_,...Zk]);let J=null;const he=ht({},[...Jk,...z_,...Qk,...Zd]);let fe=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}})),le=null,Te=null;const Re=Object.seal(Ml(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,dt=!0,xe=!1,Se=!0,Ee=!1,Ke=!0,de=!1,Ge=!1,Le=!1,et=!1,Bt=!1,Tt=!1,Un=!0,we=!1;const qe="user-content-";let it=!0,Ei=!1,vn={},cn=null;const bi=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 zs=null;const _s=ht({},["audio","video","img","source","image","track"]);let Qi=null;const Zn=ht({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),An="http://www.w3.org/1998/Math/MathML",ie="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml";let Be=ue,Me=!1,Fe=null;const At=ht({},[An,ie,ue],I_);let Ti=ht({},["mi","mo","mn","ms","mtext"]),Rt=ht({},["annotation-xml"]);const Mn=ht({},["title","style","font","a","script"]);let Ft=null;const G=["application/xhtml+xml","text/html"],pe="text/html";let ye=null,ze=null;const $t=n.createElement("form"),Lt=function(q){return q instanceof RegExp||q instanceof Function},Ie=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ze&&ze===q)return;(!q||typeof q!="object")&&(q={}),q=Yi(q),Ft=G.indexOf(q.PARSER_MEDIA_TYPE)===-1?pe:q.PARSER_MEDIA_TYPE,ye=Ft==="application/xhtml+xml"?I_:Pu,O=xn(q,"ALLOWED_TAGS")&&Mi(q.ALLOWED_TAGS)?ht({},q.ALLOWED_TAGS,ye):V,J=xn(q,"ALLOWED_ATTR")&&Mi(q.ALLOWED_ATTR)?ht({},q.ALLOWED_ATTR,ye):he,Fe=xn(q,"ALLOWED_NAMESPACES")&&Mi(q.ALLOWED_NAMESPACES)?ht({},q.ALLOWED_NAMESPACES,I_):At,Qi=xn(q,"ADD_URI_SAFE_ATTR")&&Mi(q.ADD_URI_SAFE_ATTR)?ht(Yi(Zn),q.ADD_URI_SAFE_ATTR,ye):Zn,zs=xn(q,"ADD_DATA_URI_TAGS")&&Mi(q.ADD_DATA_URI_TAGS)?ht(Yi(_s),q.ADD_DATA_URI_TAGS,ye):_s,cn=xn(q,"FORBID_CONTENTS")&&Mi(q.FORBID_CONTENTS)?ht({},q.FORBID_CONTENTS,ye):bi,le=xn(q,"FORBID_TAGS")&&Mi(q.FORBID_TAGS)?ht({},q.FORBID_TAGS,ye):Yi({}),Te=xn(q,"FORBID_ATTR")&&Mi(q.FORBID_ATTR)?ht({},q.FORBID_ATTR,ye):Yi({}),vn=xn(q,"USE_PROFILES")?q.USE_PROFILES&&typeof q.USE_PROFILES=="object"?Yi(q.USE_PROFILES):q.USE_PROFILES:!1,$e=q.ALLOW_ARIA_ATTR!==!1,dt=q.ALLOW_DATA_ATTR!==!1,xe=q.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=q.SAFE_FOR_TEMPLATES||!1,Ke=q.SAFE_FOR_XML!==!1,de=q.WHOLE_DOCUMENT||!1,et=q.RETURN_DOM||!1,Bt=q.RETURN_DOM_FRAGMENT||!1,Tt=q.RETURN_TRUSTED_TYPE||!1,Le=q.FORCE_BODY||!1,Un=q.SANITIZE_DOM!==!1,we=q.SANITIZE_NAMED_PROPS||!1,it=q.KEEP_CONTENT!==!1,Ei=q.IN_PLACE||!1,W=rz(q.ALLOWED_URI_REGEXP)?q.ALLOWED_URI_REGEXP:HA,Be=typeof q.NAMESPACE=="string"?q.NAMESPACE:ue,Ti=xn(q,"MATHML_TEXT_INTEGRATION_POINTS")&&q.MATHML_TEXT_INTEGRATION_POINTS&&typeof q.MATHML_TEXT_INTEGRATION_POINTS=="object"?Yi(q.MATHML_TEXT_INTEGRATION_POINTS):ht({},["mi","mo","mn","ms","mtext"]),Rt=xn(q,"HTML_INTEGRATION_POINTS")&&q.HTML_INTEGRATION_POINTS&&typeof q.HTML_INTEGRATION_POINTS=="object"?Yi(q.HTML_INTEGRATION_POINTS):ht({},["annotation-xml"]);const se=xn(q,"CUSTOM_ELEMENT_HANDLING")&&q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING=="object"?Yi(q.CUSTOM_ELEMENT_HANDLING):Ml(null);if(fe=Ml(null),xn(se,"tagNameCheck")&&Lt(se.tagNameCheck)&&(fe.tagNameCheck=se.tagNameCheck),xn(se,"attributeNameCheck")&&Lt(se.attributeNameCheck)&&(fe.attributeNameCheck=se.attributeNameCheck),xn(se,"allowCustomizedBuiltInElements")&&typeof se.allowCustomizedBuiltInElements=="boolean"&&(fe.allowCustomizedBuiltInElements=se.allowCustomizedBuiltInElements),Ee&&(dt=!1),Bt&&(et=!0),vn&&(O=ht({},Zk),J=Ml(null),vn.html===!0&&(ht(O,Xk),ht(J,Jk)),vn.svg===!0&&(ht(O,B_),ht(J,z_),ht(J,Zd)),vn.svgFilters===!0&&(ht(O,$_),ht(J,z_),ht(J,Zd)),vn.mathMl===!0&&(ht(O,P_),ht(J,Qk),ht(J,Zd))),Re.tagCheck=null,Re.attributeCheck=null,xn(q,"ADD_TAGS")&&(typeof q.ADD_TAGS=="function"?Re.tagCheck=q.ADD_TAGS:Mi(q.ADD_TAGS)&&(O===V&&(O=Yi(O)),ht(O,q.ADD_TAGS,ye))),xn(q,"ADD_ATTR")&&(typeof q.ADD_ATTR=="function"?Re.attributeCheck=q.ADD_ATTR:Mi(q.ADD_ATTR)&&(J===he&&(J=Yi(J)),ht(J,q.ADD_ATTR,ye))),xn(q,"ADD_URI_SAFE_ATTR")&&Mi(q.ADD_URI_SAFE_ATTR)&&ht(Qi,q.ADD_URI_SAFE_ATTR,ye),xn(q,"FORBID_CONTENTS")&&Mi(q.FORBID_CONTENTS)&&(cn===bi&&(cn=Yi(cn)),ht(cn,q.FORBID_CONTENTS,ye)),xn(q,"ADD_FORBID_CONTENTS")&&Mi(q.ADD_FORBID_CONTENTS)&&(cn===bi&&(cn=Yi(cn)),ht(cn,q.ADD_FORBID_CONTENTS,ye)),it&&(O["#text"]=!0),de&&ht(O,["html","head","body"]),O.table&&(ht(O,["tbody"]),delete le.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=q.TRUSTED_TYPES_POLICY,M=E.createHTML("")}else E===void 0&&(E=_z(S,r)),E!==null&&typeof M=="string"&&(M=E.createHTML(""));Bi&&Bi(q),ze=q},Ne=ht({},[...B_,...$_,...az]),Ye=ht({},[...P_,...oz]),tn=function(q){let se=z(q);(!se||!se.tagName)&&(se={namespaceURI:Be,tagName:"template"});const Ae=Pu(q.tagName),st=Pu(se.tagName);return Fe[q.namespaceURI]?q.namespaceURI===ie?se.namespaceURI===ue?Ae==="svg":se.namespaceURI===An?Ae==="svg"&&(st==="annotation-xml"||Ti[st]):!!Ne[Ae]:q.namespaceURI===An?se.namespaceURI===ue?Ae==="math":se.namespaceURI===ie?Ae==="math"&&Rt[st]:!!Ye[Ae]:q.namespaceURI===ue?se.namespaceURI===ie&&!Rt[st]||se.namespaceURI===An&&!Ti[st]?!1:!Ye[Ae]&&(Mn[Ae]||!Ne[Ae]):!!(Ft==="application/xhtml+xml"&&Fe[q.namespaceURI]):!1},gt=function(q){xu(t.removed,{element:q});try{z(q).removeChild(q)}catch{k(q)}},Wn=function(q,se){try{xu(t.removed,{attribute:se.getAttributeNode(q),from:se})}catch{xu(t.removed,{attribute:null,from:se})}if(se.removeAttribute(q),q==="is")if(et||Bt)try{gt(se)}catch{}else try{se.setAttribute(q,"")}catch{}},Hs=function(q){let se=null,Ae=null;if(Le)q="<remove></remove>"+q;else{const jt=Gk(q,/^[\r\n\t ]+/);Ae=jt&&jt[0]}Ft==="application/xhtml+xml"&&Be===ue&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const st=E?E.createHTML(q):q;if(Be===ue)try{se=new b().parseFromString(st,Ft)}catch{}if(!se||!se.documentElement){se=j.createDocument(Be,"template",null);try{se.documentElement.innerHTML=Me?M:st}catch{}}const rt=se.body||se.documentElement;return q&&Ae&&rt.insertBefore(n.createTextNode(Ae),rt.childNodes[0]||null),Be===ue?Q.call(se,de?"html":"body")[0]:de?se.documentElement:rt},es=function(q){return H.call(q.ownerDocument||q,q,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},ui=function(q){return q instanceof g&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof _)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},Ut=function(q){return typeof d=="function"&&q instanceof d};function re(Oe,q,se){wu(Oe,Ae=>{Ae.call(t,q,se,ze)})}const ot=function(q){let se=null;if(re(Y.beforeSanitizeElements,q,null),ui(q))return gt(q),!0;const Ae=ye(q.nodeName);if(re(Y.uponSanitizeElement,q,{tagName:Ae,allowedTags:O}),Ke&&q.hasChildNodes()&&!Ut(q.firstElementChild)&&_i(/<[/\w!]/g,q.innerHTML)&&_i(/<[/\w!]/g,q.textContent)||Ke&&q.namespaceURI===ue&&Ae==="style"&&Ut(q.firstElementChild)||q.nodeType===ku.progressingInstruction||Ke&&q.nodeType===ku.comment&&_i(/<[/\w]/g,q.data))return gt(q),!0;if(le[Ae]||!(Re.tagCheck instanceof Function&&Re.tagCheck(Ae))&&!O[Ae]){if(!le[Ae]&&tt(Ae)&&(fe.tagNameCheck instanceof RegExp&&_i(fe.tagNameCheck,Ae)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(Ae)))return!1;if(it&&!cn[Ae]){const st=z(q)||q.parentNode,rt=B(q)||q.childNodes;if(rt&&st){const jt=rt.length;for(let Zt=jt-1;Zt>=0;--Zt){const Et=x(rt[Zt],!0);st.insertBefore(Et,A(q))}}}return gt(q),!0}return q instanceof p&&!tn(q)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&_i(/<\/no(script|embed|frames)/i,q.innerHTML)?(gt(q),!0):(Ee&&q.nodeType===ku.text&&(se=q.textContent,wu([$,L,P],st=>{se=El(se,st," ")}),q.textContent!==se&&(xu(t.removed,{element:q.cloneNode()}),q.textContent=se)),re(Y.afterSanitizeElements,q,null),!1)},Wt=function(q,se,Ae){if(Te[se]||Un&&(se==="id"||se==="name")&&(Ae in n||Ae in $t))return!1;const st=J[se]||Re.attributeCheck instanceof Function&&Re.attributeCheck(se,q);if(!(dt&&!Te[se]&&_i(D,se))){if(!($e&&_i(T,se))){if(!st||Te[se]){if(!(tt(q)&&(fe.tagNameCheck instanceof RegExp&&_i(fe.tagNameCheck,q)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(q))&&(fe.attributeNameCheck instanceof RegExp&&_i(fe.attributeNameCheck,se)||fe.attributeNameCheck instanceof Function&&fe.attributeNameCheck(se,q))||se==="is"&&fe.allowCustomizedBuiltInElements&&(fe.tagNameCheck instanceof RegExp&&_i(fe.tagNameCheck,Ae)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(Ae))))return!1}else if(!Qi[se]){if(!_i(W,El(Ae,N,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&q!=="script"&&Kk(Ae,"data:")===0&&zs[q])){if(!(xe&&!_i(R,El(Ae,N,"")))){if(Ae)return!1}}}}}}return!0},vt=ht({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),tt=function(q){return!vt[Pu(q)]&&_i(F,q)},yn=function(q){re(Y.beforeSanitizeAttributes,q,null);const{attributes:se}=q;if(!se||ui(q))return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let st=se.length;for(;st--;){const rt=se[st],{name:jt,namespaceURI:Zt,value:Et}=rt,be=ye(jt),He=Et;let je=jt==="value"?He:QP(He);if(Ae.attrName=be,Ae.attrValue=je,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,re(Y.uponSanitizeAttribute,q,Ae),je=Ae.attrValue,we&&(be==="id"||be==="name")&&Kk(je,qe)!==0&&(Wn(jt,q),je=qe+je),Ke&&_i(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,je)){Wn(jt,q);continue}if(be==="attributename"&&Gk(je,"href")){Wn(jt,q);continue}if(Ae.forceKeepAttr)continue;if(!Ae.keepAttr){Wn(jt,q);continue}if(!Se&&_i(/\/>/i,je)){Wn(jt,q);continue}Ee&&wu([$,L,P],Qt=>{je=El(je,Qt," ")});const St=ye(q.nodeName);if(!Wt(St,be,je)){Wn(jt,q);continue}if(E&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!Zt)switch(S.getAttributeType(St,be)){case"TrustedHTML":{je=E.createHTML(je);break}case"TrustedScriptURL":{je=E.createScriptURL(je);break}}if(je!==He)try{Zt?q.setAttributeNS(Zt,jt,je):q.setAttribute(jt,je),ui(q)?gt(q):qk(t.removed)}catch{Wn(jt,q)}}re(Y.afterSanitizeAttributes,q,null)},un=function(q){let se=null;const Ae=es(q);for(re(Y.beforeSanitizeShadowDOM,q,null);se=Ae.nextNode();)re(Y.uponSanitizeShadowNode,se,null),ot(se),yn(se),se.content instanceof o&&un(se.content);re(Y.afterSanitizeShadowDOM,q,null)};return t.sanitize=function(Oe){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,Ae=null,st=null,rt=null;if(Me=!Oe,Me&&(Oe="<!-->"),typeof Oe!="string"&&!Ut(Oe)&&(Oe=sz(Oe),typeof Oe!="string"))throw Xd("dirty is not a string, aborting");if(!t.isSupported)return Oe;if(Ge||Ie(q),t.removed=[],typeof Oe=="string"&&(Ei=!1),Ei){const Et=Oe.nodeName;if(typeof Et=="string"){const be=ye(Et);if(!O[be]||le[be])throw Xd("root node is forbidden and cannot be sanitized in-place")}}else if(Oe instanceof d)se=Hs("<!---->"),Ae=se.ownerDocument.importNode(Oe,!0),Ae.nodeType===ku.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?se=Ae:se.appendChild(Ae);else{if(!et&&!Ee&&!de&&Oe.indexOf("<")===-1)return E&&Tt?E.createHTML(Oe):Oe;if(se=Hs(Oe),!se)return et?null:Tt?M:""}se&&Le&>(se.firstChild);const jt=es(Ei?Oe:se);for(;st=jt.nextNode();)ot(st),yn(st),st.content instanceof o&&un(st.content);if(Ei)return Oe;if(et){if(Ee){se.normalize();let Et=se.innerHTML;wu([$,L,P],be=>{Et=El(Et,be," ")}),se.innerHTML=Et}if(Bt)for(rt=U.call(se.ownerDocument);se.firstChild;)rt.appendChild(se.firstChild);else rt=se;return(J.shadowroot||J.shadowrootmode)&&(rt=oe.call(i,rt,!0)),rt}let Zt=de?se.outerHTML:se.innerHTML;return de&&O["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&_i(FA,se.ownerDocument.doctype.name)&&(Zt="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
|
|
158
|
+
`+Zt),Ee&&wu([$,L,P],Et=>{Zt=El(Zt,Et," ")}),E&&Tt?E.createHTML(Zt):Zt},t.setConfig=function(){let Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(Oe),Ge=!0},t.clearConfig=function(){ze=null,Ge=!1},t.isValidAttribute=function(Oe,q,se){ze||Ie({});const Ae=ye(Oe),st=ye(q);return Wt(Ae,st,se)},t.addHook=function(Oe,q){typeof q=="function"&&xu(Y[Oe],q)},t.removeHook=function(Oe,q){if(q!==void 0){const se=ZP(Y[Oe],q);return se===-1?void 0:JP(Y[Oe],se,1)[0]}return qk(Y[Oe])},t.removeHooks=function(Oe){Y[Oe]=[]},t.removeAllHooks=function(){Y=t2()},t}var Ku=UA(),H_,n2;function vz(){if(n2)return H_;n2=1;function e(G){return G instanceof Map?G.clear=G.delete=G.set=function(){throw new Error("map is read-only")}:G instanceof Set&&(G.add=G.clear=G.delete=function(){throw new Error("set is read-only")}),Object.freeze(G),Object.getOwnPropertyNames(G).forEach(pe=>{const ye=G[pe],ze=typeof ye;(ze==="object"||ze==="function")&&!Object.isFrozen(ye)&&e(ye)}),G}class t{constructor(pe){pe.data===void 0&&(pe.data={}),this.data=pe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(G){return G.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(G,...pe){const ye=Object.create(null);for(const ze in G)ye[ze]=G[ze];return pe.forEach(function(ze){for(const $t in ze)ye[$t]=ze[$t]}),ye}const r="</span>",o=G=>!!G.scope,c=(G,{prefix:pe})=>{if(G.startsWith("language:"))return G.replace("language:","language-");if(G.includes(".")){const ye=G.split(".");return[`${pe}${ye.shift()}`,...ye.map((ze,$t)=>`${ze}${"_".repeat($t+1)}`)].join(" ")}return`${pe}${G}`};class d{constructor(pe,ye){this.buffer="",this.classPrefix=ye.classPrefix,pe.walk(this)}addText(pe){this.buffer+=n(pe)}openNode(pe){if(!o(pe))return;const ye=c(pe.scope,{prefix:this.classPrefix});this.span(ye)}closeNode(pe){o(pe)&&(this.buffer+=r)}value(){return this.buffer}span(pe){this.buffer+=`<span class="${pe}">`}}const p=(G={})=>{const pe={children:[]};return Object.assign(pe,G),pe};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(pe){this.top.children.push(pe)}openNode(pe){const ye=p({scope:pe});this.add(ye),this.stack.push(ye)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(pe){return this.constructor._walk(pe,this.rootNode)}static _walk(pe,ye){return typeof ye=="string"?pe.addText(ye):ye.children&&(pe.openNode(ye),ye.children.forEach(ze=>this._walk(pe,ze)),pe.closeNode(ye)),pe}static _collapse(pe){typeof pe!="string"&&pe.children&&(pe.children.every(ye=>typeof ye=="string")?pe.children=[pe.children.join("")]:pe.children.forEach(ye=>{f._collapse(ye)}))}}class _ extends f{constructor(pe){super(),this.options=pe}addText(pe){pe!==""&&this.add(pe)}startScope(pe){this.openNode(pe)}endScope(){this.closeNode()}__addSublanguage(pe,ye){const ze=pe.root;ye&&(ze.scope=`language:${ye}`),this.add(ze)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(G){return G?typeof G=="string"?G:G.source:null}function b(G){return x("(?=",G,")")}function S(G){return x("(?:",G,")*")}function w(G){return x("(?:",G,")?")}function x(...G){return G.map(ye=>g(ye)).join("")}function k(G){const pe=G[G.length-1];return typeof pe=="object"&&pe.constructor===Object?(G.splice(G.length-1,1),pe):{}}function A(...G){return"("+(k(G).capture?"":"?:")+G.map(ze=>g(ze)).join("|")+")"}function B(G){return new RegExp(G.toString()+"|").exec("").length-1}function z(G,pe){const ye=G&&G.exec(pe);return ye&&ye.index===0}const E=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(G,{joinWith:pe}){let ye=0;return G.map(ze=>{ye+=1;const $t=ye;let Lt=g(ze),Ie="";for(;Lt.length>0;){const Ne=E.exec(Lt);if(!Ne){Ie+=Lt;break}Ie+=Lt.substring(0,Ne.index),Lt=Lt.substring(Ne.index+Ne[0].length),Ne[0][0]==="\\"&&Ne[1]?Ie+="\\"+String(Number(Ne[1])+$t):(Ie+=Ne[0],Ne[0]==="("&&ye++)}return Ie}).map(ze=>`(${ze})`).join(pe)}const j=/\b\B/,H="[a-zA-Z]\\w*",U="[a-zA-Z_]\\w*",Q="\\b\\d+(\\.\\d+)?",oe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Y="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",L=(G={})=>{const pe=/^#![ ]*\//;return G.binary&&(G.begin=x(pe,/.*\b/,G.binary,/\b.*/)),i({scope:"meta",begin:pe,end:/$/,relevance:0,"on:begin":(ye,ze)=>{ye.index!==0&&ze.ignoreMatch()}},G)},P={begin:"\\\\[\\s\\S]",relevance:0},D={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[P]},T={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[P]},R={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/},N=function(G,pe,ye={}){const ze=i({scope:"comment",begin:G,end:pe,contains:[]},ye);ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const $t=A("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ze.contains.push({begin:x(/[ ]+/,"(",$t,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ze},F=N("//","$"),W=N("/\\*","\\*/"),O=N("#","$"),V={scope:"number",begin:Q,relevance:0},J={scope:"number",begin:oe,relevance:0},he={scope:"number",begin:Y,relevance:0},fe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[P,{begin:/\[/,end:/\]/,relevance:0,contains:[P]}]},le={scope:"title",begin:H,relevance:0},Te={scope:"title",begin:U,relevance:0},Re={begin:"\\.\\s*"+U,relevance:0};var dt=Object.freeze({__proto__:null,APOS_STRING_MODE:D,BACKSLASH_ESCAPE:P,BINARY_NUMBER_MODE:he,BINARY_NUMBER_RE:Y,COMMENT:N,C_BLOCK_COMMENT_MODE:W,C_LINE_COMMENT_MODE:F,C_NUMBER_MODE:J,C_NUMBER_RE:oe,END_SAME_AS_BEGIN:function(G){return Object.assign(G,{"on:begin":(pe,ye)=>{ye.data._beginMatch=pe[1]},"on:end":(pe,ye)=>{ye.data._beginMatch!==pe[1]&&ye.ignoreMatch()}})},HASH_COMMENT_MODE:O,IDENT_RE:H,MATCH_NOTHING_RE:j,METHOD_GUARD:Re,NUMBER_MODE:V,NUMBER_RE:Q,PHRASAL_WORDS_MODE:R,QUOTE_STRING_MODE:T,REGEXP_MODE:fe,RE_STARTERS_RE:$,SHEBANG:L,TITLE_MODE:le,UNDERSCORE_IDENT_RE:U,UNDERSCORE_TITLE_MODE:Te});function xe(G,pe){G.input[G.index-1]==="."&&pe.ignoreMatch()}function Se(G,pe){G.className!==void 0&&(G.scope=G.className,delete G.className)}function Ee(G,pe){pe&&G.beginKeywords&&(G.begin="\\b("+G.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",G.__beforeBegin=xe,G.keywords=G.keywords||G.beginKeywords,delete G.beginKeywords,G.relevance===void 0&&(G.relevance=0))}function Ke(G,pe){Array.isArray(G.illegal)&&(G.illegal=A(...G.illegal))}function de(G,pe){if(G.match){if(G.begin||G.end)throw new Error("begin & end are not supported with match");G.begin=G.match,delete G.match}}function Ge(G,pe){G.relevance===void 0&&(G.relevance=1)}const Le=(G,pe)=>{if(!G.beforeMatch)return;if(G.starts)throw new Error("beforeMatch cannot be used with starts");const ye=Object.assign({},G);Object.keys(G).forEach(ze=>{delete G[ze]}),G.keywords=ye.keywords,G.begin=x(ye.beforeMatch,b(ye.begin)),G.starts={relevance:0,contains:[Object.assign(ye,{endsParent:!0})]},G.relevance=0,delete ye.beforeMatch},et=["of","and","for","in","not","or","if","then","parent","list","value"],Bt="keyword";function Tt(G,pe,ye=Bt){const ze=Object.create(null);return typeof G=="string"?$t(ye,G.split(" ")):Array.isArray(G)?$t(ye,G):Object.keys(G).forEach(function(Lt){Object.assign(ze,Tt(G[Lt],pe,Lt))}),ze;function $t(Lt,Ie){pe&&(Ie=Ie.map(Ne=>Ne.toLowerCase())),Ie.forEach(function(Ne){const Ye=Ne.split("|");ze[Ye[0]]=[Lt,Un(Ye[0],Ye[1])]})}}function Un(G,pe){return pe?Number(pe):we(G)?0:1}function we(G){return et.includes(G.toLowerCase())}const qe={},it=G=>{console.error(G)},Ei=(G,...pe)=>{console.log(`WARN: ${G}`,...pe)},vn=(G,pe)=>{qe[`${G}/${pe}`]||(console.log(`Deprecated as of ${G}. ${pe}`),qe[`${G}/${pe}`]=!0)},cn=new Error;function bi(G,pe,{key:ye}){let ze=0;const $t=G[ye],Lt={},Ie={};for(let Ne=1;Ne<=pe.length;Ne++)Ie[Ne+ze]=$t[Ne],Lt[Ne+ze]=!0,ze+=B(pe[Ne-1]);G[ye]=Ie,G[ye]._emit=Lt,G[ye]._multi=!0}function zs(G){if(Array.isArray(G.begin)){if(G.skip||G.excludeBegin||G.returnBegin)throw it("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),cn;if(typeof G.beginScope!="object"||G.beginScope===null)throw it("beginScope must be object"),cn;bi(G,G.begin,{key:"beginScope"}),G.begin=M(G.begin,{joinWith:""})}}function _s(G){if(Array.isArray(G.end)){if(G.skip||G.excludeEnd||G.returnEnd)throw it("skip, excludeEnd, returnEnd not compatible with endScope: {}"),cn;if(typeof G.endScope!="object"||G.endScope===null)throw it("endScope must be object"),cn;bi(G,G.end,{key:"endScope"}),G.end=M(G.end,{joinWith:""})}}function Qi(G){G.scope&&typeof G.scope=="object"&&G.scope!==null&&(G.beginScope=G.scope,delete G.scope)}function Zn(G){Qi(G),typeof G.beginScope=="string"&&(G.beginScope={_wrap:G.beginScope}),typeof G.endScope=="string"&&(G.endScope={_wrap:G.endScope}),zs(G),_s(G)}function An(G){function pe(Ie,Ne){return new RegExp(g(Ie),"m"+(G.case_insensitive?"i":"")+(G.unicodeRegex?"u":"")+(Ne?"g":""))}class ye{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ne,Ye){Ye.position=this.position++,this.matchIndexes[this.matchAt]=Ye,this.regexes.push([Ye,Ne]),this.matchAt+=B(Ne)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ne=this.regexes.map(Ye=>Ye[1]);this.matcherRe=pe(M(Ne,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ne){this.matcherRe.lastIndex=this.lastIndex;const Ye=this.matcherRe.exec(Ne);if(!Ye)return null;const tn=Ye.findIndex((Wn,Hs)=>Hs>0&&Wn!==void 0),gt=this.matchIndexes[tn];return Ye.splice(0,tn),Object.assign(Ye,gt)}}class ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ne){if(this.multiRegexes[Ne])return this.multiRegexes[Ne];const Ye=new ye;return this.rules.slice(Ne).forEach(([tn,gt])=>Ye.addRule(tn,gt)),Ye.compile(),this.multiRegexes[Ne]=Ye,Ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ne,Ye){this.rules.push([Ne,Ye]),Ye.type==="begin"&&this.count++}exec(Ne){const Ye=this.getMatcher(this.regexIndex);Ye.lastIndex=this.lastIndex;let tn=Ye.exec(Ne);if(this.resumingScanAtSamePosition()&&!(tn&&tn.index===this.lastIndex)){const gt=this.getMatcher(0);gt.lastIndex=this.lastIndex+1,tn=gt.exec(Ne)}return tn&&(this.regexIndex+=tn.position+1,this.regexIndex===this.count&&this.considerAll()),tn}}function $t(Ie){const Ne=new ze;return Ie.contains.forEach(Ye=>Ne.addRule(Ye.begin,{rule:Ye,type:"begin"})),Ie.terminatorEnd&&Ne.addRule(Ie.terminatorEnd,{type:"end"}),Ie.illegal&&Ne.addRule(Ie.illegal,{type:"illegal"}),Ne}function Lt(Ie,Ne){const Ye=Ie;if(Ie.isCompiled)return Ye;[Se,de,Zn,Le].forEach(gt=>gt(Ie,Ne)),G.compilerExtensions.forEach(gt=>gt(Ie,Ne)),Ie.__beforeBegin=null,[Ee,Ke,Ge].forEach(gt=>gt(Ie,Ne)),Ie.isCompiled=!0;let tn=null;return typeof Ie.keywords=="object"&&Ie.keywords.$pattern&&(Ie.keywords=Object.assign({},Ie.keywords),tn=Ie.keywords.$pattern,delete Ie.keywords.$pattern),tn=tn||/\w+/,Ie.keywords&&(Ie.keywords=Tt(Ie.keywords,G.case_insensitive)),Ye.keywordPatternRe=pe(tn,!0),Ne&&(Ie.begin||(Ie.begin=/\B|\b/),Ye.beginRe=pe(Ye.begin),!Ie.end&&!Ie.endsWithParent&&(Ie.end=/\B|\b/),Ie.end&&(Ye.endRe=pe(Ye.end)),Ye.terminatorEnd=g(Ye.end)||"",Ie.endsWithParent&&Ne.terminatorEnd&&(Ye.terminatorEnd+=(Ie.end?"|":"")+Ne.terminatorEnd)),Ie.illegal&&(Ye.illegalRe=pe(Ie.illegal)),Ie.contains||(Ie.contains=[]),Ie.contains=[].concat(...Ie.contains.map(function(gt){return ue(gt==="self"?Ie:gt)})),Ie.contains.forEach(function(gt){Lt(gt,Ye)}),Ie.starts&&Lt(Ie.starts,Ne),Ye.matcher=$t(Ye),Ye}if(G.compilerExtensions||(G.compilerExtensions=[]),G.contains&&G.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return G.classNameAliases=i(G.classNameAliases||{}),Lt(G)}function ie(G){return G?G.endsWithParent||ie(G.starts):!1}function ue(G){return G.variants&&!G.cachedVariants&&(G.cachedVariants=G.variants.map(function(pe){return i(G,{variants:null},pe)})),G.cachedVariants?G.cachedVariants:ie(G)?i(G,{starts:G.starts?i(G.starts):null}):Object.isFrozen(G)?i(G):G}var Be="11.11.1";class Me extends Error{constructor(pe,ye){super(pe),this.name="HTMLInjectionError",this.html=ye}}const Fe=n,At=i,Ti=Symbol("nomatch"),Rt=7,Mn=function(G){const pe=Object.create(null),ye=Object.create(null),ze=[];let $t=!0;const Lt="Could not find the language '{}', did you forget to load/include a language module?",Ie={disableAutodetect:!0,name:"Plain text",contains:[]};let Ne={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:_};function Ye(be){return Ne.noHighlightRe.test(be)}function tn(be){let He=be.className+" ";He+=be.parentNode?be.parentNode.className:"";const je=Ne.languageDetectRe.exec(He);if(je){const St=q(je[1]);return St||(Ei(Lt.replace("{}",je[1])),Ei("Falling back to no-highlight mode for this block.",be)),St?je[1]:"no-highlight"}return He.split(/\s+/).find(St=>Ye(St)||q(St))}function gt(be,He,je){let St="",Qt="";typeof He=="object"?(St=be,je=He.ignoreIllegals,Qt=He.language):(vn("10.7.0","highlight(lang, code, ...args) has been deprecated."),vn("10.7.0",`Please use highlight(code, options) instead.
|
|
159
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Qt=be,St=He),je===void 0&&(je=!0);const qn={code:St,language:Qt};Zt("before:highlight",qn);const Ai=qn.result?qn.result:Wn(qn.language,qn.code,je);return Ai.code=qn.code,Zt("after:highlight",Ai),Ai}function Wn(be,He,je,St){const Qt=Object.create(null);function qn(ke,Ue){return ke.keywords[Ue]}function Ai(){if(!Qe.keywords){On.addText(Pt);return}let ke=0;Qe.keywordPatternRe.lastIndex=0;let Ue=Qe.keywordPatternRe.exec(Pt),lt="";for(;Ue;){lt+=Pt.substring(ke,Ue.index);const wt=hi.case_insensitive?Ue[0].toLowerCase():Ue[0],pn=qn(Qe,wt);if(pn){const[vs,gc]=pn;if(On.addText(lt),lt="",Qt[wt]=(Qt[wt]||0)+1,Qt[wt]<=Rt&&(ta+=gc),vs.startsWith("_"))lt+=Ue[0];else{const kh=hi.classNameAliases[vs]||vs;ts(Ue[0],kh)}}else lt+=Ue[0];ke=Qe.keywordPatternRe.lastIndex,Ue=Qe.keywordPatternRe.exec(Pt)}lt+=Pt.substring(ke),On.addText(lt)}function Si(){if(Pt==="")return;let ke=null;if(typeof Qe.subLanguage=="string"){if(!pe[Qe.subLanguage]){On.addText(Pt);return}ke=Wn(Qe.subLanguage,Pt,!0,Ch[Qe.subLanguage]),Ch[Qe.subLanguage]=ke._top}else ke=es(Pt,Qe.subLanguage.length?Qe.subLanguage:null);Qe.relevance>0&&(ta+=ke.relevance),On.__addSublanguage(ke._emitter,ke.language)}function qt(){Qe.subLanguage!=null?Si():Ai(),Pt=""}function ts(ke,Ue){ke!==""&&(On.startScope(Ue),On.addText(ke),On.endScope())}function wh(ke,Ue){let lt=1;const wt=Ue.length-1;for(;lt<=wt;){if(!ke._emit[lt]){lt++;continue}const pn=hi.classNameAliases[ke[lt]]||ke[lt],vs=Ue[lt];pn?ts(vs,pn):(Pt=vs,Ai(),Pt=""),lt++}}function Uo(ke,Ue){return ke.scope&&typeof ke.scope=="string"&&On.openNode(hi.classNameAliases[ke.scope]||ke.scope),ke.beginScope&&(ke.beginScope._wrap?(ts(Pt,hi.classNameAliases[ke.beginScope._wrap]||ke.beginScope._wrap),Pt=""):ke.beginScope._multi&&(wh(ke.beginScope,Ue),Pt="")),Qe=Object.create(ke,{parent:{value:Qe}}),Qe}function fc(ke,Ue,lt){let wt=z(ke.endRe,lt);if(wt){if(ke["on:end"]){const pn=new t(ke);ke["on:end"](Ue,pn),pn.isMatchIgnored&&(wt=!1)}if(wt){for(;ke.endsParent&&ke.parent;)ke=ke.parent;return ke}}if(ke.endsWithParent)return fc(ke.parent,Ue,lt)}function Wo(ke){return Qe.matcher.regexIndex===0?(Pt+=ke[0],1):(na=!0,0)}function Wp(ke){const Ue=ke[0],lt=ke.rule,wt=new t(lt),pn=[lt.__beforeBegin,lt["on:begin"]];for(const vs of pn)if(vs&&(vs(ke,wt),wt.isMatchIgnored))return Wo(Ue);return lt.skip?Pt+=Ue:(lt.excludeBegin&&(Pt+=Ue),qt(),!lt.returnBegin&&!lt.excludeBegin&&(Pt=Ue)),Uo(lt,ke),lt.returnBegin?0:Ue.length}function zi(ke){const Ue=ke[0],lt=He.substring(ke.index),wt=fc(Qe,ke,lt);if(!wt)return Ti;const pn=Qe;Qe.endScope&&Qe.endScope._wrap?(qt(),ts(Ue,Qe.endScope._wrap)):Qe.endScope&&Qe.endScope._multi?(qt(),wh(Qe.endScope,ke)):pn.skip?Pt+=Ue:(pn.returnEnd||pn.excludeEnd||(Pt+=Ue),qt(),pn.excludeEnd&&(Pt=Ue));do Qe.scope&&On.closeNode(),!Qe.skip&&!Qe.subLanguage&&(ta+=Qe.relevance),Qe=Qe.parent;while(Qe!==wt.parent);return wt.starts&&Uo(wt.starts,ke),pn.returnEnd?0:Ue.length}function pc(){const ke=[];for(let Ue=Qe;Ue!==hi;Ue=Ue.parent)Ue.scope&&ke.unshift(Ue.scope);ke.forEach(Ue=>On.openNode(Ue))}let Ja={};function qo(ke,Ue){const lt=Ue&&Ue[0];if(Pt+=ke,lt==null)return qt(),0;if(Ja.type==="begin"&&Ue.type==="end"&&Ja.index===Ue.index&<===""){if(Pt+=He.slice(Ue.index,Ue.index+1),!$t){const wt=new Error(`0 width match regex (${be})`);throw wt.languageName=be,wt.badRule=Ja.rule,wt}return 1}if(Ja=Ue,Ue.type==="begin")return Wp(Ue);if(Ue.type==="illegal"&&!je){const wt=new Error('Illegal lexeme "'+lt+'" for mode "'+(Qe.scope||"<unnamed>")+'"');throw wt.mode=Qe,wt}else if(Ue.type==="end"){const wt=zi(Ue);if(wt!==Ti)return wt}if(Ue.type==="illegal"&<==="")return Pt+=`
|
|
160
|
+
`,1;if(mc>1e5&&mc>Ue.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pt+=lt,lt.length}const hi=q(be);if(!hi)throw it(Lt.replace("{}",be)),new Error('Unknown language: "'+be+'"');const xh=An(hi);let Go="",Qe=St||xh;const Ch={},On=new Ne.__emitter(Ne);pc();let Pt="",ta=0,Sr=0,mc=0,na=!1;try{if(hi.__emitTokens)hi.__emitTokens(He,On);else{for(Qe.matcher.considerAll();;){mc++,na?na=!1:Qe.matcher.considerAll(),Qe.matcher.lastIndex=Sr;const ke=Qe.matcher.exec(He);if(!ke)break;const Ue=He.substring(Sr,ke.index),lt=qo(Ue,ke);Sr=ke.index+lt}qo(He.substring(Sr))}return On.finalize(),Go=On.toHTML(),{language:be,value:Go,relevance:ta,illegal:!1,_emitter:On,_top:Qe}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:be,value:Fe(He),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:Sr,context:He.slice(Sr-100,Sr+100),mode:ke.mode,resultSoFar:Go},_emitter:On};if($t)return{language:be,value:Fe(He),illegal:!1,relevance:0,errorRaised:ke,_emitter:On,_top:Qe};throw ke}}function Hs(be){const He={value:Fe(be),illegal:!1,relevance:0,_top:Ie,_emitter:new Ne.__emitter(Ne)};return He._emitter.addText(be),He}function es(be,He){He=He||Ne.languages||Object.keys(pe);const je=Hs(be),St=He.filter(q).filter(Ae).map(qt=>Wn(qt,be,!1));St.unshift(je);const Qt=St.sort((qt,ts)=>{if(qt.relevance!==ts.relevance)return ts.relevance-qt.relevance;if(qt.language&&ts.language){if(q(qt.language).supersetOf===ts.language)return 1;if(q(ts.language).supersetOf===qt.language)return-1}return 0}),[qn,Ai]=Qt,Si=qn;return Si.secondBest=Ai,Si}function ui(be,He,je){const St=He&&ye[He]||je;be.classList.add("hljs"),be.classList.add(`language-${St}`)}function Ut(be){let He=null;const je=tn(be);if(Ye(je))return;if(Zt("before:highlightElement",{el:be,language:je}),be.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",be);return}if(be.children.length>0&&(Ne.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(be)),Ne.throwUnescapedHTML))throw new Me("One of your code blocks includes unescaped HTML.",be.innerHTML);He=be;const St=He.textContent,Qt=je?gt(St,{language:je,ignoreIllegals:!0}):es(St);be.innerHTML=Qt.value,be.dataset.highlighted="yes",ui(be,je,Qt.language),be.result={language:Qt.language,re:Qt.relevance,relevance:Qt.relevance},Qt.secondBest&&(be.secondBest={language:Qt.secondBest.language,relevance:Qt.secondBest.relevance}),Zt("after:highlightElement",{el:be,result:Qt,text:St})}function re(be){Ne=At(Ne,be)}const ot=()=>{tt(),vn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Wt(){tt(),vn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let vt=!1;function tt(){function be(){tt()}if(document.readyState==="loading"){vt||window.addEventListener("DOMContentLoaded",be,!1),vt=!0;return}document.querySelectorAll(Ne.cssSelector).forEach(Ut)}function yn(be,He){let je=null;try{je=He(G)}catch(St){if(it("Language definition for '{}' could not be registered.".replace("{}",be)),$t)it(St);else throw St;je=Ie}je.name||(je.name=be),pe[be]=je,je.rawDefinition=He.bind(null,G),je.aliases&&se(je.aliases,{languageName:be})}function un(be){delete pe[be];for(const He of Object.keys(ye))ye[He]===be&&delete ye[He]}function Oe(){return Object.keys(pe)}function q(be){return be=(be||"").toLowerCase(),pe[be]||pe[ye[be]]}function se(be,{languageName:He}){typeof be=="string"&&(be=[be]),be.forEach(je=>{ye[je.toLowerCase()]=He})}function Ae(be){const He=q(be);return He&&!He.disableAutodetect}function st(be){be["before:highlightBlock"]&&!be["before:highlightElement"]&&(be["before:highlightElement"]=He=>{be["before:highlightBlock"](Object.assign({block:He.el},He))}),be["after:highlightBlock"]&&!be["after:highlightElement"]&&(be["after:highlightElement"]=He=>{be["after:highlightBlock"](Object.assign({block:He.el},He))})}function rt(be){st(be),ze.push(be)}function jt(be){const He=ze.indexOf(be);He!==-1&&ze.splice(He,1)}function Zt(be,He){const je=be;ze.forEach(function(St){St[je]&&St[je](He)})}function Et(be){return vn("10.7.0","highlightBlock will be removed entirely in v12.0"),vn("10.7.0","Please use highlightElement now."),Ut(be)}Object.assign(G,{highlight:gt,highlightAuto:es,highlightAll:tt,highlightElement:Ut,highlightBlock:Et,configure:re,initHighlighting:ot,initHighlightingOnLoad:Wt,registerLanguage:yn,unregisterLanguage:un,listLanguages:Oe,getLanguage:q,registerAliases:se,autoDetection:Ae,inherit:At,addPlugin:rt,removePlugin:jt}),G.debugMode=function(){$t=!1},G.safeMode=function(){$t=!0},G.versionString=Be,G.regex={concat:x,lookahead:b,either:A,optional:w,anyNumberOfTimes:S};for(const be in dt)typeof dt[be]=="object"&&e(dt[be]);return Object.assign(G,dt),G},Ft=Mn({});return Ft.newInstance=()=>Mn({}),H_=Ft,Ft.HighlightJS=Ft,Ft.default=Ft,H_}var yz=vz();const As=Ab(yz);function i2(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:/'/},_={match:/\\'/},g={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"],k=["true","false"],A={match:/(\/[a-z._-]+)+/},B=["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"],E=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],M=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:x,literal:k,built_in:[...B,...z,"set","shopt",...E,...M]},contains:[S,e.SHEBANG(),w,g,o,c,A,d,p,f,_,n]}}const s2="[A-Za-z$_][0-9A-Za-z$_]*",bz=["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"],Sz=["true","false","null","undefined","NaN","Infinity"],WA=["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"],qA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],GA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],wz=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],xz=[].concat(GA,WA,qA);function r2(e){const t=e.regex,n=(N,{after:F})=>{const W="</"+N[0].slice(1);return N.input.indexOf(W,F)!==-1},i=s2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(N,F)=>{const W=N[0].length+N.index,O=N.input[W];if(O==="<"||O===","){F.ignoreMatch();return}O===">"&&(n(N,{after:W})||F.ignoreMatch());let V;const J=N.input.substring(W);if(V=J.match(/^\s*=/)){F.ignoreMatch();return}if((V=J.match(/^\s+extends\s+/))&&V.index===0){F.ignoreMatch();return}}},d={$pattern:s2,keyword:bz,literal:Sz,built_in:xz,"variable.language":wz},p="[0-9](_?[0-9])*",f=`\\.(${p})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${_})\\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"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},B={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,k,{match:/\$\d+/},g];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const E=[].concat(B,b.contains),M=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(E)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:M},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"}}]},U={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:{_:[...WA,...qA]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},oe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(N){return t.concat("(?!",N.join("|"),")")}const L={match:t.concat(/\b/,$([...GA,"super","import"].map(N=>`${N}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",R={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,B,{match:/\$\d+/},g,U,{scope:"attr",match:i+t.lookahead(":"),relevance:0},R,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:M}]}]},{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"]}]}]},oe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},L,Y,H,D,{match:/\$[(.]/}]}}function Cz(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 a2(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}/}]},_={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(f,{contains:[]}),b=e.inherit(_,{contains:[]});f.contains.push(b),_.contains.push(g);let S=[n,p];return[f,_,g,b].forEach(A=>{A.contains=A.contains.concat(S)}),S=S.concat(f,_),{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,_,{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 o2(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:/#/},_={begin:/\{\{/,relevance:0},g={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,_,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,_,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,_,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,_,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})`}]},k={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},A={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,x,g,e.HASH_COMMENT_MODE]}]};return f.contains=[g,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"},g,k,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[A]},{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,A,g]}]}}const rp="[A-Za-z$_][0-9A-Za-z$_]*",KA=["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"],VA=["true","false","null","undefined","NaN","Infinity"],YA=["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"],XA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ZA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],JA=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],QA=[].concat(ZA,YA,XA);function kz(e){const t=e.regex,n=(N,{after:F})=>{const W="</"+N[0].slice(1);return N.input.indexOf(W,F)!==-1},i=rp,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(N,F)=>{const W=N[0].length+N.index,O=N.input[W];if(O==="<"||O===","){F.ignoreMatch();return}O===">"&&(n(N,{after:W})||F.ignoreMatch());let V;const J=N.input.substring(W);if(V=J.match(/^\s*=/)){F.ignoreMatch();return}if((V=J.match(/^\s+extends\s+/))&&V.index===0){F.ignoreMatch();return}}},d={$pattern:rp,keyword:KA,literal:VA,built_in:QA,"variable.language":JA},p="[0-9](_?[0-9])*",f=`\\.(${p})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${_})\\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"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},B={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,k,{match:/\$\d+/},g];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const E=[].concat(B,b.contains),M=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(E)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:M},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"}}]},U={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:{_:[...YA,...XA]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},oe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(N){return t.concat("(?!",N.join("|"),")")}const L={match:t.concat(/\b/,$([...ZA,"super","import"].map(N=>`${N}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",R={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,B,{match:/\$\d+/},g,U,{scope:"attr",match:i+t.lookahead(":"),relevance:0},R,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:M}]}]},{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"]}]}]},oe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},L,Y,H,D,{match:/\$[(.]/}]}}function l2(e){const t=e.regex,n=kz(e),i=rp,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:rp,keyword:KA.concat(p),literal:VA,built_in:QA.concat(r),"variable.language":JA},_={className:"meta",begin:"@"+i},g=(x,k,A)=>{const B=x.contains.findIndex(z=>z.label===k);if(B===-1)throw new Error("can not find mode to replace");x.contains.splice(B,1,A)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(_);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([_,o,c,S]),g(n,"shebang",e.SHEBANG()),g(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 Ez=/\[\[wiki:([^\]]+)\]\]/g,Tz=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Az=/^(\S[^:]*?):[ \t]*(.*)$/,Rz=new PA({gfm:!0,breaks:!1}),c2={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},F_=Uz();function Bs(e,t={}){const{entries:n,content:i}=Mz(e),r=jz(i,t.resolveWikiLink),o=Rz.parse(r,{async:!1}),c=Dz(n),d=Ku.sanitize(c+o,c2),p=new DOMParser().parseFromString(d,"text/html");return Bz(p,t.omitDuplicateTitle),Iz(p),$z(p),zz(p),{html:Ku.sanitize(p.body.innerHTML,c2),toc:Hz(p)}}function Lz(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function Nz(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 Mz(e){const t=Tz.exec(e);return t?{entries:Oz(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function Oz(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=Az.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 Dz(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${Vu(n.key)}</dt><dd>${Vu(n.value)}</dd>`).join("")}</dl>`}function jz(e,t){return e.replace(Ez,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return Vu(`[[wiki:${r}]]`);const o=t(r);if(o===null)return Vu(`[[wiki:${r}]]`);const c=Vu(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${c}</a>`})}function Iz(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=Gz(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function Bz(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||u2(n.textContent??"")===u2(t)&&n.remove()}function $z(e){for(const t of e.querySelectorAll("pre > code")){const n=Wz(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",Lz(i)),c.setAttribute("data-diagram-state","pending"),r.replaceWith(c);continue}const o=Fz(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(Pz(e,n||"text"),r.firstChild)}}function Pz(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 zz(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";qz(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function Hz(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 Fz(e,t){return t&&F_.getLanguage(t)?F_.highlight(e,{language:t}).value:F_.highlightAuto(e).value}function Uz(){return As.registerLanguage("bash",i2),As.registerLanguage("sh",i2),As.registerLanguage("javascript",r2),As.registerLanguage("js",r2),As.registerLanguage("json",Cz),As.registerLanguage("markdown",a2),As.registerLanguage("md",a2),As.registerLanguage("python",o2),As.registerLanguage("py",o2),As.registerLanguage("typescript",l2),As.registerLanguage("ts",l2),As}function Wz(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function qz(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function Gz(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function u2(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Vu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const Kz="modulepreload",Vz=function(e){return"/console/"+e},h2={},Yz=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let p=function(f){return Promise.all(f.map(_=>Promise.resolve(_).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");r=p(n.map(f=>{if(f=Vz(f),f in h2)return;h2[f]=!0;const _=f.endsWith(".css"),g=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const b=document.createElement("link");if(b.rel=_?"stylesheet":Kz,_||(b.as="script"),b.crossOrigin="",b.href=f,d&&b.setAttribute("nonce",d),document.head.appendChild(b),_)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)})},Xz=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",Zz=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Jz=/^on/i,Qz={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},d2="diagramInteractionBound",eH=/^oklch\s*\(\s*([^)]+)\s*\)$/i,tH=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Ms=[25,50,75,100,125,150,200],nH=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let U_=null;const f2=new WeakSet;let iH=0,sH=0,lh=null;function Ia(e){const t=e.trim();if(!t)return t;const n=EH(t);return n?TH(n):t}function Ip(e){if(f2.has(e))return;f2.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"){lh&&!lh.trigger.isConnected&&zu(!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(Xz);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",rH(n))}async function rH(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=Nz(t)}catch{W_(e,"Invalid diagram source");return}if(!n.trim()){W_(e,"Empty diagram source");return}try{const i=await oH(),r=`mermaid-diagram-${++iH}`,{svg:o}=await i.render(r,n);e.innerHTML=aH(o),uH(e,o),hH(e),dH(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);W_(e,r)}}function W_(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function aH(e){const t=(n,i)=>{Jz.test(i.attrName)&&(i.keepAttr=!1)};Ku.addHook("uponSanitizeAttribute",t);try{return Ku.sanitize(e,Qz)}finally{Ku.removeHook("uponSanitizeAttribute",t)}}async function oH(){return U_||(U_=(async()=>{const e=await Yz(()=>import("./mermaid.core-ho7gOyUr.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:lH(),themeCSS:cH(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),U_}function lH(){const e=getComputedStyle(document.documentElement),t=(x,k)=>{const A=e.getPropertyValue(x).trim();return Ia(A||k)},n=(x,k)=>e.getPropertyValue(x).trim()||k,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"),_=t("--ink-fog","#a6afbb"),g=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,c,p,Ia("oklch(70% 0.11 68)"),d,Ia("oklch(76% 0.09 205)"),o,Ia("oklch(68% 0.14 30)"),_,Ia("oklch(62% 0.08 228)"),Ia("oklch(52% 0.05 248)")],w=Object.fromEntries(nH.map((x,k)=>[x,S[k]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:g,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:g,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:g,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:g,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function cH(){const e=getComputedStyle(document.documentElement),t=(f,_)=>{const g=e.getPropertyValue(f).trim();return Ia(g||_)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),c=Ia("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
|
|
161
|
+
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
162
|
+
stroke: ${n};
|
|
163
|
+
fill: ${d};
|
|
164
|
+
}
|
|
165
|
+
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
166
|
+
stroke: ${r};
|
|
167
|
+
}
|
|
168
|
+
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
169
|
+
fill: ${p};
|
|
170
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
171
|
+
}
|
|
172
|
+
.pieCircle {
|
|
173
|
+
stroke: ${n};
|
|
174
|
+
stroke-width: 1.35px;
|
|
175
|
+
opacity: 0.96;
|
|
176
|
+
filter: drop-shadow(0 0 1.5px ${c});
|
|
177
|
+
}
|
|
178
|
+
.pieOuterCircle {
|
|
179
|
+
stroke: ${i};
|
|
180
|
+
opacity: 0.7;
|
|
181
|
+
}
|
|
182
|
+
.slice, .legend text, .pieTitleText {
|
|
183
|
+
fill: ${p};
|
|
184
|
+
paint-order: stroke;
|
|
185
|
+
stroke: ${o};
|
|
186
|
+
stroke-width: 3px;
|
|
187
|
+
stroke-linejoin: round;
|
|
188
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
189
|
+
}
|
|
190
|
+
.slice {
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
letter-spacing: 0.04em;
|
|
193
|
+
font-style: italic;
|
|
194
|
+
}
|
|
195
|
+
.pieTitleText {
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
letter-spacing: 0.12em;
|
|
198
|
+
font-style: italic;
|
|
199
|
+
}
|
|
200
|
+
.legend text {
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
letter-spacing: 0.03em;
|
|
203
|
+
}
|
|
204
|
+
.legend rect {
|
|
205
|
+
rx: 999px;
|
|
206
|
+
ry: 999px;
|
|
207
|
+
opacity: 0.9;
|
|
208
|
+
stroke: ${o};
|
|
209
|
+
stroke-width: 1.5px;
|
|
210
|
+
paint-order: stroke;
|
|
211
|
+
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
|
|
212
|
+
}
|
|
213
|
+
`}function uH(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")??"",_=tR(f);_&&p.setAttribute("href",_)}}function hH(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",`${zl(i)} ${zl(r)} ${zl(o)} ${zl(c)}`)}function dH(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),xH(e),e.dataset[d2]!=="true"&&(e.dataset[d2]="true",e.addEventListener("click",fH),e.addEventListener("keydown",pH))}function fH(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||ap(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),eR(t))}function pH(e){if(e.key!=="Enter"&&e.key!==" "||ap(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),eR(t))}function eR(e){const t=e.querySelector("svg");if(!t)return;zu(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++sH,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 _=document.createElement("div");_.className="diagram-lightbox__controls",_.setAttribute("aria-label","Diagram zoom controls");const g=Jd("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=Jd("+","Zoom in","in"),w=Jd("Fit","Fit diagram to viewport","fit"),x=Jd("Reset","Reset diagram zoom","reset");_.append(g,b,S,w,x);const k=document.createElement("div");k.className="diagram-lightbox__viewport";const A=_H(t),B=t.cloneNode(!0);B.removeAttribute("style"),yH(B,`diagram-lightbox-svg-${r}`),k.append(B),d.append(p,_,f),c.append(d,k),i.append(c),document.body.append(i);const z=new mH(k,B,b,A);g.addEventListener("click",()=>z.zoomOut()),S.addEventListener("click",()=>z.zoomIn()),w.addEventListener("click",()=>z.fit()),x.addEventListener("click",()=>z.reset());const E=bH(i),M=U=>{(U.target===i||U.target===f)&&zu(!0)},j=U=>{if(U.key==="Escape"){U.preventDefault(),zu(!0);return}z.handleKeyboard(U)||U.key==="Tab"&&wH(U,i)},H={dialog:i,trigger:e,inertStates:E,onClick:M,onKeyDown:j,cleanupPanZoom:()=>z.destroy()};n&&(H.onCancel=U=>{U.preventDefault(),zu(!0)},i.addEventListener("cancel",H.onCancel),i.showModal()),i.addEventListener("click",M),document.addEventListener("keydown",j,!0),lh=H,z.fit(),f.focus()}function Jd(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 mH{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Ms.indexOf(100);dragStart=null;pinchStart=null;pointers=new Map;destroy(){this.viewport.removeEventListener("pointerdown",this.onPointerDown),this.viewport.removeEventListener("pointermove",this.onPointerMove),this.viewport.removeEventListener("pointerup",this.onPointerEnd),this.viewport.removeEventListener("pointercancel",this.onPointerEnd),this.viewport.removeEventListener("wheel",this.onWheel),this.viewport.removeEventListener("dblclick",this.onDoubleClick),window.removeEventListener("resize",this.onResize),this.pointers.clear()}zoomIn(){this.zoomAroundViewportCenter(Math.min(this.zoomIndex+1,Ms.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Ms.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Ms.findIndex(d=>d>r),c=o===-1?Ms.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*(Qd(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Qd(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=Qd(this.zoomIndex),i=n/100;this.svg.setAttribute("width",zl(this.baseSize.width*i)),this.svg.setAttribute("height",zl(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||ap(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=Qd(this.pinchStart.zoomIndex)*i;this.applyZoom(vH(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Ms.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{ap(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Ms.indexOf(200)?Ms.indexOf(100):Ms.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function gH(e){const t=m2(e.getAttribute("width")),n=m2(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 _H(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:gH(e)}function m2(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 zl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function vH(e){let t=0,n=Number.POSITIVE_INFINITY;return Ms.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function Qd(e){return Ms[e]??Ms[0]}function yH(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 zu(e){const t=lh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),SH(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),lh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function bH(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 SH(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 wH(e,t){const n=Array.from(t.querySelectorAll(Zz)).filter(kH);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 xH(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function ap(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!CH(t)}function CH(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function kH(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function tR(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:tR(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 EH(e){const t=eH.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 _=q_(d,1),g=q_(p,.4),b=AH(f);if(_===null||g===null||b===null)return null;let S=1;if(i>=0){const w=q_(o,1);if(w===null)return null;S=w}return{L:_,C:g,h:b,alpha:S}}function TH(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,_=d**3,g=4.0767416621*p-3.3077115913*f+.2309699292*_,b=-1.2684380046*p+2.6097574011*f-.3413193965*_,S=-.0041960863*p-.7034186147*f+1.707614701*_,w=ef(G_(g)),x=ef(G_(b)),k=ef(G_(S));if(e.alpha<1){const A=ef(e.alpha);return`#${vo(w)}${vo(x)}${vo(k)}${vo(A)}`}return`#${vo(w)}${vo(x)}${vo(k)}`}function q_(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 AH(e){const t=tH.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function G_(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 ef(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function vo(e){return e.toString(16).padStart(2,"0")}const RH=[{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"}],LH=32;function NH({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=EA(e),[c,d]=y.useState(""),p=t.catalog?.clis.find(A=>A.cliId===t.cliId),f=p?.models.find(A=>A.id===t.model),_=t.entries.length>0,g=y.useRef(null),b=t.entries.at(-1),S=y.useRef(_).current,w=_&&!S;y.useLayoutEffect(()=>{const A=g.current;!A||!_||(A.scrollTop=A.scrollHeight)},[_,b?.text,t.entries.length,t.latestActivity,t.phase]),y.useEffect(()=>{const A=g.current;A&&Ip(A)},[]);const x=async A=>{const B=A.trim();!B||t.busy||(d(""),await i(B))},k=y.useCallback(A=>{const B=A.target.closest('[data-action="copy-code"]');if(!B)return;const z=B.closest("pre")?.getAttribute("data-code");z&&OH(B,z)},[]);return u.jsxs("section",{className:`session-analyst__chat-pane ${_?"has-interacted":"is-initial"}`,"aria-label":"Session Analyst chat","data-phase":t.phase,children:[u.jsx(DH,{state:t,onReset:()=>{o().then(()=>d("")).catch(()=>{})}}),u.jsxs("div",{className:"session-analyst__workspace",children:[u.jsxs("section",{ref:g,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[_?u.jsx("ol",{className:"session-analyst__transcript",onClick:k,children:t.entries.map((A,B)=>u.jsx("li",{className:`session-analyst__message session-analyst__message--${A.role}`,children:A.role==="analyst"?u.jsx(MH,{text:A.text,streaming:t.busy&&B===t.entries.length-1}):A.text},`${A.role}-${B}`))}):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:RH.map(A=>u.jsxs("button",{type:"button",onClick:()=>{x(A.text)},children:[u.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":A.tone,"aria-hidden":"true",children:A.icon}),A.text]},A.text))})]}),t.phase!=="idle"?u.jsx(jH,{state:t}):null]}),u.jsx("form",{className:`session-analyst__composer ${_?"is-docked":"is-initial"}${w?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:A=>{A.preventDefault(),x(c)},children:u.jsxs("div",{className:"session-analyst__composer-surface",children:[_?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:A=>n({type:"select-cli",cliId:A.target.value}),children:t.catalog?.clis.map(A=>u.jsx("option",{value:A.cliId,disabled:!A.available,children:A.label},A.cliId))})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis model",disabled:t.started||!f,value:t.model,onChange:A=>n({type:"select-model",model:A.target.value}),children:p?.models.map(A=>u.jsx("option",{value:A.id,children:A.label},A.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:A=>n({type:"select-effort",effort:A.target.value}),children:f?.effortLevels.length?f.effortLevels.map(A=>u.jsx("option",{value:A,children:A},A)):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:A=>d(A.target.value),onKeyDown:A=>{A.key!=="Enter"||A.shiftKey||A.nativeEvent.isComposing||(A.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"})})})]})})]})]})}const MH=y.memo(function({text:t,streaming:n}){const i=y.useRef(t),r=y.useRef(n?t:""),o=y.useRef(null),[c,d]=y.useState(()=>n?Bs(t).html:"");i.current=t;const p=y.useMemo(()=>n?null:Bs(t).html,[n,t]);return y.useEffect(()=>{if(!n){o.current!==null&&window.clearTimeout(o.current),o.current=null;return}r.current===t||o.current!==null||(o.current=window.setTimeout(()=>{o.current=null;const f=i.current;f!==r.current&&(r.current=f,d(Bs(f).html))},LH))},[n,t]),y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]),u.jsx("div",{className:"session-analyst__response markdown-body",dangerouslySetInnerHTML:{__html:p??c}})});function OH(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function DH({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"}),$H(e)]})]})}function jH({state:e}){const t=PH(e),n=zH(t),i=BH(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=IH(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 IH(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 BH(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 $H(e){return e.phase==="error"?"Needs attention":e.busy?"Analyzing":e.phase==="complete"?"Complete":e.phase==="stopped"?"Stopped":"Ready"}function PH(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 zH(e){return`${Math.floor(e/1e3)}s`}const HH=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class tr extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function nR(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new tr(t.status,"Invalid agent state response");return n.agentClis.map(i=>XH(i,t.status))}async function FH(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.clis))throw new tr(t.status,"Invalid Agent CLI state response");return n}async function UH(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new tr(t.status,"Invalid tenants response");return n.tenants.map(i=>ZH(i,t.status))}async function WH(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new tr(t.status,"Invalid jobs response");return n.tenants}async function qH(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new tr(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Bp(i,t.status))}async function GH(e){const t=await fetch("/api/v1/operations",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.operations))throw new tr(t.status,"Invalid operations response");return{operations:n.operations.map(i=>JH(i,t.status))}}async function KH(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 ea(i),Bp(await i.json(),i.status)}async function VH(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await ea(n),Bp(await n.json(),n.status)}async function YH(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ea(n)}function Bp(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||$y(n))throw new tr(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 ea(e){if(!e.ok)throw new tr(e.status,`Agent plugin request failed: ${e.status}`)}function XH(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new tr(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function ZH(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 tr(t,"Invalid tenant response");return n}function JH(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"||$y(n)||$y(n.payload))throw new tr(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 $y(e){return Py(e,new Set(HH))}function Py(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Py(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Py(i,t))}const QH="active",zy=new Set(["done","error","aborted"]);function eF(e,t){let n=sR(Hy(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=iR(n,i);return zy.has(t.status)&&!zy.has(n.status)&&(n={...n,status:t.status}),n}function iR(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:sF(e.recentEvents,t)};switch(t.type){case"job:registered":return nF(i,n);case"job:finalized":return{...i,status:Cn(n.status)??"done",finishedAt:Da(n.finishedAt)??t.at,summary:Cn(n.summary),error:Cn(n.error)};case"track:begin":return Tl(sR(i,n.request),n,t.id,r=>({...r,startedAt:Da(n.startedAt)??t.at,requestPreview:Cn(n.requestPreview)}));case"track:status":return Tl(i,n,t.id,r=>({...r,status:Cn(n.status)??r.status}));case"track:text":return Tl(i,n,t.id,r=>{const o=r.text+(Cn(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Da(n.textLength)??Cn(n.text)?.length??0),latestLine:rF(o)||r.latestLine}});case"track:thought":return Tl(i,n,t.id,r=>{const o=r.thought+(Cn(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Da(n.textLength)??Cn(n.text)?.length??0)}});case"track:tool":return Tl(i,n,t.id,r=>({...r,status:"stream",tools:iF(r.tools,n)}));case"track:finalized":return Tl(i,n,t.id,r=>{const o=g2(r.text,r.sentTextLength,Cn(n.fallbackText),Da(n.fallbackTextLength)),c=g2(r.thought,r.sentThoughtLength,Cn(n.fallbackThought),Da(n.fallbackThoughtLength));return{...r,status:Cn(n.status)??"done",finishedAt:Da(n.finishedAt)??t.at,error:Cn(n.error),text:o.text,sentTextLength:o.sentLength,thought:c.text,sentThoughtLength:c.sentLength}});default:return i}}function sR(e,t){if(e.request)return e;const n=tF(t);return n?{...e,request:n}:e}function tF(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 Hy(e,t,n){return{jobId:t,tenantId:e,status:QH,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Ql(e){return zy.has(e)}function nF(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??rR(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:Da(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function Tl(e,t,n,i){const r=Cn(t.trackId);if(!r)return e;const o=e.tracks[r],c={...i(o??rR(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:c}}}function rR(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function iF(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 g2(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 sF(e,t){return[...e,t].slice(-120)}function rF(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
214
|
+
`);return n[n.length-1]?.trim()??""}function Cn(e){return typeof e=="string"?e:void 0}function Da(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const aF=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function oF(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
|
|
215
|
+
|
|
216
|
+
`);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=cF(r);o&&n.push(o),i=e.indexOf(`
|
|
217
|
+
|
|
218
|
+
`)}return n}}function lF(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=v2(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=v2(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:uF(t.reason)}:null}const n=_2(t.event)??_2(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function cF(e){const t=e.split(`
|
|
219
|
+
`),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
220
|
+
`);return!i&&n==="message"?null:{event:n,data:i}}function _2(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 v2(e){try{return Bp(e,200)}catch{return null}}function uF(e){return typeof e=="string"&&aF.has(e)?e:void 0}const w0={droppedCount:0},Fy=new Set;let ln={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function hF(){return KE(dF,aR)}function aR(){return ln}function dF(e){return Fy.add(e),()=>{Fy.delete(e)}}function ps(e){ln={...ln,...e},vF()}function oR(e){ps({agentClis:e})}function fF(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 op(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 lR(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 cR(e){ps({activeTerminalSessionId:e})}function pF(e){ps({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...ln.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&ln.tenantJobs[t])]})}function mF(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=eF(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??w0}}ps({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...ln.tenantOrder.filter(n=>t[n])]})}function gF(e,t){const n=e.tenantId,i=e.jobId??yF(e),r=ln.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:w0},o=i?r.jobs[i]??Hy(n,i,e.at):Hy(n,"__unknown__",e.at),c=iR(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 _F(e,t,n){const i=ln.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:w0};ps({tenantJobs:{...ln.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function uR(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 vF(){for(const e of Fy)e()}function yF(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const y2=250,bF=5e3,Uy=new Map;function SF(e){const t=new AbortController;return wF(t.signal,e),()=>t.abort()}async function wF(e,t){let n=y2;for(;!e.aborted;){ps({connection:"connecting"});try{await EF(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=y2,await xF(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 AF(n,e),n=Math.min(n*2,bF)}}async function xF(e,t,n){const i=new TextDecoder,r=oF();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=lF(c);if(d){if(d.kind==="truncation"&&d.truncation){_F(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){op(d.session),lp(n,d.session.sessionId,x0(d.session));continue}if(d.kind==="attention"&&d.session){op(d.session),d.reason!=="idle_prompt"&&lp(n,d.session.sessionId,"awaiting");continue}d.event&&(gF(d.event,d.tenantLabel),kF(n,d.event.tenantId))}}}}function x0(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&CF(e)?"running":"idle"}function CF(e){return uR(e).some(t=>!Ql(t.status))}function lp(e,t,n){const i=Uy.get(t);e.status.set(t,n),Uy.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 kF(e,t){const{sessions:n}=aR();for(const i of Object.values(n))i.tenantId===t&&Uy.get(i.sessionId)!=="awaiting"&&lp(e,i.sessionId,x0(i))}async function EF(e,t){const[n,i,r,o,c]=await Promise.all([nR(e),qH(e),UH(e),WH(e),GH(e)]);oR(n),fF(i),pF(r),mF(o);for(const d of i)lp(t,d.sessionId,x0(d));TF(c.operations,t)}function TF(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function AF(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const RF=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function LF(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 NF(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function MF(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 hR(e){if(e)return RF.has(e)?e:void 0}function OF(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function $p(e){return e==="err"||e==="error"}function ch(e,t){return!Ql(e)&&OF(t)}function C0(e,t){return $p(e)?"error":e==="done"||e==="aborted"?e:Ql(t)?t:e}function DF(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 jF(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 IF(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 dR(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 BF(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})=>ch(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(ch(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function $F(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=dR(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class Pp extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function PF(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await k0(t),pR(await t.json(),t.status)}async function zF(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 k0(i),fR(await i.json(),i.status)}async function HF(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await k0(n),fR(await n.json(),n.status)}async function k0(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 Pp(e.status,t)}function fR(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Pp(t,"Invalid model auth mutation response");return{state:pR(n.state,t)}}function pR(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Pp(t,"Invalid model auth state response");return{providers:n.providers.map(i=>FF(i,t))}}function FF(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Pp(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const Wy=new Set;let qy={loading:!1,state:null,busyCli:null,error:null},Vr=0;function UF(){return y.useSyncExternalStore(WF,b2,b2)}function b2(){return qy}function WF(e){return Wy.add(e),()=>Wy.delete(e)}async function qF(e){const t=++Vr;Yr({loading:!0,error:null});try{const n=await PF(e);if(t!==Vr)return;Yr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Vr)return;Yr({loading:!1,error:E0(n)})}}async function GF(e,t){const n=++Vr;Yr({busyCli:e,error:null});try{const i=await zF(e,t);return n!==Vr||(Yr({state:i.state,busyCli:null,error:null}),await mR()),!0}catch(i){return n!==Vr||Yr({busyCli:null,error:E0(i)}),!1}}async function KF(e){const t=++Vr;Yr({busyCli:e,error:null});try{const n=await HF(e);return t!==Vr||(Yr({state:n.state,busyCli:null,error:null}),await mR()),!0}catch(n){return t!==Vr||Yr({busyCli:null,error:E0(n)}),!1}}async function mR(){try{oR(await nR())}catch{}}function Yr(e){qy={...qy,...e};for(const t of Wy)t()}function E0(e){return e instanceof Error?e.message:String(e)}class gR extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function VF(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await _R(t),vR(await t.json(),t.status)}async function YF(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await _R(n),vR(await n.json(),n.status)}async function _R(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new gR(e.status,t)}function vR(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new gR(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode}}const Gy=new Set;let cp={loading:!1,state:null,savingField:null,error:null},Tf=0;function yR(){return y.useSyncExternalStore(XF,S2,S2)}function S2(){return cp}function XF(e){return Gy.add(e),()=>{Gy.delete(e)}}async function bR(e){const t=++Tf;Kl({loading:!0,error:null});try{const n=await VF(e);if(t!==Tf)return;Kl({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Tf)return;Kl({loading:!1,error:wR(n)})}}async function SR(e,t){const n=cp.state;if(!n)return!1;Tf+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:{codexLaunchMode:i.codexLaunchMode};Kl({state:i,savingField:e,error:null});try{const o=await YF(r);return Kl({state:o,savingField:null,error:null}),!0}catch(o){return Kl({state:n,savingField:null,error:wR(o)}),!1}}function Kl(e){cp={...cp,...e};for(const t of Gy)t()}function wR(e){return e instanceof Error?e.message:String(e)}function ZF({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(JF,{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 JF({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 QF=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],eU="/plugins/terminal/agent/ticket",tU="/plugins/terminal/ws",K_="fleet-plugin.terminal.stream-dock-expanded",nU="fleet-plugin.terminal.stream-dock-collapsed",iU=56,sU=4e3,rU={...t$,step:1,defaultValue:14},aU="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",oU=5e3,xR={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Hu(e.payload,"cliLabel")??void 0,render:e=>u.jsx(pU,{context:e}),canOpenCompanions:({api:e,operation:t})=>CA(e,t.id),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>u.jsx(NH,{context:e})},{id:"session-analyst-artifacts",title:"Artifacts",hideCaption:!0,render:e=>u.jsx(uP,{context:e})}]},CR={id:"general",title:"General",render:()=>u.jsx(_U,{})},kR={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(vU,{})},ER={id:"agent.attention",title:"Agent input waiting"},lU={id:"agent.ended",title:"Agent turn ended"},tf={id:"terminal",operationKinds:[xR],settingsSections:[CR,kR],notificationKinds:[ER,lU],install:e=>cU(e),closeOperation:async e=>{try{await YH(e)}finally{aP(e),lR(e)}},launch:async({theaterId:e,kind:t})=>{const n=await KH(e,t.id);return op(n),cR(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?u.jsx(BU,{}):e.id==="claude"?u.jsx(jU,{}):e.id==="codex"?u.jsx(IU,{}):u.jsx(DU,{})};function cU(e){return SF({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function TR(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 _=p.scrollHeight-p.scrollTop-p.clientHeight;c(_<=iU)};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 uU(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 hU(){const[e,t]=y.useState(()=>{try{return localStorage.removeItem(nU),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 dU(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?"":LF((t??n)-e)}function fU(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 CA(e.api,e.operationId);o=!1,!r&&p&&i(!0)};c();const d=window.setInterval(()=>{c()},oU);return()=>{r=!0,window.clearInterval(d)}},[t,e.api,e.operationId,n]),t||n}function w2({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 pU({context:e}){const n=hF().sessions[e.operationId]??TU(e),[i,r]=y.useState(!1),[o,c]=y.useState("request"),[d,p]=y.useState([]),[f,_]=y.useState([]),g=y.useId(),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(new Set),k=fU(e),A=uR(n),B=A.filter($=>!Ql($.status)),z=$F(B,A,f),E=dR(A,d),M=`${i}:${o}`,j=E.map($=>`${$.jobId}:${$.lastEventId}`).join(","),H=TR(M,j);y.useLayoutEffect(()=>{const $=x.current,L=A.filter(P=>$.has(P.jobId)&&Ql(P.status)).map(P=>P.jobId);x.current=new Set(B.map(P=>P.jobId)),L.length!==0&&_(P=>jF(P,L,Date.now()+sU))},[B,A]),y.useEffect(()=>{if(f.length===0)return;const $=Math.min(...f.map(P=>P.expiresAt)),L=window.setTimeout(()=>{_(P=>IF(P,A,Date.now()))},Math.max(0,$-Date.now()));return()=>window.clearTimeout(L)},[A,f]),y.useEffect(()=>{i&&p($=>DF($,B.map(L=>L.jobId)))},[B,i]);const U=y.useCallback(()=>{r(!1),p([]),w.current?.focus()},[]),Q=y.useCallback(()=>{p(z.map($=>$.jobId)),c("request"),r(!0)},[z]),oe=y.useCallback($=>{c($)},[]),Y=y.useCallback($=>{const L=["request","activity"],P=L.indexOf(o);let D;if($.key==="ArrowLeft"&&(D=(P+L.length-1)%L.length),$.key==="ArrowRight"&&(D=(P+1)%L.length),$.key==="Home"&&(D=0),$.key==="End"&&(D=L.length-1),D===void 0)return;$.preventDefault();const T=L[D];c(T),document.getElementById(`${g}-${T}`)?.focus()},[o,g]);return y.useLayoutEffect(()=>{if(!i)return;const $=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame($)},[i]),y.useEffect(()=>{if(!i)return;const $=L=>{if(L.key==="Escape"){L.stopPropagation(),U();return}if(L.key==="Tab"){const P=S.current;if(!P)return;const D=uU(P),T=D[0],R=D[D.length-1];L.shiftKey&&document.activeElement===T?(L.preventDefault(),R?.focus()):!L.shiftKey&&document.activeElement===R&&(L.preventDefault(),T?.focus())}};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[i,U]),n.status==="dormant"?u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(w2,{context:e,ready:k}),u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{EU(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(w2,{context:e,ready:k}),u.jsx(h0,{operationId:n.sessionId,ticketPath:eU,wsPath:tU,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>lR(n.sessionId)}),z.length>0?u.jsx(mU,{activeJobs:z,onOpenDetail:Q,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:U}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:U,children:"×"}),u.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[u.jsx("button",{id:`${g}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${g}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>oe("request"),onKeyDown:Y,children:"Request"}),u.jsx("button",{id:`${g}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${g}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>oe("activity"),onKeyDown:Y,children:"Activity"})]}),u.jsx("div",{id:`${g}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${g}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:E.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):E.map($=>u.jsx(ZF,{job:$},$.jobId))}),u.jsx("div",{id:`${g}-activity-panel`,ref:o==="activity"?H.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${g}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:E.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):E.map($=>u.jsx(CU,{job:$},$.jobId))}),o==="activity"&&!H.pinned?u.jsx("button",{type:"button",className:"follow-button",onClick:H.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function mU({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=hU(),o=e[0],c=dU(o?.startedAt,o?.finishedAt),d=e.reduce((j,H)=>j+MF(H),0),p=NF(d),f=e.length===1&&o?hR(o.ownerCarrierId):void 0,_=e.length===1&&o?o.label:void 0,g=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",b=BF(e),S=e.map(j=>`${j.jobId}:${j.lastEventId}`).join(","),w=`${i}:${e.map(j=>j.jobId).join(",")}`,{containerRef:x,pinned:k,jumpToLatest:A}=TR(w,S),B=e.some(j=>j.trackOrder.some(H=>{const U=j.tracks[H];return U?ch(j.status,U.status):!1})),z=e.some(j=>!Ql(j.status)),E=e.some(j=>j.status==="error"||j.trackOrder.some(H=>$p(j.tracks[H]?.status??""))),M=z?"job-dock-dot":E?"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:M,"aria-hidden":"true"}),u.jsxs("span",{className:"job-dock-carrier",title:_,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:g})]}),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&&B&&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&&_?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:_})}):null,e.map(j=>{const H=e.length>1,U=!H&&j.trackOrder.length===1;return j.trackOrder.map(Q=>{const oe=j.tracks[Q];return oe?u.jsx(gU,{track:oe,job:j,multiJob:H,singleTrack:U},`${j.jobId}:${Q}`):null})})]}),k?null:u.jsx("button",{type:"button",className:"follow-button",onClick:A,children:"↓ Follow"})]})]})}function gU({track:e,job:t,multiJob:n,singleTrack:i}){const r=ch(t.status,e.status),c=RU(e.text),d=!c&&r&&!!e.thought,p=r?AU(e):void 0,f=C0(e.status,t.status),_=n||!i,g=n?hR(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[_?u.jsxs("span",{className:"job-dock-row-name",children:[g?u.jsx("span",{className:"job-dock-captain-dot","data-captain":g,"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":""}${$p(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 _U(){const{renderer:e,font:t}=SA();return u.jsxs(u.Fragment,{children:[u.jsx(SU,{}),u.jsx(LU,{terminalFont:t}),u.jsx(NU,{terminalRenderer:e})]})}function vU(){const[e,t]=y.useState([]),[n,i]=y.useState(null),r=yR();return y.useEffect(()=>{const o=new AbortController;return FH(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 bR(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(xU,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:c=>{SR("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(yU,{})]})}function yU(){const e=UF();return y.useEffect(()=>{const t=new AbortController;return qF(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(bU,{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 bU({provider:e,busy:t}){const[n,i]=y.useState(""),r=async()=>{await GF(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:()=>{KF(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 SU(){const e=yR(),t=e.state,n=e.savingField!==null;return y.useEffect(()=>{const i=new AbortController;return bR(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(wU,{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:()=>{SR("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 wU({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 xU({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 CU({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(kU,{track:n,jobStatus:e.status},n.trackId):null})})]})}function kU({track:e,jobStatus:t}){const n=OU(e.status,t),i=n==="track-card--live",r=C0(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 EU(e){op(await VH(e)),cR(e)}function TU(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Hu(e.operation.payload,"cliId")??void 0,cliLabel:Hu(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Hu(e.operation.payload,"tenantId")??void 0,registrationId:Hu(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Hu(e,t){const n=e[t];return typeof n=="string"?n:null}function AU(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 RU(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
221
|
+
`);return n[n.length-1]?.trim()??""}function LU({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??ql.id:ql.id}:{source:"system",familyName:e.customName};y.useEffect(()=>{const f=new AbortController;return r(!0),c(null),q5({signal:f.signal}).then(_=>{f.signal.aborted||n(_.fonts.filter(g=>g.monospace).map(g=>({family:g.family,monospace:g.monospace})))}).catch(_=>{f.signal.aborted||MU(_)||(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"){h$(f.familyName);return}const _=sh.find(g=>g.id===f.id);_&&u$(_.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(U5,{builtIns:sh.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:ql.family,previewText:aU,size:e.size,sizeRange:rU,loading:i,error:o,onSelectionChange:p,onSizeCommit:d$})}),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 NU({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:QF.map(t=>{const n=t.id===e;return u.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>c$(t.id),children:t.label},t.id)})})]})})}function MU(e){return e instanceof DOMException&&e.name==="AbortError"}function OU(e,t){if(ch(t,e))return"track-card--live";const n=C0(e,t);return $p(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function DU(){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 jU(){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 IU(){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"})})}function BU(){return u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}class vr extends Error{constructor(t,n){super(n),this.status=t}status}const $U=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function AR(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await A0(t),RR(await t.json(),t.status)}async function PU(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await A0(t),FU(await t.json(),t.status)}async function V_(e,t,n){return T0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function zU(e,t,n,i){return T0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function HU(e,t,n){return T0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function T0(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await A0(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new vr(r.status,"Invalid carrier settings mutation response");return{state:RR(o.state,r.status)}}async function A0(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 vr(e.status,t)}function RR(e,t){LR(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new vr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>UU(i,t))}}function FU(e,t){LR(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new vr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>WU(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function UU(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 vr(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=>GU(i,t))}}}function WU(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 vr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>qU(i,t)),defaultModel:n.defaultModel}}function qU(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new vr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new vr(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 GU(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 vr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function LR(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($U.has(r))throw new vr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const KU={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Ky=new Set;let yi={loading:!1,state:null,options:null,activeCarrierId:null,draft:KU,savingActionId:null,error:null};function NR(){return y.useSyncExternalStore(VU,x2,x2)}function x2(){return yi}function VU(e){return Ky.add(e),()=>{Ky.delete(e)}}async function Y_(e){pr({loading:!0,error:null});try{const[t,n]=await Promise.all([AR(e),PU(e)]);MR(t,n)}catch(t){if(e?.aborted)return;pr({loading:!1,error:DR(t)})}}function YU(e){const t=yi.state?.carriers.find(n=>n.carrierId===e);pr({activeCarrierId:e,draft:t?R0(t,yi.options):yi.draft,error:null})}function Hl(e){pr({draft:{...yi.draft,...e},error:null})}function Vy(e,t){const n=yi.draft.taskforce[e]??{model:"",effort:""};pr({draft:{...yi.draft,taskforce:{...yi.draft.taskforce,[e]:{...n,...t}}},error:null})}function XU(){const e=OR();e&&pr({draft:R0(e,yi.options),error:null})}async function ZU(e){const t=OR();return t?JU("save-all",async()=>{const n=yi.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:eW(n)})).state),i=await tW(t,e,i),{state:i??await AR()}}):!1}function MR(e,t){const n=nW(e,yi.activeCarrierId),i=e.carriers.find(r=>r.carrierId===n)??null;pr({loading:!1,state:e,options:t,activeCarrierId:n,draft:i?R0(i,t):yi.draft,error:null})}async function JU(e,t){pr({savingActionId:e,error:null});try{const n=await t();return MR(n.state,yi.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),pr({savingActionId:null}),!0}catch(n){return pr({savingActionId:null,error:DR(n)}),!1}}function R0(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??QU(i.id,r?.model??i.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:n}}function QU(e,t,n){return n?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function eW(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function OR(){return yi.state?.carriers.find(e=>e.carrierId===yi.activeCarrierId)??null}async function tW(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 HU(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 zU(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return n}function nW(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function pr(e){yi={...yi,...e};for(const t of Ky)t()}function DR(e){return e instanceof Error?e.message:String(e)}const iW=50,sW=2400,rW={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)"},aW={id:"carriers",title:"Carriers",render:()=>u.jsx(oW,{})};function oW(){const e=NR(),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"),_=e.savingActionId==="save-all",g=t?fW(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"),sW);return()=>window.clearTimeout(x)},[p]);function S(){t&&(XU(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),f("idle"))}async function w(){if(!t)return;if(f("saving"),!await ZU(mW(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(lW,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>YU(x.carrierId)},x.carrierId))]}),t&&e.options&&n?u.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:BR(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:iW,onChange:x=>Hl({displayName:x.target.value})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Save display name",disabled:_,onClick:()=>{o(!1)},children:u.jsx(_W,{})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Cancel display name edit",onClick:()=>{Hl({displayName:t.displayName}),o(!1)},children:u.jsx(vW,{})})]}):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:()=>{Hl({displayName:t.displayName}),o(!0)},children:u.jsx(gW,{})})]})}),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"||_?"Saving…":p==="saved"?"Saved ✓":""}),u.jsxs("div",{className:"terminal-carriers-save-actions",children:[u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${g?"is-dirty":""}`,disabled:!g||_,onClick:()=>{w()},children:"Save"}),u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${g?"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=>uW(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(jR,{id:"carrier-model",label:"Model",models:n.models,value:e.draft.model,onChange:x=>hW(n,x)}),u.jsx(IR,{id:"carrier-effort",model:i,value:e.draft.effort,onChange:x=>Hl({effort:x})})]})]})]}),t.taskForceCapable?u.jsx(cW,{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 lW({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:BR(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 jR({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 IR({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 cW({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,rows:r,onRowsChange:o}){const c=NR(),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(A=>!r.includes(A.id)),k=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(A=>!A),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(A=>{const B=t.find(j=>j.id===A);if(!B)return null;const z=c.draft.taskforce[B.id]??{model:B.defaultModel,effort:""},E=B.models.find(j=>j.modelId===z.model)??B.models[0]??null,M=e.taskforce.backends.some(j=>j.cliType===B.id);return u.jsxs("div",{className:`terminal-carriers-tf-item ${M?"is-active":""}`,children:[u.jsxs("div",{className:"terminal-carriers-tf-title",children:[u.jsx("span",{className:`terminal-carriers-live-dot ${M?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:B.displayName})]}),u.jsx(jR,{id:`tf-${B.id}-model`,label:"Model",models:B.models,value:z.model,onChange:j=>dW(B,j)}),u.jsx(IR,{id:`tf-${B.id}-effort`,model:E,value:z.effort,onChange:j=>Vy(B.id,{effort:j})}),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(j=>j!==B.id)),children:"Remove"})})]},B.id)}),u.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[_&&x.length>0?u.jsx("select",{className:"terminal-carriers-select terminal-carriers-tf-add-select",value:k,onChange:A=>S(A.target.value),"aria-label":"Task Force CLI to add",children:x.map(A=>u.jsx("option",{value:A.id,children:A.displayName},A.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 A=k,B=t.find(E=>E.id===A),z=B?.models.find(E=>E.modelId===B.defaultModel)??B?.models[0]??null;!B||!z||(Vy(B.id,{model:z.modelId,effort:z.effort?.default??""}),o(r.includes(B.id)?r:[...r,B.id]),S(""),g(!1))},children:"Add"})]})]}):null]})}function uW(e,t){const n=t.find(r=>r.id===e),i=n?.models.find(r=>r.modelId===n.defaultModel)??n?.models[0]??null;Hl({cliType:e,model:i?.modelId??"",effort:i?.effort?.default??""})}function hW(e,t){const n=e.models.find(i=>i.modelId===t);Hl({model:t,effort:n?.effort?.default??""})}function dW(e,t){const n=e.models.find(i=>i.modelId===t);Vy(e.id,{model:t,effort:n?.effort?.default??""})}function fW(e,t,n){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:pW(e,n,t.taskforce)}function pW(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 mW(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 BR(e){return{"--cap-color":rW[e]??"var(--brass)"}}function gW(){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 _W(){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 vW(){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 yW="global-shell:theater:",bW="/plugins/terminal/global/ticket",SW="/plugins/terminal/ws",wW=168,xW={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},CW={id:"global-shell",title:"Shell",icon:kW,preferredExtraWidth:wW,render:e=>u.jsx("div",{style:xW,children:u.jsx(h0,{operationId:`${yW}${encodeURIComponent(e.theaterId??"")}`,ticketPath:bW,wsPath:SW,theme:"instrument",active:!0})})};function kW(){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 EW="/plugins/terminal/shell/ticket",TW="/plugins/terminal/ws",$R={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>y.createElement(AW,{context:e})},X_={id:"terminal",operationKinds:[$R],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(RW,{})};function AW({context:e}){return u.jsx(h0,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:EW,wsPath:TW,theme:e.theme,onExit:e.onClose})}function RW(){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 LW=new Set(["agent"]),NW={id:"terminal",operationKinds:[$R,xR],settingsSections:[CR,kR,aW],notificationKinds:[ER],railPanels:[CW],install:e=>(wA(),l$(e.settings),tf.install?.(e)),closeOperation:async e=>{const t=await OW(e);if(t?.type==="shell"){await X_.closeOperation?.(e);return}t&&LW.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)},MW=[NW];async function OW(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 ee={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"},DW={src:ee.ts,lib:ee.ts,app:ee.ts,test:ee.shell,tests:ee.shell,__tests__:ee.shell,spec:ee.shell,specs:ee.shell,node_modules:ee.binary,vendor:ee.binary,dist:ee.config,build:ee.config,out:ee.config,target:ee.config,docs:ee.md,doc:ee.md,public:ee.data,assets:ee.data,static:ee.data,components:ee.image,scripts:ee.js,styles:ee.css,".git":ee.html,".github":ee.config,".vscode":ee.css},C2={ts:{shape:"angle",tone:ee.ts},tsx:{shape:"angle",tone:ee.ts},mts:{shape:"angle",tone:ee.ts},cts:{shape:"angle",tone:ee.ts},"d.ts":{shape:"angle",tone:ee.ts},js:{shape:"angle",tone:ee.js},jsx:{shape:"angle",tone:ee.js},mjs:{shape:"angle",tone:ee.js},cjs:{shape:"angle",tone:ee.js},json:{shape:"braces",tone:ee.json},jsonc:{shape:"braces",tone:ee.json},json5:{shape:"braces",tone:ee.json},jsonl:{shape:"braces",tone:ee.json},graphql:{shape:"braces",tone:ee.image},gql:{shape:"braces",tone:ee.image},proto:{shape:"braces",tone:ee.go},css:{shape:"hash",tone:ee.css},scss:{shape:"hash",tone:ee.css},sass:{shape:"hash",tone:ee.css},less:{shape:"hash",tone:ee.css},styl:{shape:"hash",tone:ee.css},html:{shape:"markup",tone:ee.html},htm:{shape:"markup",tone:ee.html},xml:{shape:"markup",tone:ee.html},xhtml:{shape:"markup",tone:ee.html},vue:{shape:"markup",tone:ee.shell},svelte:{shape:"markup",tone:ee.rust},astro:{shape:"markup",tone:ee.image},md:{shape:"doc",tone:ee.md},mdx:{shape:"doc",tone:ee.md},markdown:{shape:"doc",tone:ee.md},rst:{shape:"doc",tone:ee.md},txt:{shape:"doc",tone:ee.default},text:{shape:"doc",tone:ee.default},log:{shape:"doc",tone:ee.default},adoc:{shape:"doc",tone:ee.md},pdf:{shape:"doc",tone:ee.ruby},py:{shape:"angle",tone:ee.py},pyi:{shape:"angle",tone:ee.py},pyw:{shape:"angle",tone:ee.py},go:{shape:"angle",tone:ee.go},rs:{shape:"angle",tone:ee.rust},rb:{shape:"angle",tone:ee.ruby},rake:{shape:"angle",tone:ee.ruby},gemspec:{shape:"angle",tone:ee.ruby},java:{shape:"angle",tone:ee.html},kt:{shape:"angle",tone:ee.config},kts:{shape:"angle",tone:ee.config},scala:{shape:"angle",tone:ee.ruby},c:{shape:"angle",tone:ee.ts},h:{shape:"angle",tone:ee.ts},cpp:{shape:"angle",tone:ee.css},cc:{shape:"angle",tone:ee.css},cxx:{shape:"angle",tone:ee.css},hpp:{shape:"angle",tone:ee.css},cs:{shape:"angle",tone:ee.config},php:{shape:"angle",tone:ee.config},swift:{shape:"angle",tone:ee.html},lua:{shape:"angle",tone:ee.ts},dart:{shape:"angle",tone:ee.go},sh:{shape:"terminal",tone:ee.shell},bash:{shape:"terminal",tone:ee.shell},zsh:{shape:"terminal",tone:ee.shell},fish:{shape:"terminal",tone:ee.shell},ps1:{shape:"terminal",tone:ee.css},bat:{shape:"terminal",tone:ee.shell},cmd:{shape:"terminal",tone:ee.shell},yaml:{shape:"gear",tone:ee.config},yml:{shape:"gear",tone:ee.config},toml:{shape:"gear",tone:ee.config},ini:{shape:"gear",tone:ee.config},conf:{shape:"gear",tone:ee.config},cfg:{shape:"gear",tone:ee.config},properties:{shape:"gear",tone:ee.config},env:{shape:"gear",tone:ee.config},editorconfig:{shape:"gear",tone:ee.config},png:{shape:"image",tone:ee.image},jpg:{shape:"image",tone:ee.image},jpeg:{shape:"image",tone:ee.image},gif:{shape:"image",tone:ee.image},webp:{shape:"image",tone:ee.image},svg:{shape:"image",tone:ee.image},ico:{shape:"image",tone:ee.image},bmp:{shape:"image",tone:ee.image},avif:{shape:"image",tone:ee.image},tiff:{shape:"image",tone:ee.image},heic:{shape:"image",tone:ee.image},mp4:{shape:"image",tone:ee.data},mov:{shape:"image",tone:ee.data},webm:{shape:"image",tone:ee.data},mkv:{shape:"image",tone:ee.data},mp3:{shape:"chip",tone:ee.shell},wav:{shape:"chip",tone:ee.shell},flac:{shape:"chip",tone:ee.shell},ogg:{shape:"chip",tone:ee.shell},sql:{shape:"database",tone:ee.data},csv:{shape:"database",tone:ee.data},tsv:{shape:"database",tone:ee.data},db:{shape:"database",tone:ee.data},sqlite:{shape:"database",tone:ee.data},sqlite3:{shape:"database",tone:ee.data},parquet:{shape:"database",tone:ee.data},zip:{shape:"archive",tone:ee.archive},tar:{shape:"archive",tone:ee.archive},gz:{shape:"archive",tone:ee.archive},tgz:{shape:"archive",tone:ee.archive},bz2:{shape:"archive",tone:ee.archive},xz:{shape:"archive",tone:ee.archive},rar:{shape:"archive",tone:ee.archive},"7z":{shape:"archive",tone:ee.archive},zst:{shape:"archive",tone:ee.archive},bin:{shape:"chip",tone:ee.binary},exe:{shape:"chip",tone:ee.binary},dll:{shape:"chip",tone:ee.binary},so:{shape:"chip",tone:ee.binary},dylib:{shape:"chip",tone:ee.binary},wasm:{shape:"chip",tone:ee.config},class:{shape:"chip",tone:ee.binary},lock:{shape:"chip",tone:ee.binary},woff:{shape:"chip",tone:ee.config},woff2:{shape:"chip",tone:ee.config},ttf:{shape:"chip",tone:ee.config},otf:{shape:"chip",tone:ee.config}},jW={dockerfile:{shape:"chip",tone:ee.css},"docker-compose.yml":{shape:"gear",tone:ee.css},"docker-compose.yaml":{shape:"gear",tone:ee.css},makefile:{shape:"gear",tone:ee.html},"cmakelists.txt":{shape:"gear",tone:ee.html},".gitignore":{shape:"gear",tone:ee.html},".gitattributes":{shape:"gear",tone:ee.html},".dockerignore":{shape:"gear",tone:ee.html},".npmignore":{shape:"gear",tone:ee.html},".npmrc":{shape:"gear",tone:ee.ruby},"package.json":{shape:"braces",tone:ee.shell},"tsconfig.json":{shape:"braces",tone:ee.ts},license:{shape:"doc",tone:ee.json},"license.md":{shape:"doc",tone:ee.json},licence:{shape:"doc",tone:ee.json}},IW={shape:"default",tone:ee.default},Yy={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 BW({name:e}){const t=PW(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:Yy[t.shape]})}function $W({name:e,open:t}){const n=DW[e.toLowerCase()]??ee.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?Yy.folderOpen:Yy.folderClosed})}function PW(e){const t=e.toLowerCase(),n=jW[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:ee.config};if(t.startsWith("readme"))return{shape:"doc",tone:ee.md};if(t.endsWith(".d.ts"))return C2["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=C2[r];if(o)return o}return IW}const zW=200,nf=30,k2=5,PR="fleet-console.fileExplorer.showHidden",E2=500;function qs(e,t){return e===t}async function HW({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 _=0;const g=b=>{for(const S of b)if(!(!UW(S,i)||p.has(S.relativePath))){if(p.size>=E2)return;p.add(S.relativePath),c.push(S)}};for(g(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),g(S.entries);continue}if(_>=E2)return;_+=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),g(w.entries)}catch{}}}function zR(e,t,n,i,r,o,c,d,p=new Set){const f=[];for(const _ of e){if(!d&&_.name.startsWith("."))continue;const g=o.get(_.relativePath),b=g?.entries,S=g?.relativePath??_.relativePath,w=_.kind==="dir"&&p.has(S),x=_.kind==="dir"&&!w&&HR(b??[],o,c,d);if(c&&!_.name.toLowerCase().includes(c)&&!x)continue;const k=i.has(_.relativePath)||!!(c&&x);if(f.push({entry:_,depth:t,isSelected:n===_.relativePath,isExpanded:k,isLoading:r.has(_.relativePath)}),_.kind==="dir"&&k&&!w&&b){const A=new Set(p);A.add(S),f.push(...zR(b,t+1,n,i,r,o,c,d,A))}}return f}function FW({contextKey:e,files:t,theaterId:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(null),[d,p]=y.useState(null),[f,_]=y.useState(""),[g,b]=y.useState(new Set),[S,w]=y.useState(new Set),[x,k]=y.useState(new Map),[A,B]=y.useState(""),[z,E]=y.useState(0),[M,j]=y.useState(600),[H,U]=y.useState(()=>WW()),Q=y.useRef(null),oe=y.useRef(g);oe.current=g;const Y=y.useRef(f);Y.current=f;const $=y.useRef(t);$.current=t;const L=y.useRef(e);L.current=e;const P=y.useRef(x);P.current=x;const D=y.useRef(0),T=!!A;y.useEffect(()=>{n&&(c(null),p(null),_(""),b(new Set),k(new Map),B(""),E(0))},[e,n]),y.useEffect(()=>{if(!n)return;const xe=e;t.listFolder(f||void 0).then(Se=>{qs(xe,L.current)&&(c(Se),p(null))}).catch(Se=>{qs(xe,L.current)&&p(Se instanceof Error?Se.message:"Unable to load folder")})},[e,n,f,t]),y.useEffect(()=>{const xe=++D.current;if(!T||!o)return;let Se=!0;const Ee=e,Ke=()=>Se&&xe===D.current&&qs(Ee,L.current);return HW({entries:o.entries,cachedResults:P.current,files:t,showHidden:H,isCurrent:Ke,onFolderResult:(de,Ge)=>{Ke()&&k(Le=>new Map(Le).set(de,Ge))}}),()=>{Se=!1}},[e,t,T,o,H]),y.useEffect(()=>{const xe=Q.current;if(!xe)return;const Se=new ResizeObserver(()=>j(xe.clientHeight));return Se.observe(xe),j(xe.clientHeight),()=>Se.disconnect()},[]),y.useEffect(()=>{if(!n)return;let xe=!0;const Se=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,Ee=new EventSource(Se),Ke=()=>{const Ge=e;$.current.listFolder(Y.current||void 0).then(Le=>{qs(Ge,L.current)&&(c(Le),p(null))}).catch(()=>{})},de=()=>{Ke();for(const Ge of oe.current){const Le=e;$.current.listFolder(Ge).then(et=>{qs(Le,L.current)&&k(Bt=>new Map(Bt).set(Ge,et))}).catch(()=>{})}};return Ee.addEventListener("change",Ge=>{let Le;try{Le=JSON.parse(Ge.data)}catch{return}if(typeof Le=="string"&&((Le===""||Le===Y.current)&&Ke(),Le!==""&&oe.current.has(Le))){const et=e;$.current.listFolder(Le).then(Bt=>{qs(et,L.current)&&k(Tt=>new Map(Tt).set(Le,Bt))}).catch(()=>{})}}),Ee.onopen=()=>{if(xe){xe=!1;return}de()},()=>{Ee.close()}},[e,n,t]);const R=y.useCallback(xe=>{const Se=xe.relativePath,Ee=!g.has(Se);if(b(Ke=>{const de=new Set(Ke);return de.has(Se)?(de.delete(Se),de):(de.add(Se),de)}),Ee){const Ke=e;w(de=>new Set(de).add(Se)),t.listFolder(Se).then(de=>{qs(Ke,L.current)&&(k(Ge=>new Map(Ge).set(Se,de)),w(Ge=>{const Le=new Set(Ge);return Le.delete(Se),Le}))}).catch(()=>{qs(Ke,L.current)&&w(de=>{const Ge=new Set(de);return Ge.delete(Se),Ge})})}},[e,t,g]),N=y.useCallback(xe=>{xe.kind==="dir"?R(xe):r(xe)},[R,r]),F=y.useCallback(xe=>{E(xe.currentTarget.scrollTop)},[]),W=y.useCallback(()=>{U(xe=>{const Se=!xe;try{localStorage.setItem(PR,Se?"1":"0")}catch{}return Se})},[]),O=y.useCallback(()=>{if(!n)return;const xe=e;t.listFolder(f||void 0).then(Se=>{qs(xe,L.current)&&(c(Se),p(null))}).catch(Se=>{qs(xe,L.current)&&p(Se instanceof Error?Se.message:"Unable to load folder")});for(const Se of g)t.listFolder(Se).then(Ee=>{qs(xe,L.current)&&k(Ke=>new Map(Ke).set(Se,Ee))}).catch(()=>{})},[e,t,f,g,n]),V=A.toLowerCase(),J=y.useMemo(()=>o?zR(o.entries,0,i,g,S,x,V,H):[],[o,i,g,S,x,V,H]),he=!H&&o!==null&&o.entries.length>0&&J.length===0&&!A,fe=J.length>zW,le=fe?Math.max(0,Math.floor(z/nf)-k2):0,Te=fe?Math.min(J.length,Math.ceil((z+M)/nf)+k2):J.length,Re=J.slice(le,Te),$e=J.length*nf,dt=le*nf;return n?d&&!o?u.jsx("div",{className:"fexp-tree-error",children:d}):o?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:A,onChange:xe=>B(xe.target.value),"aria-label":"Filter files"}),A&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>B(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:O,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${H?" is-active":""}`,onClick:W,"aria-pressed":H,"aria-label":H?"Hide hidden files":"Show hidden files",title:H?"Hide hidden files":"Show hidden files",children:H?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:Q,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:fe?F:void 0,children:[!1,fe?u.jsx("div",{style:{height:$e,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${dt}px)`},children:Re.map(xe=>u.jsx(T2,{row:xe,onEntryClick:N},xe.entry.relativePath))})}):Re.map(xe=>u.jsx(T2,{row:xe,onEntryClick:N},xe.entry.relativePath)),J.length===0&&A&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),J.length===0&&!A&&o.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),he&&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 HR(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),HR(c.entries,t,n,i,d))return!0}}}return!1}function UW(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function T2({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($W,{name:n.name,open:o}):u.jsx(BW,{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 WW(){try{return localStorage.getItem(PR)==="1"}catch{return!1}}function qW({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 GW(e,t){switch(t){case"typescript":case"javascript":return VW(e);case"json":return YW(e);case"python":return ZW(e);case"css":case"scss":case"sass":case"less":return JW(e);case"html":case"xml":return QW(e);case"bash":case"shell":return eq(e);case"yaml":return tq(e);default:return[{kind:"text",value:e}]}}const KW=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 VW(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
222
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=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*\(/);KW.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 YW(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 XW=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 ZW(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
223
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=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*\(/);XW.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 JW(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
224
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=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 QW(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 eq(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
|
|
225
|
+
`,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=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 tq(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
226
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=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]===`
|
|
227
|
+
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function nq({content:e,lang:t,truncated:n}){const i=y.useMemo(()=>iq(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 iq(e,t){return e.split(`
|
|
228
|
+
`).map(i=>sq(i,t))}function sq(e,t){return t==="plaintext"||t==="markdown"?A2(e)||" ":GW(e,t).map(i=>{const r=A2(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function A2(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function rq({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})]})}const aq=new Set([".png",".jpg",".jpeg",".webp",".gif"]),oq=new Set(["img.shields.io"]),lq=/^[a-z][a-z0-9+.-]*:/i;function R2(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||lq.test(n))return null;const i=FR(n);if(!i)return null;const r=hq(i);return r===null?null:dq(r,t)}function cq(e){const t=FR(e).toLowerCase();return[...aq].some(n=>t.endsWith(n))}function L2(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function uq(e){try{const t=new URL(e);return t.protocol==="https:"&&oq.has(t.hostname)}catch{return!1}}function FR(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function hq(e){try{return decodeURI(e)}catch{return null}}function dq(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 fq({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:r}){const o=y.useMemo(()=>{const g=Bs(e).html,b=new DOMParser().parseFromString(g,"text/html");return Z_(b.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i}),b.body.innerHTML},[e,n,i]),c=y.useRef(null);y.useEffect(()=>{const g=c.current;if(!g)return;Ip(g),Z_(g,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i});const b=new MutationObserver(()=>Z_(g,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i}));return b.observe(g,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>b.disconnect()},[o,n,i]);const d=y.useCallback(g=>{const b=g.target.closest('[data-action="copy-code"]');if(!b)return;const S=b.closest("pre")?.getAttribute("data-code");if(!S)return;navigator.clipboard?.writeText(S);const w=b.textContent;b.textContent="Copied",window.setTimeout(()=>{b.textContent=w},1200)},[]),p=y.useCallback(g=>{const S=g.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(g.preventDefault(),t(w))},[t]),f=y.useCallback(g=>{if(g.key!=="Enter"&&g.key!==" ")return;const S=g.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(g.preventDefault(),t(w))},[t]),_=y.useCallback(g=>{d(g),p(g)},[d,p]);return u.jsxs("div",{className:"fexp-md-wrap",children:[r&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:c,className:"markdown-body",onClick:_,onKeyDown:f,dangerouslySetInnerHTML:{__html:o}})]})}function Z_(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=R2(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===L2(t.theaterId,r)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&uq(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=R2(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&cq(o)){n.setAttribute("src",L2(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&pq(n)}}function pq(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 mq=360,L0=248,N0=200,up=160,hp=4;function gq(e){return e-N0-hp>=up}function _q(e,t,n){const i=n-N0-hp;return i<up?e:Math.max(up,Math.min(i,e-t))}function vq(e){const t=N0+hp;return`minmax(0, 1fr) ${hp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function yq(e){return e?mq:null}const UR="fleet-console.file-explorer.treePaneWidth",M0={selectedPath:null,viewState:{kind:"none"}},bq={...M0,treePaneWidth:L0},WR=new Map,N2=new Map,Xy=new Set;let dp=kq();function Sq(e){return y.useSyncExternalStore(Cq,()=>xq(e),()=>bq)}function M2(e,t){e&&KR(e,{selectedPath:t})}function La(e,t){e&&KR(e,{viewState:t})}function wq(e){dp=VR(e);try{localStorage.setItem(UR,String(dp))}catch{}qR()}function qR(){for(const e of Xy)e()}function GR(e){return WR.get(e)??M0}function xq(e){const t=e??"__none__",n=e!=null?GR(e):M0,i=N2.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===dp)return i;const r={...n,treePaneWidth:dp};return N2.set(t,r),r}function KR(e,t){WR.set(e,{...GR(e),...t}),qR()}function Cq(e){return Xy.add(e),()=>{Xy.delete(e)}}function kq(){try{return VR(Number(localStorage.getItem(UR)))}catch{return L0}}function VR(e){return!Number.isFinite(e)||e<=0?L0:Math.max(up,Math.round(e))}const Eq=new Set([".png",".jpg",".jpeg",".webp",".gif"]),Tq={id:"file-explorer",title:"Files",icon:Lq,render:e=>u.jsx(Rq,{...e})};function Aq(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const n=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!n.ok){const i=await n.json();throw new Error(i.error??"list_failed")}return n.json()}}}function Rq(e){const{theaterId:t}=e,n=t??"",{selectedPath:i,viewState:r,treePaneWidth:o}=Sq(n),c=y.useRef(o);c.current=o;const d=y.useRef(null),[p,f]=y.useState(!1),_=y.useMemo(()=>Aq(t),[t]),g=y.useCallback(async(k,A)=>{if(!t){La(t,{kind:"error",message:"no_theater"});return}M2(n,k);const B=A??k.split("/").filter(Boolean).at(-1)??k,z=B.slice(B.lastIndexOf(".")).toLowerCase();if(Eq.has(z)){const E=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(k)}`:"";La(n,{kind:"image",relativePath:k,name:B,src:E});return}La(n,{kind:"loading"});try{const E=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:k})});if(!E.ok){const j=await E.json();throw new Error(j.error??"read_failed")}const M=await E.json();if(M.binary){La(n,{kind:"binary",name:B});return}La(n,{kind:"code",relativePath:M.relativePath,content:M.content,lang:M.lang,truncated:M.truncated})}catch(E){const M=E instanceof Error?E.message:"Unable to load file";M==="binary_file"?La(n,{kind:"binary",name:B}):La(n,{kind:"error",message:M})}},[n,t]),b=y.useCallback(async k=>{k.kind==="file"&&await g(k.relativePath,k.name)},[g]),S=y.useCallback(()=>{La(n,{kind:"none"}),M2(n,null)},[n]),w=y.useCallback(k=>{k.preventDefault();const A=d.current;if(!A)return;const B=A.getBoundingClientRect().width;if(!gq(B))return;const z=k.clientX,E=c.current;f(!0);const M=H=>{const U=H.clientX-z,Q=_q(E,U,B);c.current=Q,wq(Q)},j=()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",j),f(!1)};document.addEventListener("pointermove",M),document.addEventListener("pointerup",j)},[]),x=r.kind!=="none";return y.useLayoutEffect(()=>{e.requestExtraWidth?.(yq(x))},[e,x]),u.jsxs("div",{ref:d,className:`fexp-root${x?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:x?{gridTemplateColumns:vq(o)}:void 0,children:[x&&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:r.kind!=="loading"&&r.kind!=="error"?"relativePath"in r?r.relativePath:r.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[r.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),r.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:r.message}),r.kind==="code"&&r.lang==="markdown"&&u.jsx(fq,{content:r.content,onOpenPath:g,relativePath:r.relativePath,theaterId:t,truncated:r.truncated}),r.kind==="code"&&r.lang!=="markdown"&&u.jsx(nq,{content:r.content,lang:r.lang,truncated:r.truncated}),r.kind==="image"&&u.jsx(rq,{src:r.src,name:r.name}),r.kind==="binary"&&u.jsx(qW,{name:r.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(FW,{files:_,theaterId:t,contextKey:n,selectedPath:i,onSelect:b},n)})]})}function Lq(){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 Nq={id:"file-explorer",railPanels:[Tq]},Mq=[Nq],Oq={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function Dq(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 YR({files:e,selectedPath:t,onSelect:n}){const i=Dq(e);return u.jsx(XR,{node:i,depth:0,selectedPath:t,onSelect:n})}function XR({node:e,depth:t,selectedPath:n,onSelect:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>u.jsx(jq,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>u.jsx(Iq,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function jq({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(!1),d=y.useCallback(()=>c(g=>!g),[]);let p=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const g=Object.keys(f.dirs)[0];p+="/"+g,f=f.dirs[g]}const _=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:`${_}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(XR,{node:f,depth:n+1,selectedPath:i,onSelect:r})]})}function Iq({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:Oq[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 O2="fleet-console.diff.changesCollapsed",Bq={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function $q(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function Pq(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function zq({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[c,d]=y.useState(()=>Pq(O2)),p=y.useCallback(()=>{d(g=>{const b=!g;try{localStorage.setItem(O2,b?"1":"0")}catch{}return b})},[]),f=y.useMemo(()=>e.kind==="ok"?$q(e.files,o):[],[o,e]);if(e.kind==="loading")return u.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const g=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:g}),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 _=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:_})]}),!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(YR,{files:f,selectedPath:i,onSelect:r}):f.map(g=>u.jsx(ZR,{entry:g,isSelected:g.path===i,onSelect:r},g.path))})]})})}function ZR({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":Bq[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]})]})]})}const Zy=new Set;let O0={file:null};function JR(){for(const e of Zy)e()}function Hq(e){return Zy.add(e),()=>{Zy.delete(e)}}function D2(){return O0}function Fq(e){const t=y.useSyncExternalStore(Hq,D2,D2);return!t.file||t.file.theaterId!==e?null:t.file}function Uq(e,t){O0={file:{entry:e,theaterId:t}},JR()}function j2(){O0={file:null},JR()}const Wq=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 qq(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+=Wq.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 Gq=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,Kq=/^diff --git a\/(.+) b\/(.+)$/;function Vq(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=Kq.exec(c),p=d?.[1],f=d?.[2]??c,_=p!==void 0&&p!==f?p:void 0;n.push({kind:"file-label",text:f,oldPath:_}),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=Gq.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 sf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function QR({ctx:e,file:t,mode:n,commit:i}){const[r,o]=y.useState({kind:"loading"});if(y.useEffect(()=>{if(!e.theaterId){o({kind:"error",message:"no_theater"});return}let f=!1;return o({kind:"loading"}),i?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:i.theaterId,ref:i.fullHash,filePath:t.path,...t.oldPath??i.oldPath?{oldPath:t.oldPath??i.oldPath}:{}})}).then(async _=>{if(!_.ok)throw new Error((await _.json()).error??"git_failed");const g=await _.json();f||o({kind:"ok",result:g})}).catch(_=>{f||o({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})}).then(async _=>{if(!_.ok)throw new Error((await _.json()).error??"git_failed");const g=await _.json();f||o({kind:"ok",result:g})}).catch(_=>{f||o({kind:"error",message:_ instanceof Error?_.message:"unknown"})}),()=>{f=!0}},[e.api,e.theaterId,t.oldPath,t.path,n,i]),r.kind==="loading")return u.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(r.kind==="error")return u.jsx("div",{className:"repository-hunk-error",children:r.message});const{result:c}=r,p=Vq(c.content).filter(f=>f.kind!=="file-label");return u.jsxs("div",{className:"repository-hunk-wrap",children:[c.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:p.map((f,_)=>u.jsx("tr",{className:`repository-line repository-line-${f.kind}`,children:f.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:sf(f.text)}}):f.kind==="meta"?u.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:sf(f.text)}}):f.kind==="file-label"?u.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:sf(f.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"repository-gutter repository-gutter-old",children:f.oldLine??""}),u.jsx("td",{className:"repository-gutter repository-gutter-new",children:f.newLine??""}),u.jsx("td",{className:"repository-marker",children:f.kind==="add"?"+":f.kind==="del"?"−":""}),u.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:qq(sf(f.text.length>0?f.text.slice(1):f.text))}})]})},_))})})})]})}const Jy=12,Al=28,J_=3,Yq=5,I2=["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 Eu(e){return e*Jy+6}function yo(e){return I2[e%I2.length]??"var(--ink-fog)"}function Xq({node:e,laneCount:t,collapsed:n=!1}){const i=Math.max(t,1),r=n?10:0,o=i*Jy+r,c=Eu(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:Eu(p),y1:0,x2:Eu(p),y2:Al,stroke:yo(p),strokeWidth:1.5},`pt-${p}`)),e.connectAbove&&u.jsx("line",{x1:c,y1:0,x2:c,y2:d-J_,stroke:yo(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:c,y1:d+J_,x2:c,y2:Al,stroke:yo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(p=>u.jsx("line",{x1:Eu(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:Eu(p),y2:Al,stroke:yo(p),strokeWidth:1.5,strokeLinecap:"round"},`bt-${p}`)),e.isHead&&u.jsx("circle",{cx:c,cy:d,r:Yq,fill:"none",stroke:yo(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:c,cy:d,r:J_,fill:yo(e.lane)}),n&&u.jsx("text",{x:i*Jy+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const Q_=8;function Zq(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?_=x:t.length<Q_?(_=t.length,t.push(null)):(i=!0,_=Q_-1,t[_]=null,g=!0)}else{_=Math.min(...f);for(const x of f)x!==_&&(b.push(x),t[x]=null)}const S=[];if(p.length===0)t[_]=null;else{t[_]=g?null:p[0]??null;for(const x of p.slice(1))if(!(t.indexOf(x)>=0)){const A=t.indexOf(null);if(A>=0)t[A]=x,S.push(A);else if(t.length<Q_){const B=t.length;t.push(x),S.push(B)}else i=!0}}const w=t.map((x,k)=>({h:x,i:k})).filter(({h:x,i:k})=>x!==null&&k!==_).map(({i:x})=>x);r=Math.max(r,_,...S,...w),n.push({lane:_,isHead:c.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[_]===p[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function eL(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 D0(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 tL=140,nL=120,iL=160,Zr=4,sL=null;function Jq({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const c=n-r-o;return c<i?sL:Math.max(i,Math.min(c,e-t))}function Qq(e){const t=tL+Zr;return`minmax(0, 1fr) ${Zr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function eG(e){const t=iL+Zr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Zr}px minmax(0, 1fr)`}function rL(e,t,n,i,r,o=Zr){const c=n-r-o;return c<i?sL:Math.max(i,Math.min(c,e+t))}function tG(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Zr}px minmax(120px, 1fr)`}function nG(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Zr}px minmax(140px, 1fr)`}function aL({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 oL="fleet-console.history.logHeight",B2="fleet-console.history.headerHeight",$2="fleet-console.history.fileListWidth",lL="fleet-console.history.filesView",iG=240,sG=214,rG=180;function aG(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function oG(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))||D0(i).some(r=>r.label.toLowerCase().includes(n))):e}function lG(e){return e==="Escape"}function cG(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 uG(e,t,n){return e.files>0&&!t&&!n}function P2({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 hG({entry:e,checkouts:t,selected:n,graphNode:i,laneCount:r,layoutCollapsed:o,onSelect:c}){const d=D0(e),p=aG(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:eL(e.authorAt)}),u.jsxs("span",{className:"history-commit-badges",children:[d.map(f=>{const _=f.kind==="branch"?t.find(g=>g.branch===f.label):null;return u.jsxs("span",{className:`history-badge history-badge--${f.kind}`,children:[_&&u.jsx(P2,{current:_.isCurrent}),f.label]},`${f.kind}:${f.label}`)}),p&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(P2,{current:p.isCurrent}),"detached"]})]}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(Xq,{node:i,laneCount:r,collapsed:o})})]})}function dG({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(()=>Qy(B2,sG)),[w,x]=y.useState(()=>Qy($2,rG)),[k,A]=y.useState(_G),B=y.useRef(null),z=y.useRef(null),E=y.useRef(null),M=y.useRef(b),j=y.useRef(w),H=y.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??""}),[t.fullHash,e.theaterId]);y.useEffect(()=>{let oe=!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})}).then(async Y=>{if(!Y.ok)throw new Error((await Y.json()).error??"git_failed");return Y.json()}).then(Y=>{oe||(o({kind:"ok",result:Y}),f(Y.files[0]?.path??null))}).catch(Y=>{oe||o({kind:"error",message:Y instanceof Error?Y.message:"unknown"})}),()=>{oe=!0}},[e.api,e.theaterId,t.fullHash]),y.useEffect(()=>()=>E.current?.(),[]);const U=y.useCallback((oe,Y)=>{oe.preventDefault();const $=Y==="y"?B.current:z.current;if(!$)return;const L=Y==="y"?M.current:j.current,P=Y==="y"?oe.clientY:oe.clientX,D=Y==="y"?$.getBoundingClientRect().height:$.getBoundingClientRect().width;E.current?.(),E.current=aL({documentTarget:document,windowTarget:window,onMove:T=>{const R=T,N=rL(L,(Y==="y"?R.clientY:R.clientX)-P,D,120,120);N!==null&&(Y==="y"?(M.current=N,S(N)):(j.current=N,x(N)))},onFinish:()=>{const T=Y==="y"?M.current:j.current;try{localStorage.setItem(Y==="y"?B2:$2,String(T))}catch{}E.current=null}})},[]),Q=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:oe,files:Y}=r.result,$=Y.find(F=>F.path===p)??Y[0]??null,L=Y.reduce((F,W)=>F+W.additions,0),P=Y.reduce((F,W)=>F+W.deletions,0),D=t.entry,T=(F,W)=>{f(F.path),W&&d("changes")},R=F=>{A(F);try{localStorage.setItem(lL,F)}catch{}},N=()=>{const F=navigator.clipboard?.writeText(t.fullHash);F&&F.then(()=>{g(!0),window.setTimeout(()=>g(!1),1200)}).catch(()=>{})};return c==="details"?u.jsxs("div",{ref:B,className:"history-details-tab",style:{gridTemplateRows:tG(b)},children:[u.jsx(fG,{meta:oe,entry:D,fullHash:t.fullHash,copied:_,onCopy:N,onParent:F=>n({fullHash:F})}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:F=>U(F,"y")}),u.jsx(z2,{files:Y,selectedPath:p,additions:L,deletions:P,viewMode:k,onViewMode:R,onSelect:F=>T(F,!0)})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:z,className:"history-changes-columns",style:{gridTemplateColumns:nG(w)},children:[u.jsx(z2,{files:Y,selectedPath:p,additions:L,deletions:P,viewMode:k,onViewMode:R,onSelect:F=>T(F,!1)}),u.jsx("div",{className:"history-divider",onPointerDown:F=>U(F,"x")}),$?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-repository-head",children:[u.jsx("span",{title:$.path,children:$.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":"Previous file",disabled:Y.indexOf($)===0,onClick:()=>T(Y[Y.indexOf($)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":"Next file",disabled:Y.indexOf($)===Y.length-1,onClick:()=>T(Y[Y.indexOf($)+1],!1),children:"›"})]})]}),u.jsx(QR,{ctx:e,file:$,mode:"unified",commit:H})]}):u.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return u.jsxs("div",{className:"history-inspector",onKeyDown:oe=>{lG(oe.key)&&(oe.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:"✕"})]}),Q]})}function fG({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:vG(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??eL(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:D0(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(YR,{files:e,selectedPath:t,onSelect:c}):e.map(d=>u.jsx(ZR,{entry:d,isSelected:d.path===t,onSelect:c},d.path))})]})}function pG({ctx:e,active:t=!0,refFilter:n=null,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c}){return u.jsx(mG,{ctx:e,active:t,refFilter:n,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c},e.theaterId)}function mG({ctx:e,active:t,refFilter:n,wipFiles:i,onInspectorOpenChange:r,onClearRef:o,onWip:c}){const[d,p]=y.useState({kind:"loading"}),[f,_]=y.useState(null),[g,b]=y.useState(""),[S,w]=y.useState(0),[x,k]=y.useState(gG),[A,B]=y.useState(!1),z=y.useRef(null),E=y.useRef(null),M=y.useRef(x);y.useEffect(()=>{_(null)},[n]);const[j,H]=y.useState(t);y.useEffect(()=>{t&&H(!0)},[t]),y.useEffect(()=>{if(!j)return;if(!e.theaterId){p({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let L=!1;return p({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,...n?{ref:n}:{}})}).then(async P=>{if(!P.ok)throw new Error((await P.json()).error??"git_failed");return P.json()}).then(P=>{L||p({kind:"ok",commits:P.commits,checkouts:P.checkouts,truncated:P.truncated??!1})}).catch(P=>{L||p({kind:"error",message:P instanceof Error?P.message:"unknown"})}),()=>{L=!0}},[e.api,e.theaterId,j,S,n]),y.useEffect(()=>{r?.(t&&f!==null)},[t,r,f]),y.useEffect(()=>()=>E.current?.(),[]);const U=y.useCallback(L=>{L.preventDefault();const P=z.current;if(!P)return;const D=M.current,T=L.clientY,R=P.getBoundingClientRect().height;E.current?.(),B(!0),E.current=aL({documentTarget:document,windowTarget:window,onMove:N=>{const F=rL(D,N.clientY-T,R,nL,iL,Zr);F!==null&&(M.current=F,k(F))},onFinish:()=>{try{localStorage.setItem(oL,String(M.current))}catch{}B(!1),E.current=null}})},[]),Q=y.useMemo(()=>d.kind==="ok"?oG(d.commits,g):[],[g,d]),oe=d.kind==="ok"?Zq(Q):null,Y=y.useMemo(()=>cG(i),[i]),$=uG(Y,g,n);return u.jsxs("div",{ref:z,className:`history-root${A?" is-dragging":""}`,style:f?{gridTemplateRows:eG(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:g,onChange:L=>b(L.target.value)}),g&&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:g?`${Q.length}/${d.commits.length}`:d.commits.length})]}),u.jsxs("div",{className:"history-list",children:[$&&u.jsxs("button",{type:"button",className:"repository-wip-row",onClick:c,children:["Uncommitted changes ",u.jsxs("span",{children:[Y.files," files · +",Y.additions," −",Y.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(L=>L+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&&Q.length===0&&u.jsx("div",{className:"history-empty",children:"No matching items"}),d.kind==="ok"&&oe&&Q.map((L,P)=>u.jsx(hG,{entry:L,checkouts:d.checkouts,selected:f?.fullHash===L.fullHash,graphNode:oe.nodes[P],laneCount:oe.activeLaneCount,layoutCollapsed:oe.collapsed,onSelect:D=>_({fullHash:D.fullHash,entry:D})},L.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:U}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(dG,{ctx:e,target:f,onSelectCommit:_,onClose:()=>_(null)})})]})]})}function gG(){return Qy(oL,iG,nL)}function _G(){try{const e=localStorage.getItem(lL);if(e==="list"||e==="tree")return e}catch{}return"list"}function Qy(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function vG(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const cL="fleet-console.diff.viewMode",uL="fleet-console.diff.listPaneWidth",hL="fleet-console.repository.source",yG=400,bG=248,dL=220;function SG(){try{const e=localStorage.getItem(cL);if(e==="list"||e==="tree")return e}catch{}return"list"}function wG(){try{const e=localStorage.getItem(hL);if(e==="changes"||e==="history"||e==="branches"||e==="tags"||e==="stashes")return e}catch{}return"changes"}function xG(e){try{localStorage.setItem(hL,e)}catch{}}function CG(){try{const e=localStorage.getItem(uL),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(dL,t)}catch{}return bG}function kG(e){return e.entry.status==="U"?"untracked":"unified"}function EG({ctx:e}){return u.jsx(AG,{ctx:e},e.theaterId)}function fL(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function TG(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=>!fL(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]}function AG({ctx:e}){const[t,n]=y.useState(wG),[i,r]=y.useState(null),[o,c]=y.useState({branches:[],remotes:[],tags:[],stashes:[]}),[d,p]=y.useState(!1),[f,_]=y.useState(0),[g,b]=y.useState({kind:"loading"}),[S,w]=y.useState(0),[x,k]=y.useState(!1),[A,B]=y.useState(SG),[z,E]=y.useState(""),M=Fq(e.theaterId??null),[j,H]=y.useState(CG),U=y.useRef(j),Q=y.useRef(null),[oe,Y]=y.useState(!1),$=y.useCallback(W=>{n(W),xG(W)},[]);y.useEffect(()=>{if(!e.theaterId)return;let W=!1;return p(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId})}).then(O=>O.ok?O.json():Promise.reject()).then(O=>{W||c(O)}).catch(()=>{W||p(!0)}),()=>{W=!0}},[e.api,e.theaterId,f]),y.useEffect(()=>{if(!e.theaterId){b({kind:"error",message:"no_theater"});return}let W=!1;return b({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId})}).then(async O=>{if(!O.ok){const he=(await O.json()).error??"git_failed";W||b(he==="no_git_repo"||he==="git_unavailable"?{kind:"notice",reason:he}:{kind:"error",message:he});return}const V=await O.json();W||b({kind:"ok",files:V.files})}).catch(O=>{W||b({kind:"error",message:O instanceof Error?O.message:"unknown"})}),()=>{W=!0}},[S,e.theaterId]),y.useLayoutEffect(()=>()=>j2(),[]);const L=y.useCallback(W=>{e.theaterId&&Uq(W,e.theaterId)},[e.theaterId]),P=y.useCallback(()=>j2(),[]),D=y.useCallback(W=>{B(W);try{localStorage.setItem(cL,W)}catch{}},[]),T=y.useCallback(W=>{W.preventDefault();const O=Q.current;if(!O)return;const V=O.getBoundingClientRect().width,J=W.clientX,he=U.current;Y(!0);const fe=Te=>{const Re=Jq({startWidth:he,dx:Te.clientX-J,containerWidth:V,listPaneMinWidth:dL,hunkPaneMinWidth:tL,dividerWidth:Zr});Re!==null&&(U.current=Re,H(Re))},le=()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",le),Y(!1);try{localStorage.setItem(uL,String(U.current))}catch{}};document.addEventListener("pointermove",fe),document.addEventListener("pointerup",le)},[]);y.useLayoutEffect(()=>(e.requestExtraWidth?.(t==="changes"&&M||t==="history"&&x?yG:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,M,t,x]);const R=M?kG(M):null,N=y.useCallback(()=>w(W=>W+1),[]),F=g.kind==="ok"?g.files:[];return u.jsxs("div",{className:"repository-unified",children:[u.jsx(RG,{source:t,refs:o,onSource:$,onRef:W=>{r(W),$("history")}}),u.jsxs("div",{className:"repository-source-content",children:[u.jsx("div",{className:"repository-source-fill",hidden:t!=="history",children:u.jsx(pG,{ctx:e,active:t==="history",refFilter:i,wipFiles:F,onInspectorOpenChange:k,onClearRef:()=>r(null),onWip:()=>$("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:()=>_(W=>W+1),children:"Retry"})]}):u.jsx(LG,{source:t,refs:o,onRef:W=>{r(W),$("history")}}):null,u.jsxs("div",{hidden:t!=="changes",ref:Q,className:`repository-root${M?" has-hunk":""}${oe?" is-dragging":""}`,style:M?{gridTemplateColumns:Qq(j)}:void 0,children:[M&&R?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:P,children:"✕"})]}),u.jsx(QR,{ctx:e,file:M.entry,mode:R})]}):null,M?u.jsx("div",{className:"repository-divider",onPointerDown:T,"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:W=>E(W.target.value)}),z?u.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>E(""),children:"✕"}):null]}),u.jsxs("div",{className:"repository-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${A==="list"?" is-active":""}`,title:"List view","aria-pressed":A==="list",onClick:()=>D("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${A==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":A==="tree",onClick:()=>D("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(zq,{state:g,onRetry:N,viewMode:A,selectedPath:M?.entry.path??null,onSelect:L,filterText:z})]})]})]})]})}function pL({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":"M4 5h10v9H4zM6 3h6";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 RG({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(pL,{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=>!fL(r.ref)).length),i("tags","Tags",t.tags.length),i("stashes","Stashes",t.stashes.length)]})}function LG({source:e,refs:t,onRef:n}){return e==="changes"||e==="history"?null:u.jsx("div",{className:"repository-ref-list",children:TG(e,t).map(i=>u.jsxs("div",{className:"repository-ref-group",children:[i.label&&u.jsx("b",{className:"repository-ref-group-label",children:i.label}),i.rows.map(r=>u.jsxs("button",{type:"button",className:`repository-ref-row${r.current?" is-current":""}`,disabled:r.ref===null,onClick:()=>{r.ref&&n(r.ref)},children:[u.jsx(pL,{source:r.source}),u.jsxs("span",{className:"repository-ref-name",children:[r.primary,r.current&&" ✓"]}),r.sub&&u.jsx("span",{className:"repository-ref-sub",children:r.sub})]},r.key))]},i.label??e))})}function NG(){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 MG={id:"repository",title:"Repository",icon:()=>u.jsx(NG,{}),render:e=>u.jsx(EG,{ctx:e})},OG={id:"repository",railPanels:[MG]},DG=[OG],rf=["claude-code","codex","cursor","opencode"],jG={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},IG="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function BG({source:e,skill:t,theaterId:n,onCancel:i,onStarted:r,jobLog:o}){const[c,d]=y.useState(n?"project":"global"),[p,f]=y.useState(!0),[_,g]=y.useState(new Set(rf)),{status:b,start:S}=o,w=b==="running",x=b==="done",k=b==="error",A=y.useCallback(()=>{f(!0),g(new Set(rf))},[]),B=y.useCallback(E=>{f(!1),g(M=>{const j=new Set(M);return j.has(E)?j.delete(E):j.add(E),j})},[]),z=y.useCallback(()=>{const E=p?rf:Array.from(_);if(E.length===0)return;const M={source:e,skill:t,scope:c,agents:E};c==="project"&&n&&(M.theaterId=n),S("/plugins/skills/install",M),r(c)},[p,_,e,t,c,n,S,r]);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${c==="project"?" is-active":""}`,onClick:()=>d("project"),disabled:!n||w||x,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${c==="global"?" is-active":""}`,onClick:()=>d("global"),disabled:w||x,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:A,disabled:w||x,children:"All agents"}),rf.map(E=>u.jsx("button",{type:"button",className:`skills-agent-chip${!p&&_.has(E)?" is-active":""}`,onClick:()=>B(E),disabled:w||x,children:jG[E]},E))]}),u.jsx("p",{className:"skills-permission-warning",children:IG}),!w&&!x&&!k&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:z,disabled:!p&&_.size===0,children:"Install now"})]})]})}const $G=4e3;function mL({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:c}){const[d,p]=y.useState(!1),f=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{e==="running"&&p(!1)},[e]),y.useEffect(()=>{const k=f.current;k&&(k.scrollTop=k.scrollHeight)},[t]),y.useEffect(()=>{if(e==="done")return _.current=setTimeout(()=>{p(!1),o()},$G),()=>{_.current&&(clearTimeout(_.current),_.current=null)}},[e,o]);const g=y.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),p(!1),o()},[o]),b=y.useCallback(()=>p(k=>!k),[]);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((k,A)=>u.jsx("div",{className:"skills-dock-log-line",children:k},A)),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:k=>{k.target===k.currentTarget&&(k.key==="Enter"||k.key===" ")&&(k.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:k=>{k.stopPropagation(),g()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[c!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:k=>{k.stopPropagation(),c()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:k=>{k.stopPropagation(),g()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const PG={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},eb=new Set;let oi=PG;function Ya(){for(const e of eb)e()}function zG(e){return eb.add(e),()=>{eb.delete(e)}}function H2(){return oi}function j0(){return y.useSyncExternalStore(zG,H2,H2)}function af(e){oi={...oi,activeTab:e},Ya()}function F2(e){oi={...oi,scope:e},Ya()}function HG(e){oi={...oi,filterText:e},Ya()}function FG(e){oi={...oi,searchQuery:e},Ya()}function Dl(e,t){oi={...oi,searchResults:e,searchLoading:t},Ya()}function fp(e){return e??""}function tb(e,t){return e.installedContextKey===t}function ev(e,t,n){oi.installedContextKey===e&&(oi={...oi,installedList:t,installedLoading:n},Ya())}function nb(e){oi={...oi,installFormOpenId:e},Ya()}function UG(e){oi={...oi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ya()}const U2=750;function gL(){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 _=0;const g=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${_}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();_=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{g()},U2):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{g()},U2)})()},[i]);return{...e,start:o,reset:r}}const WG=300,Af=2;function qG(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function GG(e){if(e.length<Af){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 KG({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:r,onInstallStarted:o,jobLog:c}){const d={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>r(d,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:qG(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:i,children:n?"Cancel":"Install"})}),n&&u.jsx(BG,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:p=>o(e.name,p),jobLog:c})]})}function VG({theaterId:e,onReadMore:t,onInstallSuccess:n}){const{searchQuery:i,searchResults:r,searchLoading:o,installFormOpenId:c}=j0(),d=y.useRef(null),p=gL(),[f,_]=y.useState(null),g=y.useCallback(S=>{if(FG(S),d.current&&clearTimeout(d.current),S.length<Af){Dl([],!1);return}d.current=setTimeout(()=>{GG(S)},WG)},[]);y.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),y.useEffect(()=>{p.status!=="done"||!f||(n(f.name,f.scope),nb(null),_(null))},[p.status,f,n]);const b=f?`Installing ${f.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:i,onChange:S=>g(S.target.value),"aria-label":"Search skills registry"}),o&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!o&&i.length>=Af&&r.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',i,'".']}),!o&&i.length>0&&i.length<Af&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:r.map(S=>u.jsx(KG,{result:S,theaterId:e,isFormOpen:c===S.id,onInstallClick:()=>nb(c===S.id?null:S.id),onReadMore:t,onInstallStarted:(w,x)=>_({name:w,scope:x}),jobLog:p},S.id))})]}),u.jsx(mL,{status:p.status,lines:p.lines,runningLabel:b,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:p.reset})]})}const YG=2600;function XG({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),YG))},[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 ZG(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function JG({theaterId:e,onReadMore:t,refreshKey:n}){const i=j0(),{scope:r,filterText:o}=i,c=fp(e),d=tb(i,c)?i.installedList:[],p=tb(i,c)&&i.installedLoading,f=gL(),_=y.useRef(null),g=y.useCallback(B=>{const z=fp(B);ev(z,[],!0),ZG(B).then(E=>ev(z,E,!1)).catch(()=>ev(z,[],!1))},[]);y.useEffect(()=>{g(e)},[e,g,n]),y.useEffect(()=>{(f.status==="done"||f.status==="error")&&g(e)},[f.status,e,g]);const b=y.useCallback(B=>{const z=B;_.current=z;const E={scope:z};z==="project"&&e&&(E.theaterId=e),f.start("/plugins/skills/update",E)},[e,f]),S=y.useCallback((B,z)=>{const E={scope:z,skill:B};z==="project"&&e&&(E.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}).then(()=>g(e)).catch(()=>null)},[e,g]),w=y.useCallback(()=>{_.current&&b(_.current)},[b]),x=r==="project"&&!e?"global":r,k=d.filter(B=>B.scope!==x?!1:o?B.name.toLowerCase().includes(o.toLowerCase()):!0),A=f.status==="running"&&_.current===x;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${x==="project"?" is-active":""}`,onClick:()=>F2("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${x==="global"?" is-active":""}`,onClick:()=>F2("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:B=>HG(B.target.value),"aria-label":"Filter installed skills"}),p&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!p&&k.length===0&&u.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${x} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:k.map(B=>u.jsx(XG,{skill:B,onReadMore:t,onUpdate:b,onRemove:S,isUpdating:A},`${B.scope}:${B.name}`))})]}),u.jsx(mL,{status:f.status,lines:f.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:f.reset,onRetry:w})]})}function tv(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 QG({content:e}){const t=y.useMemo(()=>{const r=Bs(e).html,o=new DOMParser().parseFromString(r,"text/html");return tv(o.body),o.body.innerHTML},[e]),n=y.useRef(null);y.useEffect(()=>{const r=n.current;if(!r)return;tv(r);const o=new MutationObserver(()=>tv(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 eK=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),tK="Skills run with full agent permissions. Review before use.";function nK(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(eK)),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 iK({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:r}){const[o,c]=y.useState(null),[d,p]=y.useState(!1),f=y.useRef(null),_=y.useRef(null),g=y.useRef(null);if(y.useEffect(()=>{e&&f.current===null&&(f.current=document.activeElement)},[e]),y.useEffect(()=>{if(!e){c(null);return}p(!0),c(null);let S=!1;return(async()=>{try{let x;if(t){const A={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(A.theaterId=n),x=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}else x=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(S)return;if(!x.ok){p(!1);return}const k=await x.json();S||(c(k.markdown??""),p(!1))}catch{S||p(!1)}})(),()=>{S=!0}},[e,t,n]),y.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"?(w.preventDefault(),i()):w.key==="Tab"&&nK(w,g.current),w.stopImmediatePropagation()};return _.current?.focus(),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0);const w=f.current;f.current=null,w?.focus?.()}},[e,i]),y.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const b=e.displayPath||e.source||null;return Va.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:u.jsxs("div",{ref:g,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),b&&u.jsx("span",{className:"skills-overlay-meta",children:b}),u.jsx("button",{ref:_,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[d&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!d&&o===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),o!==null&&u.jsx(QG,{content:o})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:tK}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),r()},children:"Install"})]})]})}),document.body)}const sK=3200;function rK({message:e,onDismiss:t}){return y.useEffect(()=>{if(!e)return;const n=setTimeout(t,sK);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function aK({ctx:e}){const t=fp(e.theaterId);return u.jsx(oK,{ctx:e},t)}function oK({ctx:e}){const{theaterId:t}=e,n=j0(),{activeTab:i}=n,r=fp(e.theaterId),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,_]=y.useState(0),g=tb(n,r)?n.installedList.length:0;y.useLayoutEffect(()=>{UG(r)},[r]);const b=y.useCallback(k=>{c({skill:k,isInstalled:!0})},[]),S=y.useCallback((k,A)=>{c({skill:k,isInstalled:!1,registryId:A})},[]),w=y.useCallback((k,A)=>{p(`Installed ${k} to ${A}`),_(B=>B+1),af("installed")},[]),x=y.useCallback(()=>{o?.registryId&&(nb(o.registryId),af("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:()=>af("installed"),children:["Installed",g>0?` ${g}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>af("find"),children:"Find"})]}),i==="installed"?u.jsx(JG,{theaterId:t,onReadMore:b,refreshKey:f}):u.jsx(VG,{theaterId:t,onReadMore:S,onInstallSuccess:w}),u.jsx(rK,{message:d,onDismiss:()=>p(null)}),u.jsx(iK,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>c(null),onInstall:x})]})}function lK(){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 cK={id:"skills",title:"Skills",icon:lK,render:e=>u.jsx(aK,{ctx:e})},uK={id:"skills",railPanels:[cK]},hK=[uK],_L=[...MW,...Mq,...DG,...hK],dK=yL(_L),vL=y.createContext(dK),fK=vL.Provider;async function pK(){const e=[..._L],t=new Set(e.map(i=>i.id)),n=await mK();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await gK(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 yL(e)}function dc(){return y.useContext(vL)}async function mK(){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(vK):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function gK(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return _K(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 yL(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 _K(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function vK(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 yK=288,bK=520,Tu=12;function bL({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 _=b=>{p.current?.contains(b.target)||d()},g=b=>{b.key==="Escape"&&d()};return document.addEventListener("mousedown",_),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("keydown",g)}},[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:wK(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(SK,{})}),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:[g>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:_.title}),_.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(_.id,b),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(_.id,b)??u.jsx(xK,{})}),u.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${_.id}:${b.id}`)})]},_.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function SK(){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 wK(e,t,n){const i=t?Math.max(Tu,Math.min(e.x,t.width-yK-Tu)):e.x;if(n==="above")return{left:i,bottom:Math.max(Tu,e.y)};const r=t?Math.max(Tu,Math.min(e.y,t.height-bK-Tu)):e.y;return{left:i,top:r}}function xK(){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 SL(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const of="directory-browser-sectors";function wL({open:e,onCancel:t,onConfirm:n}){const[i,r]=y.useState(null),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,_]=y.useState(""),[g,b]=y.useState(""),[S,w]=y.useState(0),x=y.useRef(null),k=y.useRef(null),A=async(D,T)=>{c(D),p(null),_(""),w(0);try{const R=await pO(D,T);r(R)}catch(R){if(R instanceof DOMException&&R.name==="AbortError")return;p(R instanceof en?R.message:String(R))}finally{c(null)}};y.useEffect(()=>{if(!e)return;const D=new AbortController;return A(null,D.signal),()=>D.abort()},[e]),y.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const B=i?.entries??[],z=y.useMemo(()=>{const D=f.trim().toLowerCase();return D===""?B:B.filter(T=>T.name.toLowerCase().includes(D))},[B,f]),E=y.useMemo(()=>i?CK(i):[],[i]),M=i?W2(i.path):null,j=i?.roots??[],H=j.length>1,U=z.length===0?-1:Math.min(S,z.length-1);if(y.useEffect(()=>{if(U<0)return;k.current?.querySelector(`[data-index="${U}"]`)?.scrollIntoView({block:"nearest"})},[U,i?.path]),!e)return null;const Q=D=>{D.accessible&&o===null&&A(D.path)},oe=()=>{i?.parentPath!=null&&o===null&&A(i.parentPath)},Y=()=>{const D=g.trim();D!==""&&o===null&&A(D)},$=i?.path??null,L=U>=0?`${of}-${U}`:void 0,P=D=>{switch(D.key){case"Escape":f!==""?_(""):t();return;case"ArrowDown":D.preventDefault(),w(T=>Math.min(T+1,Math.max(z.length-1,0)));return;case"ArrowUp":D.preventDefault(),w(T=>Math.max(T-1,0));return;case"Enter":{D.preventDefault();const T=z[U];T&&Q(T);return}case"Backspace":f===""&&(D.preventDefault(),oe());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:P,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(TK,{})}),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:j.map(D=>{const T=M!=null&&W2(D)===M;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${T?"is-active":""}`,"aria-current":T?"location":void 0,disabled:o!==null,title:D,onClick:()=>{o===null&&A(D)},onKeyDown:R=>R.stopPropagation(),children:EK(D)},D)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:E.map((D,T)=>{const R=T===E.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[T>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${R?"is-current":""}`,"aria-current":R?"location":void 0,disabled:R||o!==null,title:D.path,onClick:()=>{A(D.path)},children:D.label})]},D.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(RK,{})}),u.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":of,value:f,spellCheck:!1,autoComplete:"off",onChange:D=>{_(D.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:oe,children:[u.jsx(LK,{}),u.jsx("span",{children:"Up"})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:g,spellCheck:!1,autoComplete:"off",onChange:D=>b(D.target.value),onKeyDown:D=>{D.stopPropagation(),D.key==="Enter"&&(D.preventDefault(),Y())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:g.trim()===""||o!==null,onClick:Y,onKeyDown:D=>D.stopPropagation(),children:"Go"})]}),d?u.jsx("p",{className:"directory-browser-error",role:"alert",children:d}):null,u.jsx("div",{className:"directory-browser-list",id:of,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":L,ref:k,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((D,T)=>u.jsxs("div",{id:`${of}-${T}`,"data-index":T,role:"option","aria-selected":T===U,"aria-disabled":!D.accessible,className:`directory-browser-sector ${T===U?"is-active":""} ${D.accessible?"":"is-locked"}`,title:D.path,onClick:()=>{w(T),Q(D)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(AK,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:D.name}),D.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(NK,{})," Locked"]})]},D.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:$??"",children:$??"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:$===null||o!==null,onClick:()=>$&&n($),children:"Add Theater"})]})]})]})]}),document.body)}function CK(e){if(kK(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 kK(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function W2(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function EK(e){return e.replace(/[\\/]+$/,"")||e}function TK(){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 AK(){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 RK(){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 LK(){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 NK(){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 I0=[{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)"}],MK={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 xL(e){return typeof e!="string"||e.length===0?null:I0.some(t=>t.key===e)?e:MK[e]??null}function qa(e){const t=xL(e);return t?I0.find(n=>n.key===t)?.color??null:null}function ib(e){return typeof e.accent=="string"?e.accent:null}const q2=8,OK=268;function B0({accentKey:e,includeNone:t,onSelect:n}){const i=xL(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,I0.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 DK({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+q2,f=p+OK>window.innerHeight;o(f?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+q2)}:{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(B0,{accentKey:t,includeNone:!0,onSelect:c})}):null}),document.body)}const G2=8,jK=320;function K2(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+G2,d=c+jK>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+G2)}:{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(IK,{...e}):u.jsx(BK,{...e})}):null}),document.body)}function IK({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),_=y.useRef(null);y.useEffect(()=>{o&&_.current?.select()},[o]);const g=()=>{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($K,{}):null]},b.id)}),o?u.jsx("input",{ref:_,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(),g()),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(B0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function BK({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(B0,{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 $K(){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 PK="fleet-console.canvas.",CL="fleet-console.formation-layout",zK=400,sb=640,rb=400,V2=40,HK=320,FK=200,UK=8,WK=0,Y2=96,qK=.25,GK=1,nv=.2,X2=.5,KK=.001,Fl={x:0,y:0,zoom:1},Vl={viewport:Fl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},ab=new Set,ob=new Set,lb=new Set,cb=new Set,Js=new Map,ec=new Map;let Ot=null,Ua=null,Je=Vl,_n=null,kL=0,Zi=!1,$0=fV(),Pa=Fl,Mo=null,pp=0;function P0(e){return ab.add(e),()=>{ab.delete(e)}}function Ga(){return Je}function VK(e){return Ot===e?Je:U0(e)}function Ys(){return _n?.mode==="maximized"?_n.operationId:null}function ms(){return _n?.mode==="companion"?_n.operationId:null}function Z2(){return kL}function YK(e){const t=Ot===e?_n:Js.get(e)??null;return t?.mode==="companion"?t.operationId:null}function mp(){return Zi}function J2(){return $0}function EL(){return Ot}function TL(){return y.useSyncExternalStore(P0,Ga,Ga)}function AL(){return y.useSyncExternalStore($L,Ys,Ys)}function RL(){return y.useSyncExternalStore($L,ms,ms)}function zp(){return y.useSyncExternalStore(rV,mp,mp)}function LL(){return y.useSyncExternalStore(aV,J2,J2)}function NL(){return y.useSyncExternalStore(P0,tE,tE)}function Ji(e){Je={viewport:e.viewport??Je.viewport,operations:e.operations??Je.operations,operationOrder:e.operationOrder??Je.operationOrder,operationAccent:e.operationAccent??Je.operationAccent,minimized:e.minimized??Je.minimized,collapsedGroups:e.collapsedGroups??Je.collapsedGroups},uV(),H0()}function ML(e){const t=Je.collapsedGroups.includes(e)?Je.collapsedGroups.filter(n=>n!==e):[...Je.collapsedGroups,e];Ji({collapsedGroups:t})}function XK(e,t){if(Ot===e){ML(t);return}const n=U0(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];W0(e,{...n,collapsedGroups:i}),Je={...Je},H0()}function ZK(){return y.useSyncExternalStore(P0,nE,nE)}function ub(e){F0();const t=q0(e);Pa=t,Ji({viewport:t})}function OL(e){const t=q0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||cV()){ub(t);return}Pa=t,Mo===null&&(Mo=window.requestAnimationFrame(HL))}function hb(e,t){const n=zo();Ji({operations:{...Je.operations,[e]:{...G0(t,n),zIndex:n}}})}function JK(e,t,n=HK,i=FK,r=UK,o=WK,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)),k=x/t,A=Math.min(n,k),B=Math.min(Math.max(A,k),x),z=p,E=Math.min(i,z),M=Math.min(Math.max(E,z),p);return Array.from({length:t},(j,H)=>({x:e.x+o+H*(B+r),y:e.y+o,width:B,height:M}))}if(c==="rows"){const x=d,k=Math.min(n,x),A=Math.min(Math.max(k,x),d),B=Math.max(0,p-r*(t-1)),z=B/t,E=Math.min(i,z),M=Math.min(Math.max(E,z),B);return Array.from({length:t},(j,H)=>({x:e.x+o,y:e.y+o+H*(M+r),width:A,height:M}))}const f=Math.ceil(Math.sqrt(t)),_=Math.ceil(t/f),g=Math.max(0,p-r*(_-1)),b=g/_,S=Math.min(i,b),w=Math.min(Math.max(S,b),g);return Array.from({length:t},(x,k)=>{const A=Math.floor(k/f),B=k%f,z=A===_-1?t-(_-1)*f:f,E=Math.max(0,d-r*(z-1)),M=E/z,j=Math.min(n,M),H=Math.min(Math.max(j,M),E);return{x:e.x+o+B*(H+r),y:e.y+o+A*(w+r),width:H,height:w}})}function DL(e){Je.minimized.includes(e)||(Ys()===e&&Ka(),ms()===e&&Qs(),Ji({minimized:[...Je.minimized,e]}))}function QK(e){const t=new Set,i=[...Je.minimized.filter(c=>t.has(c)||!(c in Je.operations)?!1:(t.add(c),!0)),...e.filter(c=>t.has(c)||!(c in Je.operations)?!1:(t.add(c),!0))];if(zL(Je.minimized,i))return;const r=Ys(),o=ms();r&&i.includes(r)&&Ka(),o&&i.includes(o)&&Qs(),Ji({minimized:i})}function gp(e){if(!Je.minimized.includes(e))return;Ys()===e&&Ka();const t=Je.minimized.filter(r=>r!==e),n=Je.operations[e];if(!n){Ji({minimized:t});return}const i=zo();Ji({minimized:t,operations:{...Je.operations,[e]:{...n,zIndex:i}}})}function iv(e){Ji({operationOrder:UL(e)})}function zo(){return pp+=1,pp}function eV(e){const t=Je.operations[e];if(t)return t;const n=Object.keys(Je.operations).length,i={x:n*V2,y:n*V2,width:sb,height:rb,zIndex:zo()};return Ji({operations:{...Je.operations,[e]:i}}),i}function tV(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(Je.operations))t.has(b)?n[b]=S:i=!0;const r=Je.minimized.filter(b=>t.has(b)),o=r.length!==Je.minimized.length,c=Je.operationOrder.filter(b=>t.has(b)),d=c.length!==Je.operationOrder.length,p=Object.fromEntries(Object.entries(Je.operationAccent).filter(([b])=>t.has(b))),f=Object.keys(p).length!==Object.keys(Je.operationAccent).length,_=Ys(),g=ms();_&&(!t.has(_)||r.includes(_))&&Ka(),g&&r.includes(g)&&Qs(),(i||o||d||f)&&Ji({operations:n,minimized:r,operationOrder:c,operationAccent:p})}function nV(e){hV(),F0(),lV(),Ot=e,Je=e?U0(e):Vl;const t=e?Js.get(e)??null:null,n=!PL(_n,t);_n=t;const i=e?ec.has(e):!1,r=Zi!==i;Zi=i,Pa=Je.viewport,pp=Math.max(pp,WL(Je.operations)),H0(),n&&Sh(),r&&tc()}function Q2(e,t){const n=Je.operations[e];if(!n)return;const i=Math.max(qK,Math.min(GK,Math.min((t.width-Y2)/n.width,(t.height-Y2)/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};F0(),Pa=r;const o=zo(),c=Je.minimized.includes(e);Ji({viewport:r,operations:{...Je.operations,[e]:{...G0(n,o),zIndex:o}},...c?{minimized:Je.minimized.filter(d=>d!==e)}:{}})}function z0(e){const t={mode:"maximized",operationId:e};Ot&&Js.set(Ot,t),IL(t)}function Ka(){Ot&&Js.get(Ot)?.mode==="maximized"&&Js.delete(Ot),_n?.mode==="maximized"&&(_n=null,Sh())}function jL(e){const t=_n?.mode==="companion"?_n.returnTo:_n?.mode==="maximized"?"maximized":"underlay";IL({mode:"companion",operationId:e,returnTo:t})}function IL(e){const t=Je.minimized.filter(r=>r!==e.operationId),n=!zL(Je.minimized,t),i=!PL(_n,e);i&&(_n=e),i&&Ot&&Js.set(Ot,e),n&&Ji({minimized:t}),i&&Sh()}function iV(){if(_n?.mode!=="companion")return;const e=_n;_n=e.returnTo==="maximized"&&e.operationId in Je.operations&&!Je.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,Ot&&(_n?Js.set(Ot,_n):Js.delete(Ot)),Sh()}function Qs(){_n?.mode==="companion"&&(_n=null,Ot&&Js.delete(Ot),Sh())}function sV(){if(Ot){if(ms()!==null){Qs(),Zi||(ec.set(Ot,!0),Zi=!0,tc());return}if(Zi){BL();return}Ka(),Qs(),ec.set(Ot,!0),Zi=!0,tc()}}function sv(e){if(Ot){if(ms()!==null){eE(e),Qs(),Zi||(ec.set(Ot,!0),Zi=!0,tc());return}if(Zi&&$0===e){BL();return}eE(e),Zi||(Ka(),Qs(),ec.set(Ot,!0),Zi=!0,tc())}}function BL(){Ot&&ec.delete(Ot),Zi&&(Zi=!1,tc())}function eE(e){$0=e,pV(e),oV()}function rV(e){return lb.add(e),()=>{lb.delete(e)}}function aV(e){return cb.add(e),()=>{cb.delete(e)}}function H0(){for(const e of ab)e()}function $L(e){return ob.add(e),()=>{ob.delete(e)}}function tc(){for(const e of lb)e()}function oV(){for(const e of cb)e()}function tE(){return Je.minimized}function nE(){return Je.collapsedGroups}function Sh(){kL+=1;for(const e of ob)e()}function lV(){Ot&&(_n?Js.set(Ot,_n):Js.delete(Ot))}function PL(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function zL(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function HL(){const e=Je.viewport,t=Pa.x-e.x,n=Pa.y-e.y,i=Pa.zoom-e.zoom;if(Math.abs(t)<X2&&Math.abs(n)<X2&&Math.abs(i)<KK){Mo=null,Ji({viewport:Pa});return}Ji({viewport:{x:e.x+t*nv,y:e.y+n*nv,zoom:e.zoom+i*nv}}),Mo=typeof window<"u"?window.requestAnimationFrame(HL):null}function F0(){Mo===null||typeof window>"u"||(window.cancelAnimationFrame(Mo),Mo=null)}function cV(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function uV(){!Ot||typeof window>"u"||(dV(),Ua=window.setTimeout(()=>{Ua=null,W0(Ot,Je)},zK))}function hV(){!Ua||!Ot||typeof window>"u"||(window.clearTimeout(Ua),Ua=null,W0(Ot,Je))}function dV(){!Ua||typeof window>"u"||(window.clearTimeout(Ua),Ua=null)}function U0(e){if(typeof window>"u")return Vl;try{const t=window.localStorage.getItem(FL(e));if(!t)return Vl;const n=JSON.parse(t);return mV(n)}catch{return Vl}}function W0(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(FL(e),JSON.stringify(t))}catch{}}function fV(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(CL);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function pV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(CL,e)}catch{}}function FL(e){return`${PK}${e}`}function mV(e){if(!nc(e))return Vl;const t=vV(e.operations);return{viewport:q0(e.viewport),operations:t,operationOrder:UL(e.operationOrder),operationAccent:gV(e.operationAccent),minimized:_V(e.minimized,t),collapsedGroups:bV(e.collapsedGroups)}}function UL(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 gV(e){if(!nc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function _V(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 q0(e){if(!nc(e))return Fl;const t=Yu(e.x,Fl.x),n=Yu(e.y,Fl.y),i=db(e.zoom,Fl.zoom);return{x:t,y:n,zoom:i}}function vV(e){if(!nc(e))return{};const t={};for(const[n,i]of Object.entries(e))nc(i)&&(t[n]=G0(i,yV(t)));return t}function G0(e,t){return nc(e)?{x:Yu(e.x,0),y:Yu(e.y,0),width:db(e.width,sb),height:db(e.height,rb),zIndex:Yu(e.zIndex,t)}:{x:0,y:0,width:sb,height:rb,zIndex:t}}function yV(e){return WL(e)+1}function WL(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Yu(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function db(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 bV(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 SV(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 _=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const g of _){const b=g.dataset.sideBarChipId;if(!b||b===i)continue;const S=g.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 wV(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 xV(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of r){const c=o.dataset.theaterId;if(!c||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 CV(e,t,n,i){const r=e.filter(_=>_!==t),o=new Set(i),c=r.filter(_=>o.has(_)),d=Math.max(0,Math.min(n,c.length));if(c.length===0)return[...r,t];if(d<c.length){const _=r.indexOf(c[d]),g=[...r];return g.splice(_,0,t),g}const p=r.indexOf(c[c.length-1]),f=[...r];return f.splice(p+1,0,t),f}function kV(e,t,n,i){const r=new Set(i),o=e.filter(g=>r.has(g)),c=o.indexOf(t),d=o.filter(g=>g!==t),p=n>c?n-1:n,f=Math.max(0,Math.min(p,d.length));d.splice(f,0,t);let _=0;return e.map(g=>r.has(g)?d[_++]??g:g)}function EV(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 TV(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 AV(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 RV(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 Hp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function LV(e){const t=Hp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function K0(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,_]=y.useState("");y.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const g=()=>{i?.(),c.current=!1,_(t),p(!0)},b=()=>{c.current=!0,p(!1),_("")},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:g,cancel:b,commit:S,setDraftTitle:_,handleKeyDown:k=>{if(k.key==="Enter"){k.preventDefault(),S();return}k.key==="Escape"&&(k.preventDefault(),b())},handleBlur:()=>{if(c.current){c.current=!1;return}S()}}}function qL({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:c,preview:d=!1,onArmClose:p,onDisarmClose:f,onClose:_,onMinimize:g,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:k}){const A=y.useRef(!1),{operation:B,active:z,minimized:E,notificationCount:M,status:j}=e,H=NV(B),U=K0({currentTitle:H,onCommit:T=>k(B.id,T),onBegin:f}),Q=["side-bar-chip",z?"side-bar-chip--active":"",E?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",c?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),oe=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),Y={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},$=()=>{if(f(),A.current){A.current=!1;return}b(B.id)},L=T=>{T.stopPropagation()},P=T=>{if(T.stopPropagation(),!n){p(B.id);return}f(),_(B.id)},D=T=>{T.preventDefault(),f(),x(B.id,T.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":B.id,className:Q,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:Y,onClick:$,onContextMenu:d?void 0:D,onFocus:()=>{n||f()},onPointerDown:T=>w(T,B.id),onPointerUp:()=>{r&&(A.current=!0)},onKeyDown:T=>{if(T.target===T.currentTarget){if(!d&&T.altKey&&T.shiftKey&&(T.key==="ArrowUp"||T.key==="ArrowDown")){T.preventDefault(),S(B.id,T.key==="ArrowUp"?-1:1);return}(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),$())}},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(jV,{})})}),U.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:U.inputRef,value:U.draftTitle,"aria-label":`Rename operation ${H}`,onChange:T=>U.setDraftTitle(T.target.value),onKeyDown:U.handleKeyDown,onBlur:U.handleBlur,onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:U.begin,children:H}),M>0?u.jsx("span",{className:"side-bar-chip-count",children:M}):null,u.jsx("span",{className:`side-bar-chip-status ${MV(j)}`,role:"img","aria-label":iE(j),title:iE(j)}),!d&&!E?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:L,onClick:T=>{T.stopPropagation(),f(),g(B.id)},"aria-label":`Minimize operation ${H}`,title:"Minimize operation",children:u.jsx(DV,{})}):null,d?null:u.jsx("button",{type:"button",className:oe,onPointerDown:L,onClick:P,"aria-label":n?`Confirm close operation ${H}`:`Close operation ${H}`,title:n?"Confirm close":"Close operation",children:n?"Close?":u.jsx(OV,{})})]})}function NV(e){return e.title}function MV(e){const t=Hp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function iE(e){return LV(e)}function OV(){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 DV(){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 jV(){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 GL({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:c,onContextMenu:d,onPointerDragStart:p}){const f=y.useRef(!1),_=qa(e.color),g=["side-bar-group-header",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={..._?{"--grp-color":_}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=k=>{k.preventDefault(),d(e.id,k.currentTarget.getBoundingClientRect())},w=k=>{k.target instanceof Element&&k.target.closest("button")||p(k,e.id)},x=()=>{i&&(f.current=!0)};return u.jsxs("div",{className:g,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(IV,{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 IV({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 KL="fleet-console.operations.side-width",VL="fleet-console.operations.side-collapsed",YL="fleet-console.operations.theater-collapsed",Fp=280,sE=Fp,fb=new Set,pb=new Set;let Oo={width:zV(),collapsed:HV()},Rf=FV();function XL(){return y.useSyncExternalStore(UV,mb,mb)}function BV(){return y.useSyncExternalStore(qV,rE,rE)}function $V(e){const t=Math.max(Fp,Math.min(ZL(),e));if(Oo.width!==t){Oo={...Oo,width:t};try{typeof window<"u"&&localStorage.setItem(KL,String(t))}catch{}JL()}}function V0(e){if(Oo.collapsed!==e){Oo={...Oo,collapsed:e};try{typeof window<"u"&&localStorage.setItem(VL,e?"1":"0")}catch{}JL()}}function PV(e,t){const n=new Set(Rf);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Rf.join("\0")){Rf=i;try{typeof window<"u"&&localStorage.setItem(YL,JSON.stringify(i))}catch{}WV()}}function ZL(){return typeof window<"u"?Math.max(Fp,window.innerWidth-480):800}function zV(){try{if(typeof window>"u")return sE;const e=localStorage.getItem(KL);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Fp,Math.min(ZL(),t))}}catch{}return sE}function HV(){try{return typeof window<"u"&&localStorage.getItem(VL)==="1"}catch{return!1}}function FV(){try{if(typeof window>"u")return[];const e=localStorage.getItem(YL),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function JL(){for(const e of fb)e()}function mb(){return Oo}function UV(e){return fb.add(e),()=>fb.delete(e)}function WV(){for(const e of pb)e()}function rE(){return Rf}function qV(e){return pb.add(e),()=>pb.delete(e)}function QL(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 GV=1500,KV=6,aE=34,oE=18;function VV({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:c,catalog:d,canLaunch:p,addingTheater:f,theaterError:_,renderKindIcon:g,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:x,onFocus:k,onSetAccent:A,onRename:B,onSetGroupId:z,onCreateGroup:E,onSetGroupColor:M,onRenameGroup:j,onReorderGroups:H,onReorderTheaters:U,onUngroupAll:Q,onSelectTheater:oe,onAddTheater:Y,onCancelAddTheater:$,onForgetTheater:L}){const P=y.useRef(null),D=y.useRef(null),T=XL(),{width:R,collapsed:N}=T,F=y.useRef(N),W=TL(),O=LL(),V=zp(),J=y.useRef(null),[he,fe]=y.useState(null),[le,Te]=y.useState(null),Re=y.useRef(null),$e=y.useRef([]),dt=y.useRef([]),xe=y.useRef([]),Se=y.useRef([]),Ee=y.useRef([]),Ke=y.useRef(z),de=y.useRef(H),Ge=y.useRef(U),[Le,et]=y.useState(null),[Bt,Tt]=y.useState(null),[Un,we]=y.useState(!1),[qe,it]=y.useState(!1),Ei=ZK(),vn=BV(),{operationStatus:cn}=er();y.useLayoutEffect(()=>{!F.current&&N&&SL(P.current,".command-band-sidebar-toggle"),F.current=N},[N]);const bi=n.filter(re=>re.theaterId===t),zs=i.filter(re=>re.theaterId===t),_s=new Set(r),Qi=new Set(Ei),Zn=zb(bi,W.operationOrder).map(re=>{const ot=QL(d,re),Wt=ot?g(re.pluginId,ot):null;return{operation:re,active:o===re.id,minimized:_s.has(re.id),notificationCount:c[re.id]?1:0,status:cn[re.id],icon:Wt}}),An=eN(Zn,zs,W.operationOrder),ie=An.some(re=>re.group!==null),ue=An.flatMap(re=>re.groupId?[re.groupId]:[]),Be=An.flatMap(re=>Qi.has(re.groupId??"")?[]:re.entries),Me=Zn.map(re=>re.operation.id),Fe=y.useCallback(()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},[]),At=y.useCallback(()=>{Fe(),fe(null)},[Fe]),Ti=y.useCallback(re=>{Fe(),fe(re),J.current=window.setTimeout(()=>{J.current=null,fe(null)},GV)},[Fe]);y.useEffect(()=>Fe,[Fe]),y.useEffect(()=>{he!==null&&(Zn.some(re=>re.operation.id===he)||At())},[he,Zn,At]);const Rt=Le?.kind==="chip"?Zn.find(re=>re.operation.id===Le.operationId)?.operation??null:null,Mn=Le?.kind==="group"?i.find(re=>re.id===Le.groupId)??null:null,Ft=Le?.kind==="theater"?e.find(re=>re.id===Le.theaterId)??null:null,G=(re,ot)=>{const Wt=Be.findIndex(un=>un.operation.id===re);if(Wt===-1)return;const vt=Math.max(0,Math.min(Be.length-1,Wt+ot));if(vt===Wt)return;const tt=Be.map(un=>un.operation.id),yn=RV(tt,re,vt);iv(EV(Me,tt,yn))},pe=An.map(re=>({groupId:re.groupId,entryIds:re.entries.map(ot=>ot.operation.id)}));y.useEffect(()=>{$e.current=Zn,dt.current=Me,xe.current=pe,Se.current=ue,Ee.current=e.map(re=>re.id),Ke.current=z,de.current=H,Ge.current=U});const ye=re=>{Re.current=re,Te(re)},ze=le?.pointerId??null;y.useEffect(()=>{if(ze===null)return;const re=vt=>{if(vt.pointerId!==ze)return;const tt=Re.current;if(!tt)return;if(vt.buttons===0){ye(null);return}const yn=Math.hypot(vt.clientX-tt.startX,vt.clientY-tt.startY);if(!tt.dragging&&yn<KV)return;if(tt.dragging&&vt.preventDefault(),nY(vt.clientY,D.current),tt.kind==="chip"){const Oe=SV(vt.clientY,xe.current,D.current,tt.sourceId);ye({...tt,currentY:vt.clientY,dragging:!0,dropIndex:Oe.index,dropGroupId:Oe.groupId});return}if(tt.kind==="theater"){const Oe=xV(vt.clientY,Ee.current,D.current,tt.sourceTheaterId);ye({...tt,currentY:vt.clientY,dragging:!0,dropIndex:Oe});return}const un=wV(vt.clientY,Se.current,D.current,tt.sourceGroupId);ye({...tt,currentY:vt.clientY,dragging:!0,dropIndex:un})},ot=vt=>{if(vt.pointerId!==ze)return;const tt=Re.current;if(ye(null),!tt?.dragging)return;if(tt.kind==="theater"){const Et=AV(Ee.current,tt.sourceTheaterId,tt.dropIndex);if(Et.join("\0")===Ee.current.join("\0"))return;Ge.current(Et);return}if(tt.kind==="group"){const Et=TV(Se.current,tt.sourceGroupId,tt.dropIndex);if(Et.join("\0")===Se.current.join("\0"))return;de.current(Et);return}const{sourceId:yn,sourceGroupId:un,dropIndex:Oe,dropGroupId:q}=tt,se=xe.current,Ae=dt.current;if(q!==un){const be=se.find(He=>He.groupId===q)?.entryIds??[];iv(CV(Ae,yn,Oe,be)),Ke.current(yn,q);return}const rt=se.find(Et=>Et.groupId===un)?.entryIds??[],jt=rt.indexOf(yn);if(jt===-1||Oe===jt)return;const Zt=kV(Ae,yn,Oe,rt);iv(Zt)},Wt=vt=>{vt.pointerId===ze&&ye(null)};return window.addEventListener("pointermove",re),window.addEventListener("pointerup",ot),window.addEventListener("pointercancel",Wt),()=>{window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",ot),window.removeEventListener("pointercancel",Wt)}},[ze]);const $t=(re,ot)=>{if(re.button!==0||re.target instanceof Element&&re.target.closest("button"))return;et(null),At();const vt=Zn.find(tt=>tt.operation.id===ot)?.operation.groupId??null;ye({kind:"chip",sourceId:ot,sourceGroupId:vt,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:Me.indexOf(ot),dropGroupId:vt})},Lt=(re,ot)=>{re.button===0&&(re.target instanceof Element&&re.target.closest("button")||ue.includes(ot)&&(et(null),At(),ye({kind:"group",sourceGroupId:ot,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:ue.indexOf(ot)})))},Ie=(re,ot)=>{if(re.button!==0||re.target instanceof Element&&re.target.closest("button"))return;const Wt=e.map(vt=>vt.id);Wt.includes(ot)&&(et(null),At(),ye({kind:"theater",sourceTheaterId:ot,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:Wt.indexOf(ot)}))},Ne=y.useCallback(re=>{re.preventDefault();const ot=re.clientX,Wt=T.width;it(!0);const vt=yn=>{const un=yn.clientX-ot;$V(Wt+un)},tt=()=>{it(!1),document.removeEventListener("pointermove",vt),document.removeEventListener("pointerup",tt),document.removeEventListener("pointercancel",tt)};document.addEventListener("pointermove",vt),document.addEventListener("pointerup",tt),document.addEventListener("pointercancel",tt)},[T.width]),Ye=()=>{V0(!N)},tn=()=>{Tt(null),et(null),we(!0)},gt=()=>{we(!1),$()},Wn=re=>{we(!1),Y(re)},Hs=re=>{re.defaultPrevented||(re.preventDefault(),et(null),Tt({anchor:{x:re.clientX,y:re.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},es=y.useCallback(()=>{const re=Le?.kind==="theater"?Le.returnFocus:null;et(null),re?.focus()},[Le]),ui=(re,ot)=>{re.stopPropagation(),ot!==t&&oe(ot),et(null);const Wt=re.currentTarget.getBoundingClientRect();Tt({anchor:{x:Wt.right+8,y:Wt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Ut=re=>{PV(re,!vn.includes(re))};return u.jsxs("aside",{className:`operations-side-bar ${N?"is-closed":"is-expanded"}`,ref:P,"data-sidebar-state":N?"closed":"expanded","data-resizing":qe?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${R}px`},inert:N,onContextMenu:Hs,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:tn,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[u.jsx(Y0,{}),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(XV,{})}),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:()=>sv("grid"),disabled:t===null,"aria-pressed":V&&O==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:u.jsx(YV,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>sv("columns"),disabled:t===null,"aria-pressed":V&&O==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:u.jsx(ZV,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>sv("rows"),disabled:t===null,"aria-pressed":V&&O==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:u.jsx(JV,{})})]})]}),!N&&_?u.jsx("p",{className:"side-bar-theater-error",children:_}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:D,"aria-label":"Operations",children:e.map((re,ot)=>{const Wt=re.id===t,vt=n.filter(se=>se.theaterId===re.id).length,tt=vn.includes(re.id),yn=le?.kind==="theater"&&le.sourceTheaterId===re.id&&le.dragging,un=yn&&le?.kind==="theater"?le.currentY-le.startY:0,Oe=le?.kind==="theater"&&le.dragging&&le.sourceTheaterId!==re.id&&le.dropIndex===ot,q=le?.kind==="theater"&&le.dragging&&le.sourceTheaterId!==re.id&&ot===e.length-1&&le.dropIndex===e.length;if(!Wt){const se=VK(re.id),Ae=QV({theaterId:re.id,operations:n,operationOrder:se.operationOrder,minimizedSet:new Set(se.minimized),activeOperationId:null,operationNotifications:c,operationStatus:cn,catalog:d,renderKindIcon:g});return u.jsx(eY,{theater:re,entries:tt?[]:Ae,groups:i.filter(st=>st.theaterId===re.id),collapsedGroups:new Set(se.collapsedGroups),operationAccent:se.operationAccent,operationCount:vt,collapsed:tt,dragging:yn,dropBefore:Oe,dropAfter:q,dragOffsetY:un,onSelectTheater:oe,onFocus:k,onToggleCollapsed:Ut,onOpenActions:(st,rt)=>{Tt(null),et({kind:"theater",theaterId:re.id,anchor:st,returnFocus:rt})},onOpenLaunch:ui,onContextMenu:st=>{Tt(null),et({kind:"theater",theaterId:re.id,anchor:st})},onPointerDragStart:Ie},re.id)}return u.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",Oe?"side-bar-theater-section--drop-before":"",q?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":re.id,children:[u.jsx(tN,{theater:re,operationCount:vt,active:!0,collapsed:tt,dragging:yn,dropTarget:Oe,dragOffsetY:un,onSelectTheater:oe,onToggleCollapsed:Ut,onOpenActions:(se,Ae)=>{Tt(null),et({kind:"theater",theaterId:re.id,anchor:se,returnFocus:Ae})},onOpenLaunch:ui,onContextMenu:se=>{Tt(null),et({kind:"theater",theaterId:re.id,anchor:se})},onPointerDragStart:Ie}),tt?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${re.label} operations`,children:An.map(se=>{const Ae=se.groupId!==null&&Qi.has(se.groupId),st=se.group?qa(se.group.color):null,rt=st?{"--grp-color":st}:void 0,jt=se.groupId?ue.indexOf(se.groupId):-1,Zt=le?.kind==="group"&&le.sourceGroupId===se.groupId&&le.dragging,Et=le?.kind==="group"&&le.dragging&&se.groupId!==null&&le.sourceGroupId!==se.groupId&&le.dropIndex===jt,be=le?.kind==="group"&&le.dragging&&se.groupId!==null&&le.sourceGroupId!==se.groupId&&jt===ue.length-1&&le.dropIndex===ue.length,He=[se.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Et?"side-bar-group-section--drop-before":"",be?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":se.groupId??"__ungrouped__",className:He,style:rt,children:[se.group?u.jsx(GL,{group:se.group,count:se.entries.length,collapsed:Ae,dragging:Zt,dragOffsetY:Zt?le.currentY-le.startY:0,dropTarget:Et,onToggle:ML,onContextMenu:(je,St)=>et({kind:"group",groupId:je,anchor:St}),onPointerDragStart:Lt}):ie&&se.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,Ae?null:u.jsx("ol",{className:["side-bar-group-chips",le?.kind==="chip"&&le.dragging&&le.dropGroupId===se.groupId&&le.dropGroupId!==le.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":se.groupId??"__ungrouped__","aria-label":se.group?se.group.name:"Ungrouped",children:se.entries.map(je=>{const St=Zn.indexOf(je),Qt=se.entries.indexOf(je),qn=W.operationAccent[je.operation.id]??ib(je.operation),Ai=qn?qa(qn):null;return u.jsx(qL,{entry:je,index:St,isCloseArmed:he===je.operation.id,accentValue:Ai,dragging:le?.kind==="chip"&&le.sourceId===je.operation.id&&le.dragging,dragOffsetY:le?.kind==="chip"&&le.sourceId===je.operation.id&&le.dragging?le.currentY-le.startY:0,dropTarget:le?.kind==="chip"&&le.dragging===!0&&le.dropGroupId===se.groupId&&le.dropGroupId===le.sourceGroupId&&le.dropIndex===Qt&&le.sourceId!==je.operation.id,onArmClose:Ti,onDisarmClose:At,onClose:w,onMinimize:x,onFocus:k,onKeyboardMove:G,onPointerDragStart:$t,onOpenAccent:(Si,qt)=>et({kind:"chip",operationId:Si,anchor:qt}),onRename:B},je.operation.id)})})]},se.groupId??"__ungrouped__")})})]},re.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Ne,onDoubleClick:Ye,"aria-hidden":"true"}),Bt?Va.createPortal(u.jsx(bL,{anchor:Bt.anchor,viewportBounds:Bt.viewportBounds,placement:"cursor",catalog:d,canLaunch:p,renderKindIcon:g,onLaunchKind:(re,ot)=>{Tt(null),b(re,ot)},onClose:()=>Tt(null)},`${Bt.anchor.x}:${Bt.anchor.y}`),document.body):null,Le?.kind==="chip"&&Rt?u.jsx(K2,{kind:"chip",operation:Rt,groups:i.filter(re=>re.theaterId===Rt.theaterId),accentKey:W.operationAccent[Rt.id]??ib(Rt),anchor:Le.anchor,actions:{onSetAccent:re=>A(Rt.id,re),onSetGroupId:re=>z(Rt.id,re),onCreateGroup:re=>E(Rt.theaterId,re,Rt.id)},onClose:()=>et(null)}):Le?.kind==="group"&&Mn?u.jsx(K2,{kind:"group-header",group:Mn,anchor:Le.anchor,actions:{onSetColor:re=>M(Mn.id,re),onRename:re=>j(Mn.id,re),onUngroupAll:()=>Q(Mn.id)},onClose:()=>et(null)}):Le?.kind==="theater"&&Ft?u.jsx(tY,{theater:Ft,groupCount:i.filter(re=>re.theaterId===Ft.id).length,anchor:Le.anchor,onCreateGroup:re=>{E(Ft.id,re),es()},onForgetTheater:()=>{L(Ft.id),es()},onClose:es}):null,u.jsx(wL,{open:Un,onCancel:gt,onConfirm:Wn}),N?null:u.jsx(BD,{})]})}function YV(){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 XV(){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 ZV(){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 JV(){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 eN(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(_=>_.groupId===p)?.entries.push(d):o.entries.push(d)}return[...r,o]}function QV({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 _=QL(d,f),g=_?p(f.pluginId,_):null;return{operation:f,active:r===f.id,minimized:i.has(f.id),notificationCount:o[f.id]?1:0,status:c[f.id],icon:g}})}function tN({theater:e,operationCount:t,active:n,collapsed:i,dragging:r,dropTarget:o,dragOffsetY:c,onSelectTheater:d,onToggleCollapsed:p,onOpenActions:f,onOpenLaunch:_,onContextMenu:g,onPointerDragStart:b}){const S=y.useRef(!1),w=["side-bar-theater-header",n?"is-active":"",r?"side-bar-theater-header--dragging":"",o?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),x=r?{"--drag-dy":`${Math.round(c)}px`}:void 0,k=M=>{M.preventDefault(),g(M.currentTarget.getBoundingClientRect())},A=M=>{M.target===M.currentTarget&&(M.key!=="Enter"&&M.key!==" "||(M.preventDefault(),d(e.id)))},B=M=>{M.target instanceof Element&&M.target.closest("button")||b(M,e.id)},z=()=>{r&&(S.current=!0)},E=()=>{if(S.current){S.current=!1;return}d(e.id)};return u.jsxs("div",{role:"button",tabIndex:0,className:w,style:x,onClick:E,onKeyDown:A,onContextMenu:k,onPointerDown:B,onPointerUp:z,"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:nN(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:M=>{M.stopPropagation(),p(e.id)},children:u.jsx(iY,{collapsed:i})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:M=>{M.stopPropagation(),f(M.currentTarget.getBoundingClientRect(),M.currentTarget)},children:u.jsx(sY,{})}),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:M=>_(M,e.id),children:u.jsx(Y0,{})})]})]})}function eY({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:c,dragging:d,dropBefore:p,dropAfter:f,dragOffsetY:_,onSelectTheater:g,onFocus:b,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:k,onPointerDragStart:A}){const B=eN(t,n),z=B.some(E=>E.group!==null);return u.jsxs("li",{className:["side-bar-theater-section",p?"side-bar-theater-section--drop-before":"",f?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[u.jsx(tN,{theater:e,operationCount:o,active:!1,collapsed:c,dragging:d,dropTarget:p,dragOffsetY:_,onSelectTheater:g,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:k,onPointerDragStart:A}),!c&&B.length>0?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:B.map(E=>{const M=E.groupId!==null&&i.has(E.groupId),j=E.group?qa(E.group.color):null;return u.jsxs("li",{className:E.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:j?{"--grp-color":j}:void 0,children:[E.group?u.jsx(GL,{group:E.group,count:E.entries.length,collapsed:M,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:H=>XK(e.id,H),onContextMenu:()=>{},onPointerDragStart:()=>{}}):z&&E.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,M?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":E.group?E.group.name:"Ungrouped",children:E.entries.map((H,U)=>{const Q=r[H.operation.id]??ib(H.operation),oe=Q?qa(Q):null;return u.jsx(qL,{entry:H,index:U,isCloseArmed:!1,accentValue:oe,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:b,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},H.operation.id)})})]},E.groupId??"__ungrouped__")})}):null]})}function tY({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}`),_=y.useRef(!1),g=y.useRef(null),b=y.useRef(null),[S,w]=y.useState(n.bottom+6);y.useLayoutEffect(()=>{const k=b.current?.getBoundingClientRect().height??0,A=window.innerHeight-k-8;w(Math.max(8,Math.min(n.bottom+6,A)))},[n,c]),y.useEffect(()=>{c&&g.current?.select()},[c]),y.useEffect(()=>{const k=A=>{A.key==="Escape"&&(A.preventDefault(),o())};return window.addEventListener("keydown",k),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",k),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const k=p.trim();k&&i(k)};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:k=>k.stopPropagation(),children:[c?u.jsx("input",{ref:g,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:k=>f(k.target.value),onCompositionStart:()=>{_.current=!0},onCompositionEnd:()=>{_.current=!1},onKeyDown:k=>{k.key==="Enter"&&!_.current&&(k.preventDefault(),x()),k.key==="Escape"&&(k.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(Y0,{})}),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(aY,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function nY(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+aE?t.scrollTop-=oE:e>n.bottom-aE&&(t.scrollTop+=oE)}function iY({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 sY(){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 Y0(){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 nN(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>rY(i)):iN(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function rY(e){return iN(e).slice(0,1)}function iN(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function aY(){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 sN=!1;const gb=new Set;function oY(){return y.useSyncExternalStore(lY,lE,lE)}function lE(){return sN}function rN(e){sN=cY(e)?e.fullscreen:!1;for(const t of gb)t()}function cE(){rN({fullscreen:!1})}function lY(e){return gb.add(e),()=>gb.delete(e)}function cY(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 aN="(display-mode: fullscreen)",uY=480,hY=480,dY=()=>!0;function fY(){return typeof window<"u"&&window.matchMedia(aN).matches}function pY(e=dY){const t=oY(),[n,i]=y.useState(fY),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,_]=y.useState(o),[g,b]=y.useState(!0),[S,w]=y.useState(!1),x=y.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]),k=y.useCallback(E=>{x(),!(!c.current||d.current)&&(p.current=setTimeout(()=>{p.current=null,c.current&&!d.current&&e()&&b(!1)},E))},[e,x]),A=y.useCallback(()=>{x(),c.current&&b(!0)},[x]),B=y.useCallback(()=>k(hY),[k]),z=y.useCallback(()=>{const E=!d.current;d.current=E,w(E),E&&(x(),b(!0))},[x]);return y.useEffect(()=>{const E=window.matchMedia(aN),M=()=>i(E.matches);return M(),E.addEventListener("change",M),()=>E.removeEventListener("change",M)},[]),y.useLayoutEffect(()=>(x(),_(o),b(!0),o&&!d.current&&k(uY),x),[x,o,k]),{isFullscreen:f,isVisible:g,isPinned:S,reveal:A,hideAfterLeave:B,togglePin:z}}function mY({operationsViewVisible:e}){const t=er(),n=dc(),i=XL(),r=H5(),o=_Y(),c=`${o}${o==="⌘"?"":"+"}B`,d=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,p=t.theaters.find(Se=>Se.id===t.activeTheaterId)??null,f=t.operations.find(Se=>Se.id===t.activeOperationId)??null,_=f?n.plugins.find(Se=>Se.id===f.pluginId):null,g=typeof f?.payload.cliId=="string"?f.payload.cliId:null,b=typeof f?.payload.cliLabel=="string"?f.payload.cliLabel:g,S=f?_?.operationKinds?.find(Se=>Se.type===f.type)??null:null,w=f&&_?.renderLaunchIcon?_.renderLaunchIcon({id:g??f.type,type:f.type,title:S?.title??f.type}):null,x=y.useRef(null),k=y.useRef(null),A=y.useRef(null),B=y.useRef(null),z=y.useRef({edge:!1,band:!1}),E=y.useRef(null),[M,j]=y.useState(!1),[H,U]=y.useState(null),[Q,oe]=y.useState(null),[Y,$]=y.useState(!1),[L,P]=y.useState(null),[D,T]=y.useState(null),R=()=>{U(null),oe(null),$(!1),P(null),T(null)},N=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",F=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",W=y.useCallback(()=>{const Se=document.activeElement;return!(Se instanceof Node&&(A.current?.contains(Se)||B.current?.contains(Se)))&&!z.current.edge&&!z.current.band},[]),O=pY(W),V=K0({currentTitle:f?.title??"",onCommit:Se=>{const Ee=Kx(E.current,t.activeOperationId);E.current=null,Ee&&g5(Ee,Se).then(()=>Xi(null)).then(fs).catch(()=>{})}});y.useEffect(()=>{!V.renaming||Kx(E.current,t.activeOperationId)||(E.current=null,V.cancel())},[V,t.activeOperationId]),y.useEffect(()=>{if(!M)return;const Se=new AbortController;return U(null),oe(null),$(!0),uO(Se.signal).then(U).catch(Ee=>{Se.signal.aborted||oe(Ee instanceof Error?Ee.message:"Unable to load environment details.")}).finally(()=>{Se.signal.aborted||$(!1)}),()=>Se.abort()},[M]),y.useEffect(()=>{if(!M)return;const Se=Ke=>{const de=Ke.target;!(de instanceof Node)||x.current?.contains(de)||k.current?.contains(de)||(j(!1),R())},Ee=Ke=>{Ke.key==="Escape"&&(j(!1),R(),x.current?.focus())};return document.addEventListener("pointerdown",Se),document.addEventListener("keydown",Ee),()=>{document.removeEventListener("pointerdown",Se),document.removeEventListener("keydown",Ee)}},[M]),y.useEffect(()=>{t.channel!=="local"&&(j(!1),U(null),oe(null),$(!1),P(null),T(null))},[t.channel]);const J=Se=>{navigator.clipboard.writeText(Se).then(()=>{P(Se),T(null)}).catch(()=>{T(Se),P(null)})},he=()=>{f&&(E.current=f.id,V.begin())},fe=()=>{W()&&O.hideAfterLeave()},le=Se=>{const Ee=Se.relatedTarget;(!(Ee instanceof Node)||!A.current?.contains(Ee)&&!B.current?.contains(Ee))&&!z.current.edge&&!z.current.band&&O.hideAfterLeave()},Te=()=>{z.current.edge=!0,O.reveal()},Re=()=>{z.current.edge=!1,fe()},$e=()=>{z.current.band=!0,O.reveal()},dt=()=>{z.current.band=!1,fe()},xe=O.isFullscreen&&!O.isVisible;return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:B,type:"button",className:`command-band-edge-reveal${O.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:Te,onPointerLeave:Re,onFocus:O.reveal,onBlur:le,onKeyDown:Se=>{Se.key==="Tab"&&O.reveal()}}),u.jsxs("header",{ref:A,className:`command-band${e?" is-operations":" is-utility"}${O.isFullscreen?" is-fullscreen":""}${O.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":xe||void 0,inert:xe||void 0,onPointerEnter:$e,onPointerLeave:dt,onFocus:O.reveal,onBlur:le,children:[u.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[u.jsx($D,{className:"command-band-brand"}),t.channel==="local"?u.jsxs("div",{className:"command-band-environment",children:[u.jsxs("button",{ref:x,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":M,onClick:()=>{R(),j(Se=>!Se)},children:[u.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),u.jsx("span",{className:"command-band-local-chip-label",children:N?F:"Local"})]}),M?u.jsx("div",{ref:k,children:u.jsx(gY,{environment:H,error:Q,loading:Y,copiedValue:L,copyFailedValue:D,desktopShell:N,onCopy:J})}):null]}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>V0(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,children:u.jsx(uE,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:L5,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(vY,{})})]}),u.jsx("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:nN(p.label)}),p.label]}),f?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),V.renaming?u.jsx("input",{ref:V.inputRef,className:"command-band-rename-input",value:V.draftTitle,"aria-label":`${f.title} 이름 변경`,onChange:Se=>V.setDraftTitle(Se.target.value),onKeyDown:V.handleKeyDown,onBlur:V.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:he,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}),u.jsxs("div",{className:"command-band-right",children:[O.isFullscreen?u.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:O.togglePin,"aria-label":"Pin command band","aria-pressed":O.isPinned,title:O.isPinned?"Unpin command band":"Pin command band",children:u.jsx(yY,{})}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:P5,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,children:u.jsx(uE,{side:"right"})}):null]})]})]})}function gY({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 _Y(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function vY(){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 uE({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 yY(){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"})})}const bY=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function SY({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 _=i.current;i.current=null,_?.focus?.()}},[e.onboardingOpen]),y.useEffect(()=>{if(!e.onboardingOpen)return;const _=g=>{t||(g.key==="Escape"?(g.preventDefault(),ou()):g.key==="Tab"&&wY(g,o.current),g.stopImmediatePropagation())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const d=()=>{n(!0)},p=()=>{n(!1)},f=async _=>{n(!1),T5();try{const g=await m5(_),b=await p5(g);A5(b)}catch(g){Dv(g instanceof Error?g.message:String(g))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:ou,"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(Zu,{ref:_=>{r.current=_},className:"commissioning-primary-action",to:"/operations",onClick:ou,children:"Go to Operations →"}):u.jsx("button",{ref:_=>{r.current=_},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(Zu,{className:"commissioning-secondary-link",to:"/operations",onClick:ou,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:ou,children:"Skip for now"})]})]}),u.jsx(wL,{open:t,onCancel:p,onConfirm:f})]})}function wY(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(bY)),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 xY="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",hE="operation-search-listbox",oN="__unassigned__";function CY({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),_=y.useMemo(()=>_D(e),[e]),g=y.useMemo(()=>MO(_,n),[_,n]),b=y.useMemo(()=>OO(g),[g]),S=y.useMemo(()=>v5(n),[n]),w=dE(r,g.length),x=g[w]?fE(g[w].operationId):void 0;if(y.useEffect(()=>{if(!e.operationSearchOpen)return;p.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const B=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>c.current?.focus(),0),()=>{document.body.style.overflow=B,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 B=g[w];B&&f.current.get(B.operationId)?.scrollIntoView({block:"nearest"})},[w,g,e.operationSearchOpen]),!e.operationSearchOpen)return null;const k=B=>{Qu(B),t("/operations"),i_()},A=B=>{if(B.key==="Escape"){B.preventDefault(),i_();return}if(B.key==="ArrowDown"||B.key==="ArrowUp"){B.preventDefault(),o(z=>dE(z+(B.key==="ArrowDown"?1:-1),g.length));return}if(B.key==="Enter"){const z=g[w];if(!z)return;B.preventDefault(),k(z.operationId);return}B.key==="Tab"&&AY(B,d.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:B=>{B.target===B.currentTarget&&i_()},children:u.jsxs("section",{ref:d,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:A,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(RY,{}),u.jsx("input",{ref:c,id:"operation-search-input",type:"search",value:n,onChange:B=>i(B.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":hE,"aria-activedescendant":x,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:hE,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:b.length>0?b.map(B=>{const z=EY(B.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:rv(B.theaterLabel,S)}),B.entries.map(E=>{const M=g.indexOf(E),j=M===w;return u.jsxs("button",{id:fE(E.operationId),ref:H=>{H?f.current.set(E.operationId,H):f.current.delete(E.operationId)},type:"button",className:`operation-search-result ${j?"is-active":""}`,role:"option","aria-selected":j,onMouseEnter:()=>o(M),onClick:()=>k(E.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:rv(E.operationName,S)}),u.jsx("small",{children:kY(E)})]}),u.jsx("span",{className:"operation-search-theater",children:rv(E.theaterLabel,S)})]},E.operationId)})]},B.theaterId??oN)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function dE(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function kY(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function EY(e){return`operation-search-heading-${lN(e??oN)}`}function fE(e){return`operation-search-option-${lN(e)}`}function lN(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function rv(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=TY(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 TY(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 AY(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(xY)).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 RY(){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 LY({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 cN(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await uN(t),hN(await t.json(),t.status)}async function NY(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await uN(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new en(n.status,"Invalid global settings mutation response");return{state:hN(i.state,n.status)}}async function uN(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 en(e.status,t)}function hN(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!MY(n.consoleStaticPort)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!OY(n.language))throw new en(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,theme:n.theme,uiFont:FO(n.uiFont),language:n.language}}function MY(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function OY(e){return e==="auto"||e==="en"||e==="ko"}const _b=new Set;let uh={loading:!1,state:null,savingField:null,error:null};function X0(){return y.useSyncExternalStore(jY,_p,_p)}function _p(){return uh}function DY(e){Do({loading:!1,state:e,error:null})}function jY(e){return _b.add(e),()=>{_b.delete(e)}}async function IY(e){Do({loading:!0,error:null});try{const t=await cN(e);Do({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Do({loading:!1,error:dN(t)})}}async function ic(e,t){if(uh.savingField!==null)return!1;const n=uh.state,i=n?{...n,[e]:t}:null;Do({state:i,savingField:e,error:null});try{const r=await NY({[e]:t});return Do({state:r.state,savingField:null,error:null}),!0}catch(r){return Do({state:n,savingField:null,error:dN(r)}),!1}}function Do(e){uh={...uh,...e};for(const t of _b)t()}function dN(e){return e instanceof Error?e.message:String(e)}let Yl=null,Fu=0;function fN(e){Yl?.abort();const t=new AbortController,n=++Fu;return Yl=t,YO(),hO({...e,signal:t.signal}).then(i=>{n===Fu&&XO(i)}).catch(i=>{t.signal.aborted||n!==Fu||ZO(i instanceof Error?i.message:String(i))}).finally(()=>{n===Fu&&(Yl=null)})}function BY(){Yl!==null&&(Yl.abort(),Yl=null,Fu+=1)}function pN(e,t=$Y()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function $Y(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const mN=[{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"}],av={id:"overview",label:"Overview"},PY={id:"all-updates",label:"All updates"},zY={id:"other-updates",label:"Other updates"};function gN(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=mN.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[av,PY]:t?[av,...n,zY]:[av,...n]}function HY(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 FY(e){const t=mN.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 UY(e,t){return gN(e).some(n=>n.id===t)}const WY=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Au=10;function qY({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=X0(),f=pN(p.state?.language??"auto"),_=e.selectedReleaseNoteKey??Rl(e.releaseNotes[0]?.version??"",0),g=e.releaseNotes.findIndex((U,Q)=>Rl(U.version,Q)===_),b=e.releaseNotes[g]??e.releaseNotes[0],S=b?Rl(b.version,g>=0?g:0):"",w=b?gN(b):[];y.useEffect(()=>{d("overview")},[S]),y.useEffect(()=>{b&&!UY(b,c)&&d("overview")},[c,b]),y.useEffect(()=>{const U=Q=>{const oe=Q.target instanceof HTMLElement?Q.target:null;if(!oe||oe.closest(".whatsnew-card"))return;const Y=n.current.filter($=>$!==oe&&$.isConnected);n.current=[...Y.slice(-4),oe]};return document.addEventListener("focusin",U,!0),()=>document.removeEventListener("focusin",U,!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 U=Q=>{Q.key==="Escape"?(Q.preventDefault(),Id()):YY(Q,r.current,d)?Q.preventDefault():Q.key==="Tab"&&VY(Q,r.current),Q.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",U,!0),()=>{window.removeEventListener("keydown",U,!0);const Q=t.current?.isConnected?t.current:[...n.current].reverse().find(oe=>oe.isConnected);t.current=null,Q?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const k=()=>{fN({force:!0,locale:f})},A=async U=>{await ic("language",U)},B=Math.max(1,Math.ceil(e.releaseNotes.length/Au)),z=Math.min(B-1,Math.floor((g>=0?g:0)/Au)),E=z*Au,M=e.releaseNotes.slice(E,E+Au),j=U=>{const Q=z+U;if(Q<0||Q>=B)return;const oe=Q*Au,Y=e.releaseNotes[oe];Y&&Xx(Rl(Y.version,oe))},H=U=>{d(U),requestAnimationFrame(()=>o.current.get(U)?.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:Id,"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:Id,"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:U=>Xx(U.currentTarget.value),children:M.map((U,Q)=>{const oe=E+Q;return u.jsxs("option",{value:Rl(U.version,oe),children:[U.version==="Unreleased"?"Unreleased":`v${U.version}`,U.date?` · ${U.date}`:""]},Rl(U.version,oe))})}),B>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>j(-1),disabled:z===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[z+1," / ",B]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>j(1),disabled:z>=B-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(U=>u.jsx("button",{type:"button",className:f===U?"is-active":"","aria-pressed":f===U,disabled:p.savingField==="language",onClick:()=>{A(U)},children:U==="en"?"EN":"한국어"},U))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:k,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),u.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(U=>u.jsx("button",{ref:Q=>{Q?o.current.set(U.id,Q):o.current.delete(U.id)},id:`whatsnew-tab-${U.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":U.id,"aria-selected":c===U.id,"aria-controls":"whatsnew-tab-panel",tabIndex:c===U.id?0:-1,onClick:()=>d(U.id),children:U.label},U.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:FY(b).map(U=>u.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>H(U.id),children:[u.jsx("span",{className:"whatsnew-overview-label",children:U.label}),u.jsxs("span",{className:"whatsnew-overview-count",children:[U.count," ",U.count===1?"update":"updates"]}),u.jsx("span",{className:"whatsnew-overview-summary",children:U.summary})]},U.id))}):HY(b,c).map((U,Q)=>u.jsx(GY,{section:U,index:Q},U.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Id,children:"Close"})})]})]})}function GY({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(KY,{item:r})},`${r.text}:${o}`))})]})}function KY({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 VY(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(WY)),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 YY(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 _N(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function XY(e,t=window){const n=i=>{if(!(I5()||_N(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 Up(e=()=>{}){return{...GE(e),notifications:{emit:n=>aD(n),dismiss:n=>fD(n)},status:{set:(n,i)=>rD(n,i),clear:n=>E5(n)}}}async function ZY(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await JY(t),QY(await t.json(),t.status).routes}async function JY(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 en(e.status,t)}function QY(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new en(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>eX(i,t))}}function eX(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 en(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const vb=new Set;let yb={loading:!1,state:null,error:null};function tX(){return y.useSyncExternalStore(nX,pE,pE)}function pE(){return yb}function nX(e){return vb.add(e),()=>{vb.delete(e)}}async function iX(e){ov({loading:!0,error:null});try{const t=await ZY(e);ov({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;ov({loading:!1,error:sX(t)})}}function ov(e){yb={...yb,...e};for(const t of vb)t()}function sX(e){return e instanceof Error?e.message:String(e)}function rX(){const e=tX(),[t,n]=y.useState(!0),i=y.useMemo(()=>lX(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return y.useEffect(()=>{const c=new AbortController;return iX(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(aX,{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 aX({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(oX,{entry:t},`${t.method}:${t.path}`))})]})}function oX({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 lX(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 cX=[{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)"]}],uX=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],hX=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],dX=1024,fX=65535,mE=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function pX(){const e=X0(),t=e.state,n=e.savingField!==null,[i,r]=y.useState("general"),o=Ps(),c=oc(),d=dc(),p=_X(d.plugins),f=vX(p),_=g=>{r(g),c({pathname:"/settings",search:g==="general"?"":`?section=${encodeURIComponent(g)}`})};return y.useEffect(()=>{const g=new AbortController;return IY(g.signal),()=>g.abort()},[]),y.useEffect(()=>{const g=new URLSearchParams(o.search).get("section"),b=new Set([...mE.map(w=>w.id),...p.map(w=>w.id)]),S=g&&b.has(g)?g:"general";r(S),g&&g!==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"}),mE.map(g=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${g.id===i?"is-active":""}`,"aria-pressed":g.id===i,onClick:()=>_(g.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:g.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:g.eyebrow})]},g.id)),p.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),f.map(g=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:g.pluginLabel}),g.sections.map(b=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>_(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))]},g.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:gX(i,t,n,p)},i)]})]})}function mX({render:e}){return u.jsx(u.Fragment,{children:e()})}function gX(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?u.jsx(Bf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:u.jsx(mX,{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(bX,{state:t,saving:n}),u.jsx(SX,{state:t,saving:n}),u.jsx(wX,{state:t,saving:n})]});case"backend-api":return u.jsx(rX,{})}}function _X(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:yX(t.id),sectionTitle:n.title,render:n.render})))}function vX(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 yX(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function bX({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(_p().savingField!==null)return;const o=n;Ff(r),ic("theme",r).then(c=>{c||Ff(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:cX.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(kX,{}):null})]},r.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function SX({state:e,saving:t}){const n=e?.uiFont??Uu,[i,r]=y.useState([]),[o,c]=y.useState(!0),[d,p]=y.useState(null);y.useEffect(()=>{const g=new AbortController;return q5({signal:g.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(b=>{g.signal.aborted||(r([]),p(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{g.signal.aborted||c(!1)}),()=>g.abort()},[]);const f=g=>{if(_p().savingField!==null)return;const b=n;Mv(g),ic("uiFont",g).then(S=>{S||Mv(b)})},_=g=>{const b=g.source==="builtin"?{source:"builtin",id:g.id,size:n.size}:{source:"system",familyName:g.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(Uu),children:"Reset to Fleet default"})]}),u.jsx(U5,{builtIns:Hf.map(({id:g,label:b,family:S,aliases:w,description:x})=>({id:g,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:b5(Uu),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:Ul,loading:o,error:d,disabled:!e||t,onSelectionChange:_,onSizeCommit:g=>f({...n,size:g})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function wX({state:e,saving:t}){const n=er();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(CX,{state:e,saving:t,consoleState:n}),u.jsx(xX,{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 xX({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:hX.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 CX({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(),_=Number(f),g=f.length>0,b=g&&gE(_),S=e.consolePortMode==="static"&&g&&!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:uX.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 k=Number(x.trim());gE(k)&&ic("consoleStaticPort",k)}}),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 gE(e){return Number.isInteger(e)&&e>=dX&&e<=fX}function kX(){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 EX(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function hh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function TX(e,t){return{...EX(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const _E=256,vE=176,lv=12,lf=220,vN="fleet-console.map.radarCollapsed";function AX({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,_]=y.useState(RX),g=zp();if(y.useEffect(()=>{if(g){p.current===null&&(p.current=f,_(!0));return}p.current!==null&&(_(p.current),p.current=null)},[f,g]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([T,R])=>({id:T,x:R.x,y:R.y,width:R.width,height:R.height})),...Object.entries(t).map(([T,R])=>({id:T,x:R.geometry.x,y:R.geometry.y,width:R.geometry.width,height:R.geometry.height}))];if(b.length===0)return null;const S=()=>{_(T=>{const R=!T;return g||LX(R),R})};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(MX,{})});const w=_E-lv*2,x=vE-lv*2,k={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let A=Math.min(k.x,...b.map(T=>T.x)),B=Math.min(k.y,...b.map(T=>T.y)),z=Math.max(k.x+k.width,...b.map(T=>T.x+T.width)),E=Math.max(k.y+k.height,...b.map(T=>T.y+T.height));A-=lf,B-=lf,z+=lf,E+=lf;const M=z-A,j=E-B,H=Math.min(w/M,x/j),U=(w-M*H)/2,Q=(x-j*H)/2,oe=T=>U+(T-A)*H,Y=T=>Q+(T-B)*H,$=T=>{const R=c.current?.getBoundingClientRect();if(!R)return;const N=T.clientX-R.left,F=T.clientY-R.top;o({x:A+(N-U)/H,y:B+(F-Q)/H})},L=T=>{T.stopPropagation(),d.current=!0,T.currentTarget.setPointerCapture(T.pointerId),$(T)},P=T=>{d.current&&(T.stopPropagation(),$(T))},D=T=>{d.current=!1;try{T.currentTarget.releasePointerCapture(T.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:_E,height:vE},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(NX,{})}),u.jsxs("div",{ref:c,className:"canvas-minimap-inner",style:{inset:lv},onPointerDown:L,onPointerMove:P,onPointerUp:D,onPointerCancel:D,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(T=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:oe(T.x),top:Y(T.y),width:Math.max(2,T.width*H),height:Math.max(2,T.height*H),...n?.[T.id]?{"--user-accent":n[T.id]}:{}}},T.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:oe(k.x),top:Y(k.y),width:k.width*H,height:k.height*H}})]})]})}function RX(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vN)==="true"}catch{return!1}}function LX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vN,String(e))}catch{}}function NX(){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 MX(){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 OX({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 DX=["n","ne","e","se","s","sw","w","nw"],cv=320,uv=200,jX=1500;function IX({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:_=!1,accentKey:g=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:k,onRename:A,onSetAccent:B,onGeometryChange:z,onGeometryCommit:E,onRenderHiddenFocus:M}){const j=y.useRef(null),H=y.useRef(null),U=y.useRef(null),Q=y.useRef(null),oe=y.useRef(null),Y=y.useRef(!1),[$,L]=y.useState(null),[P,D]=y.useState(!1),T=e.title,R=K0({currentTitle:e.title,onBegin:()=>{O()},onCommit:we=>{A(we),Y.current=!0}}),N=g?qa(g):null,F=["canvas-operation",t?"is-active":"",o?"is-minimized":"",c?"is-maximized":"",f?"is-top-edge":"",$X(r)].filter(Boolean).join(" ");y.useEffect(()=>()=>{oe.current!==null&&window.clearTimeout(oe.current)},[]),y.useEffect(()=>{if(R.renaming||!Y.current)return;Y.current=!1;const we=window.requestAnimationFrame(()=>H.current?.focus());return()=>window.cancelAnimationFrame(we)},[R.renaming]),y.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const we=$!==null;we&&L(null),(we||j.current?.contains(document.activeElement))&&M?.()},[$,d,M]);const W=()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null)},O=()=>{W(),D(!1)},V=()=>{W(),D(!0),oe.current=window.setTimeout(()=>{oe.current=null,D(!1)},jX)},J=we=>{O(),!(c||_)&&we.button===0&&(we.preventDefault(),we.stopPropagation(),S(),U.current={pointerId:we.pointerId,startX:we.clientX,startY:we.clientY,geometry:n,latest:n},we.currentTarget.setPointerCapture(we.pointerId))},he=we=>{if(c||_)return;const qe=U.current;if(!qe||qe.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const it={...qe.geometry,x:qe.geometry.x+(we.clientX-qe.startX)/i,y:qe.geometry.y+(we.clientY-qe.startY)/i};qe.latest=it,z(it)},fe=we=>{if(c||_){U.current=null;return}const qe=U.current;!qe||qe.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),U.current=null,we.currentTarget.releasePointerCapture(we.pointerId),E(qe.latest))},le=(we,qe)=>{c||_||(qe.preventDefault(),qe.stopPropagation(),S(),Q.current={direction:we,pointerId:qe.pointerId,startX:qe.clientX,startY:qe.clientY,geometry:n,latest:n},qe.currentTarget.setPointerCapture(qe.pointerId))},Te=we=>{if(c||_)return;const qe=Q.current;if(!qe||qe.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const it=BX(qe.geometry,qe.direction,(we.clientX-qe.startX)/i,(we.clientY-qe.startY)/i);qe.latest=it,z(it)},Re=we=>{if(c||_){Q.current=null;return}const qe=Q.current;!qe||qe.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),Q.current=null,we.currentTarget.releasePointerCapture(we.pointerId),E(qe.latest))},$e=we=>{we.stopPropagation()},dt=we=>{we.stopPropagation(),O()},xe=we=>{we.stopPropagation(),S()},Se=we=>{we.stopPropagation()},Ee=()=>{O();const we=typeof document<"u"?document.activeElement:null;we instanceof HTMLElement&&j.current?.contains(we)&&we.blur(),x()},Ke=()=>{O(),k?.()},de=we=>{O(),S(),L(we)},Ge=we=>{we.stopPropagation(),O(),S()},Le=()=>{if(!P){V();return}O(),w()},et=we=>{we.stopPropagation(),R.begin()},Bt=we=>{we.key!=="Enter"&&we.key!=="F2"||(we.preventDefault(),we.stopPropagation(),R.begin())},Tt=we=>{we.key==="Escape"&&(Y.current=!0),R.handleKeyDown(we)},Un={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"}:{},...N?{"--user-accent":N}:{}};return u.jsxs("article",{ref:j,className:F,style:Un,onPointerDown:S,"data-canvas-operation":!0,"data-focus-layer-target":p?"true":void 0,"aria-label":`Operation ${T}`,"aria-hidden":d||void 0,tabIndex:p?-1:void 0,inert:o||d?!0:void 0,children:[N?u.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!c&&!_?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:J,onPointerMove:he,onPointerUp:fe,onPointerCancel:fe,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:J,onPointerMove:he,onPointerUp:fe,onPointerCancel:fe,"data-canvas-blocker":!0,children:[N?u.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,R.renaming?u.jsx("input",{ref:R.inputRef,className:"canvas-operation-identity-input",value:R.draftTitle,"aria-label":`Rename operation ${T}`,onChange:we=>R.setDraftTitle(we.target.value),onKeyDown:Tt,onBlur:R.handleBlur,onPointerDown:dt}):u.jsx("button",{ref:H,type:"button",className:"canvas-operation-identity-name",onPointerDown:dt,onDoubleClick:et,onKeyDown:Bt,"aria-label":`Rename operation ${T}`,title:`${T} — Double-click, Enter, or F2 to rename`,children:T}),B?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:$e,onClick:we=>de(we.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${T}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:yE(r),"aria-hidden":"true"})}):u.jsx("span",{className:yE(r),onPointerDown:Ge,"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:$e,onClick:Ee,"aria-label":`Minimize operation ${T}`,title:"Minimize operation",children:u.jsx(PX,{})}),k?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:$e,onClick:Ke,"aria-label":c?`Restore operation ${T}`:`Maximize operation ${T}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(HX,{}):u.jsx(zX,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${P?"is-armed-close":""}`,onPointerDown:$e,onClick:Le,"aria-label":P?`Confirm close operation ${T}`:`Close operation ${T}`,title:P?"Confirm close":"Close operation",children:P?"Close?":u.jsx(FX,{})})]})]}),u.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:T}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:xe,onWheel:Se,"data-canvas-blocker":!0,children:b}),!c&&!_&&DX.map(we=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${we}`,onPointerDown:qe=>le(we,qe),onPointerMove:Te,onPointerUp:Re,onPointerCancel:Re,"data-canvas-blocker":!0,"aria-hidden":"true"},we)),$&&B?u.jsx(DK,{anchor:$,accentKey:g,onSelect:B,onClose:()=>L(null)}):null]})}function BX(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<cv&&(t.includes("w")&&(r-=cv-c),c=cv),d<uv&&(t.includes("n")&&(o-=uv-d),d=uv),{...e,x:r,y:o,width:c,height:d}}function $X(e){const t=Hp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function yE(e){const t=Hp(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 PX(){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 zX(){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 HX(){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 FX(){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 UX({rect:e,viewport:t}){const n=TX(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 WX=.25,qX=2,GX=200,KX=150,bE=5,VX=.0018;function YX({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 j=U=>{U.key==="Shift"&&x(!0),!XX(U.target)&&U.code==="Space"&&(U.preventDefault(),S(!0))},H=U=>{U.key==="Shift"&&x(!1),U.code==="Space"&&S(!1)};return window.addEventListener("keydown",j),window.addEventListener("keyup",H),()=>{window.removeEventListener("keydown",j),window.removeEventListener("keyup",H)}},[]);const k=j=>{if(t||SE(j.target)||j.button!==0&&j.button!==1)return;if(j.preventDefault(),n){c?.();return}const H=dv(j),U=j.shiftKey&&j.button===0&&!b?"create":"pan";p.current={pointerId:j.pointerId,mode:U,startScreen:H,currentScreen:H,startViewport:f.current},j.currentTarget.setPointerCapture(j.pointerId),U==="create"&&g(hv(H,H,f.current))},A=j=>{const H=p.current;if(!H||H.pointerId!==j.pointerId)return;j.preventDefault();const U=dv(j);if(p.current={...H,currentScreen:U},H.mode==="pan"){i({...H.startViewport,x:H.startViewport.x+U.x-H.startScreen.x,y:H.startViewport.y+U.y-H.startScreen.y});return}g(hv(H.startScreen,U,f.current))},B=j=>{M(j,!0)},z=j=>{M(j,!1)},E=j=>{if(t||SE(j.target))return;j.preventDefault();const H=dv(j),U=f.current,Q=ZX(U.zoom*Math.exp(-j.deltaY*VX),WX,qX),oe=hh(H,U);r({x:H.x-oe.x*Q,y:H.y-oe.y*Q,zoom:Q})},M=(j,H)=>{const U=p.current;if(!U||U.pointerId!==j.pointerId||(p.current=null,j.currentTarget.releasePointerCapture(j.pointerId),g(null),!H))return;const Q=Math.abs(U.currentScreen.x-U.startScreen.x),oe=Math.abs(U.currentScreen.y-U.startScreen.y);if(Q<bE&&oe<bE){d?.();return}if(U.mode!=="create")return;const Y=hv(U.startScreen,U.currentScreen,f.current),$={x:Y.x,y:Y.y,width:Math.max(Y.width,GX),height:Math.max(Y.height,KX)};o($,U.currentScreen)};return{rubberBand:_,spaceActive:b,shiftActive:w,onPointerDown:k,onPointerMove:A,onPointerUp:B,onPointerCancel:z,onWheel:E}}function hv(e,t,n){const i=hh(e,n),r=hh(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 dv(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function SE(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function XX(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function ZX(e,t,n){return Math.min(n,Math.max(t,e))}const JX="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",QX=560,eZ=360,tZ=12;function nZ({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:c,onFocus:d,onRename:p,onSetAccent:f}){const _=y.useRef(null),g=TL(),b=LL(),S=zp(),w=AL(),x=RL(),k=y.useRef(null),A=NL(),B=e.activeOperationId,[z,E]=y.useState(null),M=dc(),[j,H]=y.useState({width:0,height:0}),U=lZ(),Q=!e.activeTheaterId||e.addingTheater;y.useEffect(()=>{const de=_.current;if(!de||typeof ResizeObserver>"u")return;const Ge=()=>H({width:de.clientWidth,height:de.clientHeight});Ge();const Le=new ResizeObserver(Ge);return Le.observe(de),()=>Le.disconnect()},[]);const oe=YX({viewport:g.viewport,disabled:Q||S||x!==null,onViewportChange:ub,onZoom:OL,onCreate:de=>{if(E(null),e.activeTheaterId&&n){const Ge=cZ(t);if(!Ge)return;const Le={...rZ(de),zIndex:zo()};o(Ge.pluginId,Ge.kind,Le)}},consumePointerDown:z!==null,onConsumePointerDown:()=>{E(null)},onClick:sZ}),Y=(de,Ge)=>{const Le=z?.canvasPoint;E(null),Le&&r(de,Ge,Le)},$=de=>{if(de.target instanceof Element&&de.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;de.preventDefault();const Ge=_.current?.getBoundingClientRect();if(!Ge)return;const Le={x:de.clientX-Ge.left,y:de.clientY-Ge.top};E({anchor:Le,canvasPoint:hh(Le,g.viewport)})},L=new Set(A);y.useEffect(()=>{e.activeOperationId&&L.has(e.activeOperationId)&&Di(null)},[A,e.activeOperationId]);const P=Object.fromEntries(Object.entries(g.operations).filter(([de])=>!L.has(de))),D=(e.operations??[]).filter(de=>de.theaterId===e.activeTheaterId),T=M.operationKinds,N=w!==null&&D.some(de=>de.id===w&&!L.has(de.id))?w:null,F=x===null?void 0:D.find(de=>de.id===x&&!L.has(de.id)),W=F?T.find(de=>de.pluginId===F.pluginId&&de.type===F.type):void 0;x===null&&(k.current=null),F&&W?.companions?.length&&(k.current={operation:F,descriptor:W});const O=!F&&k.current?.operation.id===x?k.current:null,V=F??O?.operation,he=(W??O?.descriptor)?.companions??[],fe=V&&he.length>0?V.id:null,le=F&&W?.companions?.length?F.id:null,Te=V&&!D.some(de=>de.id===V.id)?[...D,V]:D,Re=Te.length>0;y.useEffect(()=>{if(x===null||le!==null)return;const de=setTimeout(()=>{k.current=null,Qs()},1500);return()=>clearTimeout(de)},[x,le]);const $e=R5(D,e.groups.filter(de=>de.theaterId===e.activeTheaterId),g.operationOrder,[]).filter(de=>!L.has(de.id)).map(de=>de.id),dt=S?JK({x:0,y:0,width:j.width,height:j.height},$e.length,void 0,void 0,void 0,void 0,b):[],xe=new Map($e.map((de,Ge)=>[de,dt[Ge]])),Se=N||fe||S?1:g.viewport.zoom,Ee=oZ(g.operations)+1,Ke=he.length+1;return u.jsxs("main",{className:`operations-canvas ${oe.spaceActive?"is-panning":""} ${oe.shiftActive?"is-creating":""} ${U?"is-glance":""} ${N?"is-panel-maximized":""} ${fe?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:oe.onPointerDown,onPointerMove:oe.onPointerMove,onPointerUp:oe.onPointerUp,onPointerCancel:oe.onPointerCancel,onWheel:oe.onWheel,onContextMenu:$,ref:_,tabIndex:-1,children:[u.jsx(OX,{viewport:g.viewport}),u.jsx("div",{style:{transform:N||fe||S?"none":`translate(${Math.round(g.viewport.x)}px, ${Math.round(g.viewport.y)}px) scale(${g.viewport.zoom})`},className:"operations-canvas-world",children:Te.map(de=>{const Ge=g.operations[de.id]??de.geometry??fv(de),Le=N===de.id,et=fe===de.id,Bt=(N!==null||fe!==null)&&!Le&&!et,Tt=xe.get(de.id),Un=Le?aZ(j,Ee):et?wE(j,0,Ke,Ee):Tt?{...Ge,...Tt}:Ge,we=!Le&&!et&&!Tt&&g.viewport.y+Un.y*Se<tZ*Se;return uZ(de,{active:B===de.id,geometry:Un,topEdge:we,operationKindRegistry:T,status:e.operationStatus[de.id],theme:e.activeTheme,viewportZoom:Se,minimized:L.has(de.id),maximized:Le,companion:et,companions:et?he:[],companionGeometries:et?he.map((qe,it)=>wE(j,it+1,Ke,Ee)):[],formation:S,focusLayerHidden:Bt,onRenderHiddenFocus:()=>{const qe=_.current?.querySelector("[data-focus-layer-target='true']");if(qe){qe.focus();return}_.current?.focus()},accentKey:g.operationAccent[de.id]??CE(de),onActivate:()=>{Di(de.id),!Le&&!et&&!S&&hb(de.id,g.operations[de.id]??de.geometry??fv(de))},onClose:()=>{e.activeOperationId===de.id&&Di(null),N===de.id&&Ka(),fe===de.id&&Qs(),c(de.id)},onMinimize:()=>{e.activeOperationId===de.id&&Di(null),DL(de.id)},onMaximize:()=>{Le?Ka():(Di(de.id),z0(de.id))},onRename:qe=>{p(de.id,qe)},onSetAccent:qe=>{f(de.id,qe)},onGeometryChange:qe=>{!Le&&!et&&!S&&hb(de.id,qe)},onGeometryCommit:qe=>{!Le&&!et&&!S&&dZ(de.id,Ga().operations[de.id]??qe)}})})}),Re?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?JX:"Add a Theater from the top bar to start operations."})]}),oe.rubberBand?u.jsx(UX,{rect:oe.rubberBand,viewport:g.viewport}):null,z?u.jsx(bL,{anchor:z.anchor,viewportBounds:iZ(_.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:Y,onClose:()=>E(null)},`${z.anchor.x}:${z.anchor.y}`):null,u.jsx(AX,{operations:P,pluginOperations:Object.fromEntries(D.filter(de=>!L.has(de.id)).map(de=>[de.id,{theaterId:de.theaterId,geometry:g.operations[de.id]??de.geometry??fv(de)}])),accents:Object.fromEntries(D.flatMap(de=>{const Ge=g.operationAccent[de.id]??CE(de),Le=Ge?qa(Ge):null;return Le?[[de.id,Le]]:[]})),viewport:g.viewport,canvasSize:j,onJump:de=>ub({x:j.width/2-de.x*g.viewport.zoom,y:j.height/2-de.y*g.viewport.zoom,zoom:g.viewport.zoom})})]})}function iZ(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function sZ(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Di(null)}function rZ(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function fv(e){return e.geometry??{x:0,y:0,width:QX,height:eZ,zIndex:0}}function aZ(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function wE(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 oZ(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function lZ(){const[e,t]=y.useState(!1),n=y.useRef(new Set);return y.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=d=>{!xE(d)||d.repeat||d.ctrlKey||d.metaKey||_N()||(n.current.add(d.code),t(!0))},o=d=>{xE(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 xE(e){return e.code==="AltLeft"||e.code==="AltRight"}function cZ(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 CE(e){return typeof e.accent=="string"?e.accent:null}function uZ(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=Up(()=>{Xi(null).then(fs).catch(()=>{})}),o=c=>{c?(Di(e.id),jL(e.id)):iV()};return u.jsxs(y.Fragment,{children:[u.jsx(IX,{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(Bf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(kE,{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(hZ,{descriptor:c,geometry:t.companionGeometries[d],children:u.jsx(Bf,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:u.jsx(kE,{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 kE({active:e,capabilities:t,geometry:n,operation:i,theme:r,viewportZoom:o,onActivate:c,onClose:d,onGeometryChange:p,onRequestCompanions:f,companionsOpen:_,render:g}){return g({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:_})}function hZ({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 dZ(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function yN(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 bN(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function SN(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 bb(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 wN(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const fZ={ended:"Ended","input-waiting":"Waiting for input"},pZ={id:"alerts",title:"Alerts",icon:()=>u.jsx(gZ,{}),render:()=>u.jsx(mZ,{})};function mZ(){const e=er(),t=oc(),[n,i]=y.useState(!1),r=y.useMemo(()=>bN(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=yN(e),c=SN(r,o).hidden,d=wN(c,e.notificationPreferences),p=bb(d),f=bb(c),_=Sb(p,"input-waiting"),g=Sb(p,"ended"),b=p.length===0,S=y.useCallback(w=>{Qu(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:[_>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:_}):null,g>0?u.jsx("span",{className:"notification-tally is-ended",children:g}):null,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(bZ,{})})]}),n?u.jsx(_Z,{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:fZ[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 gZ(){const e=er();z5();const t=y.useMemo(()=>bN(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=yN(e),i=SN(t,n).hidden,r=wN(i,e.notificationPreferences),o=bb(r),c=o.reduce((f,_)=>f+_.notifications.length,0),d=Sb(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(yZ,{}),c>0?u.jsx("span",{className:"alerts-icon-badge",children:c}):null]})}function _Z({groups:e}){const t=er(),n=vZ(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=>pD(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=>mD(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&&gD(i.theaterId)}}),u.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function vZ(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 Sb(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function yZ(){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 bZ(){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 Z0 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function SZ(e,t){const i=new URLSearchParams().toString();return Xa(Fn(e,`/search${i?`?${i}`:""}`))}async function wZ(e,t,n){return Xa(Fn(e,`/entry/${encodeURIComponent(t)}`))}async function xN(e,t="pending"){return Xa(Fn(e,`/drydock?status=${encodeURIComponent(t)}`))}async function xZ(e,t){return Xa(Fn(e,`/drydock/${encodeURIComponent(t)}`))}async function CZ(e){return Xa(Fn(e,"/schema"))}async function kZ(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Xa(Fn(e,n))}async function EZ(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),BZ(Fn(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function TZ(e){return Xa(Fn(e,"/conflicts"))}async function AZ(e,t){return Xa(Fn(e,`/conflicts/${encodeURIComponent(t)}`))}async function RZ(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),CN(Fn(e,`/cowork/options?${i}`))}async function EE(e,t,n){return Za(Fn(e,"/cowork/sessions"),{entryId:t,...n})}async function LZ(e,t){try{return await CN(Fn(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof Z0&&n.status===404)return null;throw n}}async function pv(e,t,n){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function NZ(e,t,n){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function TE(e,t,n){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function MZ(e,t,n){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function OZ(e,t){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function DZ(e,t,n){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function jZ(e,t){return Za(Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function IZ(e,t,n,i){const r=new EventSource(`${Fn(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=c=>{try{const d=JSON.parse(c.data);if(!$Z(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 Fn(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 EN(e,t));return t.json()}async function BZ(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 EN(e,n));return n.json()}async function CN(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await kN(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 kN(n);return n.json()}async function kN(e){const t=await e.json().catch(()=>null);return new Z0(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function $Z(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 EN(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const wb=new Set;let Lf=0;const Xl={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function jl(){return Xl}function TN(e){return wb.add(e),()=>wb.delete(e)}function AE(e){Lf+=1,Nf({currentWorkspaceId:e,schemaCatalog:null})}async function vp(){const e=Xl.currentWorkspaceId,t=Lf;Nf({loading:!0,error:null});try{const[n,i,r]=await Promise.all([SZ(e),xN(e,"pending").catch(()=>null),CZ(e).catch(()=>null)]);if(Xl.currentWorkspaceId!==e||Lf!==t)return;Nf({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(Xl.currentWorkspaceId!==e||Lf!==t)return;Nf({loading:!1,error:PZ(n)})}}function Nf(e){Object.assign(Xl,e);for(const t of wb)t(Xl)}function PZ(e){return e instanceof Error?e.message:String(e)}const zZ=120;function ji(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function HZ(e,t){if(!t)return ji(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?ji(e):ji(e.slice(0,n))+`<mark>${ji(e.slice(n,n+t.length))}</mark>`+ji(e.slice(n+t.length))}function FZ(e){return`<span class="codex-nav-tag">${ji(e)}</span>`}function UZ(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(FZ).join(""),o=ji(e.status??"current"),c=ji(e.updated??"");return`<button
|
|
230
|
+
class="codex-nav-entry${n?" is-current":""}"
|
|
231
|
+
data-entry-id="${ji(e.id)}"
|
|
232
|
+
type="button"
|
|
233
|
+
${n?'aria-current="page"':""}
|
|
234
|
+
title="${ji(e.title)}"
|
|
235
|
+
>
|
|
236
|
+
<span class="t">${HZ(e.title,i?"":t)}</span>
|
|
237
|
+
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
+
<span class="meta">${o} · ${c}</span>
|
|
239
|
+
</button>`}function WZ(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 qZ(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 _(w){if(e.querySelectorAll("[data-mode]").forEach(k=>k.setAttribute("aria-selected",String(k.dataset.mode===r))),c.hidden=r==="schema",r==="schema"){const k=w.schemaCatalog;p.textContent=`Schema · ${k?.templates.length??0} templates`,d.innerHTML=k?`
|
|
268
|
+
<button class="codex-nav-entry" type="button" ${k.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${k.schema.exists?ji(k.schema.ref):"Unavailable"}</span></button>
|
|
269
|
+
${k.templates.map(A=>`<button class="codex-nav-entry" type="button" data-template-id="${ji(A.id)}"><span class="t">${ji(A.id)}</span><span class="meta">${ji(A.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',f.textContent=String(w.pendingPatchCount);return}const x=WZ(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">${ji(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(k=>UZ(k,n,k.id===i)).join("")}function g(w){const x=w.target;if(!(x instanceof Element))return;const k=x.closest("[data-mode]");if(k?.dataset.mode==="entries"||k?.dataset.mode==="schema"){r=k.dataset.mode,_(jl());return}if(x.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const B=x.closest("[data-template-id]");if(B?.dataset.templateId){t.onRequest({kind:"schema",templateId:B.dataset.templateId});return}const z=x.closest("[data-entry-id]");if(z?.dataset.entryId){i=z.dataset.entryId,_(jl()),t.onRequest({kind:"entry",id:i});return}const E=x.closest("[data-action]");if(E?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(E?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=c.value,_(jl())},zZ)}e.addEventListener("click",g),c.addEventListener("input",b);const S=TN(w=>_(w));return _(jl()),{destroy(){S(),e.removeEventListener("click",g),c.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,c&&(c.value=""),_(jl())}}}function GZ(e,t){t.initialTheaterId&&AE(t.initialTheaterId);const n=qZ(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=TN(()=>{});vp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){AE(o),vp(),n.setTheater(o)}}}function _t(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function mr(e){return _t(e).replace(/"/g,""")}function KZ(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${_t(i)}</span>`).join(""),n=YZ(e);return`
|
|
270
|
+
<div class="meta-chips">
|
|
271
|
+
${t}
|
|
272
|
+
${n}
|
|
273
|
+
<span class="chip">Updated ${_t(VZ(e.updated))}</span>
|
|
274
|
+
</div>
|
|
275
|
+
`}function AN(e){return e.map(t=>`<span class="chip chip-muted">${_t(t)}</span>`).join("")}function VZ(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function YZ(e){const t=XZ(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${mr(t.title)}">${_t(t.label)}</span>`:""}function XZ(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 ZZ="active";function mv(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${mr(t.id)}" data-toc-id="${mr(t.id)}">${_t(t.text)}</a>`).join("")}function RE(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 g of f){const b=g.target instanceof HTMLElement?g.target.id:"";b&&(g.isIntersecting?d.add(b):d.delete(b))}const _=JZ(o,d)??QZ(o,c)??o[0]?.id??null;LE(i,_)},{root:c,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return LE(i,o[0]?.id??null),()=>p.disconnect()}function JZ(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function QZ(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 LE(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(ZZ,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function yp(e){return`/entry/${encodeURIComponent(e)}`}const RN=1<<20;function eJ(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>RN)return i.map((_,g)=>({text:_,changed:n[g]!==_}));const c=Array.from({length:r},()=>new Uint16Array(o));for(let _=n.length-1;_>=0;_-=1)for(let g=i.length-1;g>=0;g-=1)c[_][g]=n[_]===i[g]?c[_+1][g+1]+1:Math.max(c[_+1][g],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 tJ(e,t){const n=NE(e),i=NE(t),r=n.length+1,o=i.length+1,c=[];if(r*o>RN){const _=Math.max(n.length,i.length);for(let g=0;g<_;g+=1){const b=n[g],S=i[g];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 ME(c)}const d=Array.from({length:r},()=>new Uint16Array(o));for(let _=n.length-1;_>=0;_-=1)for(let g=i.length-1;g>=0;g-=1)d[_][g]=n[_]===i[g]?d[_+1][g+1]+1:Math.max(d[_+1][g],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 ME(c)}function NE(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 ME(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 LN="fleet.codex.cowork.settings",nJ="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",iJ=32;function sJ(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},c=cJ(),d=[],p="",f="",_="",g=null,b="",S="idle",w=!1,x=null,k=!1,A=!1,B=!1,z=null,E=!1,M=!1,j=!1,H=null,U="",Q="",oe="published",Y=null,$=null;const L=()=>n?((!$||$.base!==n.baseDraft||$.draft!==n.draft)&&($={base:n.baseDraft,draft:n.draft,lines:eJ(n.baseDraft,n.draft)}),$.lines):[],P=e.body.innerHTML,D=document.createElement("div");D.className="cowork-anchor";const T=document.createElement("div");T.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(D,T,R);const N=()=>{if(t)return;const ie=!!n&&n.state!=="closed",ue=ie?E?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(ue!==oe){if(oe=ue,!ie){e.body.innerHTML=P;return}e.body.innerHTML=E?`<div class="cowork-rendered-diff" aria-label="Draft changes">${aJ(_v(n.baseDraft),_v(n.draft))}</div>`:Bs(_v(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:Be=>yp(Be)}).html}},F=()=>{if(t)return;if(!x){D.innerHTML="";return}const ie=e.article.getBoundingClientRect().width||0,ue=k?Math.min(340,ie*.86)/2+8:56,Be=Math.min(Math.max(x.left,ue),Math.max(ie-ue,ue)),Me=`style="top:${x.top}px;left:${Be}px"`;D.innerHTML=k?`<div class="cowork-composer" ${Me} role="dialog" aria-label="Add a comment">
|
|
286
|
+
<blockquote>${_t(DE(x.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" ${Me}><span aria-hidden="true">✦</span>Comment</button>`,k&&D.querySelector(".cowork-composer-input")?.focus()},W=()=>{if(t)return;const ie=!!n&&n.state!=="closed"&&n.state!=="applied";T.classList.add("is-open");const ue=j||ie&&n.state==="running"&&S!=="complete"&&S!=="stopped";e.body.classList.toggle("is-cowork-running",ue);const Be=ie&&n.baseDraft!==n.draft,Me=Be?L().filter(Fe=>Fe.changed).length:0;Te(`
|
|
293
|
+
${O(ue)}
|
|
294
|
+
${A?Re():""}
|
|
295
|
+
${B?$e():""}
|
|
296
|
+
${Be&&!ue?dt(Me):""}
|
|
297
|
+
<div class="cowork-bar${ue?" is-running":""}" data-cowork-form>
|
|
298
|
+
${ue?'<span class="cowork-glow" aria-hidden="true"></span>':""}
|
|
299
|
+
<button type="button" class="cowork-chip${A?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${A}" aria-label="Annotations" ${ue?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
|
|
300
|
+
<input class="cowork-dock-input" name="prompt" value="${mr(U)}" placeholder="${d.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${ue?"disabled":""}>
|
|
301
|
+
<button type="button" class="cowork-chip cowork-chip--config${B?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${B}" aria-label="Agent settings" ${ue?"disabled":""}>${_t(c.cli||"agent")}</button>
|
|
302
|
+
${ue?'<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
|
+
${Q?`<p class="cowork-error" role="alert">${_t(Q)}</p>`:""}`)},O=ie=>{if(!(ie||S!=="idle"))return"";const Be=ie?"running":S,Me=ie?"Editing entry":S==="complete"?"Revision complete":"Revision stopped",Fe=!!(b||p||ie);return`<section class="cowork-revision-stream is-${Be}${w?" is-collapsed":""}" aria-label="Cowork revision stream">
|
|
305
|
+
${ie?'<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>${Me}</small></span>${Fe?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!w}" aria-label="${w?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
|
|
307
|
+
${Fe?`<div class="cowork-revision-content" aria-hidden="${w}"><div class="cowork-revision-content-inner">
|
|
308
|
+
${b||p?`<div class="cowork-revision-body">
|
|
309
|
+
${b?`<p class="cowork-revision-instruction">${_t(b)}</p>`:""}
|
|
310
|
+
${p?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${_}</div></div>`:""}
|
|
311
|
+
</div>`:""}
|
|
312
|
+
${ie?'<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>`},V=()=>{g!==null&&window.clearTimeout(g),g=null},J=()=>{f!==p&&(f=p,_=p?Bs(p).html:"")},he=()=>{J();const ie=T.querySelector(".cowork-revision-output");if(!ie){W();return}ie.innerHTML=_;const ue=ie.closest(".cowork-revision-output-scroll");ue&&(ue.scrollTop=ue.scrollHeight)},fe=()=>{g===null&&(g=window.setTimeout(()=>{g=null,t||he()},iJ))},le=()=>{V(),J()},Te=ie=>{if(ie===Y)return;Y=ie;const ue=document.activeElement,Be=ue instanceof HTMLInputElement&&ue.name==="prompt"&&T.contains(ue)?"prompt":ue instanceof HTMLTextAreaElement&&ue.dataset.coworkComment&&T.contains(ue)?`comment:${ue.dataset.coworkComment}`:null;if(T.innerHTML=ie,Be==="prompt"){const Me=T.querySelector(".cowork-dock-input");Me?.focus(),Me?.setSelectionRange(Me.value.length,Me.value.length)}else if(Be?.startsWith("comment:")){const Me=T.querySelector(`[data-cowork-comment="${CSS.escape(Be.slice(8))}"]`);Me?.focus(),Me?.setSelectionRange(Me.value.length,Me.value.length)}},Re=()=>`
|
|
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(ie=>`
|
|
317
|
+
<article class="cowork-card is-${ie.status}">
|
|
318
|
+
<blockquote>${_t(DE(ie.quote,160))}</blockquote>
|
|
319
|
+
<textarea data-cowork-comment="${mr(ie.id)}" aria-label="Comment" placeholder="Add a comment" ${ie.status==="sent"?"disabled":""}>${_t(ie.comment)}</textarea>
|
|
320
|
+
<footer><span class="cowork-card-status">${ie.status==="sent"?"Sent":ie.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${mr(ie.id)}" aria-label="Delete annotation">×</button></footer>
|
|
321
|
+
</article>`).join("")}
|
|
322
|
+
</div>`,$e=()=>`
|
|
323
|
+
<div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
|
|
324
|
+
${gv("CLI","cli",o.clis,c.cli)}${gv("Model","model",o.models,c.model)}${gv("Effort","effort",o.efforts,c.effort)}
|
|
325
|
+
</div>`,dt=ie=>z?`<div class="cowork-review is-confirm"><span>${z==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${z==="discard"?" cowork-solid--danger":""}" data-cowork-action="${z==="apply"?"apply-confirm":"discard-confirm"}">${z==="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>${ie>0?`${ie} changed line${ie===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${E?"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>`,xe=()=>{if(!t){for(const ie of[...e.body.querySelectorAll("mark.cowork-mark")]){const ue=ie.parentNode;if(ue){for(;ie.firstChild;)ue.insertBefore(ie.firstChild,ie);ue.removeChild(ie)}}if(e.body.normalize(),!E)for(const ie of d)ie.quote&&Se(ie)}},Se=ie=>{const ue=[],Be=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let Rt=Be.nextNode();Rt;Rt=Be.nextNode())ue.push(Rt);let Me="";const Fe=[];for(const Rt of ue)Fe.push(Me.length),Me+=Rt.data;const At=Me.indexOf(ie.quote);if(At<0)return;const Ti=At+ie.quote.length;for(let Rt=0;Rt<ue.length;Rt+=1){const Mn=Fe[Rt],Ft=Mn+ue[Rt].data.length,G=Math.max(At,Mn),pe=Math.min(Ti,Ft);if(G>=pe)continue;const ye=document.createRange();ye.setStart(ue[Rt],G-Mn),ye.setEnd(ue[Rt],pe-Mn);const ze=document.createElement("mark");ze.className="cowork-mark",ze.dataset.annotationId=ie.id;try{ye.surroundContents(ze)}catch{}}},Ee=ie=>{const ue=d.find(At=>At.id===ie.dataset.annotationId);if(!ue){R.hidden=!0;return}R.textContent=ue.comment.trim()||"No comment yet",R.hidden=!1;const Be=ie.getBoundingClientRect(),Me=e.article.getBoundingClientRect(),Fe=R.offsetWidth/2+8;R.style.top=`${Math.max(Be.top-Me.top-6,0)}px`,R.style.left=`${Math.min(Math.max(Be.left+Be.width/2-Me.left,Fe),Math.max(Me.width-Fe,Fe))}px`},Ke=()=>{N(),W(),xe()},de=async()=>{o=await RZ(e.theaterId,c.cli,c.model||void 0);const ie=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",ue=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:ie,effort:o.efforts.includes(c.effort)?c.effort:ue},vv(c)},Ge=async ie=>{n=ie;const ue=ie.annotations.map(oJ),Be=new Set(ue.map(Me=>Me.id));d=[...ue,...d.filter(Me=>!Be.has(Me.id))],(ie.cli||ie.model||ie.effort)&&(c={cli:ie.cli??c.cli,model:ie.model??c.model,effort:ie.effort??c.effort},vv(c));try{await de()}catch{}if(!t){if(n&&(n.cli!==c.cli||n.model!==c.model||n.effort!==c.effort))try{n=await pv(e.theaterId,n.id,c)}catch{}t||(et(),Ke())}},Le=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const ie=await EE(e.theaterId,e.entryId,c);return await Ge(ie),ie};W(),de().then(W).catch(()=>{}),(async()=>{try{const ie=await LZ(e.theaterId,e.entryId);!t&&ie&&await Ge(ie)}catch{}})();function et(){n&&(i?.(),i=IZ(e.theaterId,n.id,r,(ie,ue)=>{if(ue&&ue<=r)return;r=Math.max(r,ue);const Be=n?.state==="running";if(ie.session&&(n=ie.session),ie.type==="transcript"&&ie.text&&n?.state==="running"){p=S==="running"?p+ie.text:ie.text,S="running",fe();return}ie.type==="done"&&(le(),(!H?.cancelled||H.submitted)&&(S=Be||M||S==="stopped"||!!p||!!b?"complete":"idle",d=d.map(Fe=>Fe.status==="sent"?{...Fe,status:"done"}:Fe),M&&(M=!1,n&&n.baseDraft!==n.draft&&(E=!0)))),(ie.type==="error"||ie.type==="session"&&Be&&n?.state!=="running")&&(le(),S="stopped",M=!1,d=d.map(Me=>Me.status==="sent"?{...Me,status:"pending"}:Me)),ie.type==="error"&&ie.text&&(Q=ie.text),Ke()}))}async function Bt(ie,ue){d=[...d,{id:lJ(),quote:ie,comment:ue,status:"pending"}],x=null,k=!1,F(),W(),xe();try{await Le(),await it(()=>NZ(e.theaterId,n.id,ie)),await Un()}catch{}}async function Tt(ie){d=d.filter(ue=>ue.id!==ie),W(),xe(),R.hidden=!0;try{await Un()}catch{}}async function Un(){n&&await it(()=>TE(e.theaterId,n.id,d.map(OE)))}async function we(){if(j||n?.state==="running")return;const ie=d.filter(Fe=>Fe.status!=="done"),ue=U.trim(),Be=ue||(ie.length?nJ:"");if(!Be)return;const Me={cancelled:!1,submitted:!1};H=Me,j=!0,d=ie.map(Fe=>({...Fe,status:"sent"})),V(),p="",f="",_="",b=ue,S="running",w=!1,U="",A=!1,B=!1,W(),xe();try{if(await Le(),Me.cancelled||H!==Me||(await it(()=>TE(e.theaterId,n.id,d.map(OE))),Me.cancelled||H!==Me))return;Me.submitted=!0,await it(()=>MZ(e.theaterId,n.id,Be)),M=!0}catch{!Me.cancelled&&H===Me&&(M=!1,S="idle",d=d.map(Fe=>Fe.status==="sent"?{...Fe,status:"pending"}:Fe))}finally{!Me.cancelled&&H===Me&&(j=!1,H=null,W())}}async function qe(){if(!n)return;const ie=n.id;try{Q="",await jZ(e.theaterId,ie)}catch(ue){Q=ue instanceof Error?ue.message:"Cowork request failed.",W();return}i?.(),i=null,r=0,d=[],V(),p="",f="",_="",b="",S="idle",w=!1,z=null,E=!1;try{await Ge(await EE(e.theaterId,e.entryId,c))}catch{n=null,Ke()}}async function it(ie){try{Q="",n=await ie(),Ke()}catch(ue){throw Q=ue instanceof Z0&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(ue.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":ue instanceof Error?ue.message:"Cowork request failed.",Ke(),ue}}const Ei=ie=>{if(k||n?.state==="running"||ie.target instanceof Node&&D.contains(ie.target))return;const ue=window.getSelection(),Be=ue?.toString().trim()??"";if(!Be||!ue||ue.rangeCount===0||!e.body.contains(ue.anchorNode))return;const Me=ue.getRangeAt(0).getBoundingClientRect(),Fe=e.article.getBoundingClientRect();x={quote:Be,top:Me.bottom-Fe.top+8,left:Math.min(Math.max(Me.left+Me.width/2-Fe.left,0),Math.max(Fe.width,0))},F()},vn=ie=>{if(ie.target instanceof Element){if(ie.target.closest(".cowork-pill")){ie.preventDefault();return}!D.contains(ie.target)&&x&&(x=null,k=!1,F())}},cn=ie=>{if(ie.target instanceof Element&&ie.target.closest(".cowork-revision-output")){ie.stopPropagation();return}if(ie.key==="Escape"){x||k?(x=null,k=!1,F()):(A||B||z)&&(A=!1,B=!1,z=null,W());return}const ue=ie.target;ie.key==="Enter"&&!ie.shiftKey&&ue instanceof HTMLTextAreaElement&&ue.classList.contains("cowork-composer-input")&&(ie.preventDefault(),bi()),ie.key==="Enter"&&ue instanceof HTMLInputElement&&ue.name==="prompt"&&(ie.preventDefault(),we())},bi=()=>{const ie=D.querySelector(".cowork-composer-input")?.value.trim()??"";x&&Bt(x.quote,ie)},zs=ie=>{if(!(ie.target instanceof Element))return;const ue=ie.target.closest(".cowork-revision-output");ue&&ie.stopPropagation();const Be=ie.target.closest('[data-action="copy-code"]');if(Be){const At=Be.closest("pre")?.getAttribute("data-code");if(!At)return;rJ(Be,At);return}if(ue)return;const Me=ie.target.closest("[data-cowork-action]");if(!Me)return;const Fe=Me.dataset.coworkAction;if(Fe==="comment"&&(k=!0,F()),Fe==="cancel-comment"&&(x=null,k=!1,F()),Fe==="add-comment"&&bi(),Fe==="toggle-panel"&&(A=!A,B=!1,W()),Fe==="toggle-config"&&(B=!B,A=!1,W()),Fe==="toggle-revision"){w=!w;const At=Me.closest(".cowork-revision-stream");At?.classList.toggle("is-collapsed",w),Me.setAttribute("aria-expanded",String(!w)),Me.setAttribute("aria-label",`${w?"Expand":"Collapse"} Cowork stream`),At?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(w))}if(Fe==="send"&&we(),Fe==="cancel-run"&&j&&H&&!H.submitted){H.cancelled=!0,j=!1,M=!1,S="stopped",d=d.map(At=>At.status==="sent"?{...At,status:"pending"}:At),W(),xe();return}Fe==="toggle-diff"&&(E=!E,Ke()),Fe==="delete-annotation"&&Me.dataset.annotationId&&Tt(Me.dataset.annotationId),Fe==="apply-arm"&&(z="apply",W()),Fe==="discard-arm"&&(z="discard",W()),Fe==="confirm-back"&&(z=null,W()),Fe==="apply-confirm"&&n&&(z=null,it(()=>DZ(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Fe==="discard-confirm"&&qe(),Fe==="cancel-run"&&n&&it(()=>OZ(e.theaterId,n.id)).then(()=>{S="stopped",d=d.map(At=>At.status==="sent"?{...At,status:"pending"}:At),W()}).catch(()=>{})},_s=ie=>{const ue=ie.target instanceof Element?ie.target.closest("mark.cowork-mark"):null;ue?Ee(ue):R.hidden||(R.hidden=!0)},Qi=()=>{R.hidden=!0},Zn=ie=>{const ue=ie.target;if(ue instanceof Element&&ue.closest(".cowork-revision-output")){ie.stopPropagation();return}if(ue instanceof HTMLInputElement&&ue.name==="prompt"){U=ue.value;return}if(ue instanceof HTMLTextAreaElement&&ue.dataset.coworkComment){const Be=ue.dataset.coworkComment;d=d.map(Me=>Me.id===Be?{...Me,comment:ue.value,status:"pending"}:Me)}},An=ie=>{const ue=ie.target;if(ue instanceof Element&&ue.closest(".cowork-revision-output")){ie.stopPropagation();return}if(ue instanceof HTMLSelectElement&&["cli","model","effort"].includes(ue.name)){if(c=ue.name==="cli"?{cli:ue.value,model:"",effort:""}:{...c,[ue.name]:ue.value},vv(c),!n){ue.name!=="effort"&&de().then(W).catch(()=>{});return}ue.name!=="effort"?de().then(()=>it(()=>pv(e.theaterId,n.id,c))).then(W).catch(Be=>{Q=Be instanceof Error?Be.message:"Cowork request failed.",W()}):it(()=>pv(e.theaterId,n.id,c)).catch(()=>{});return}ue instanceof HTMLTextAreaElement&&ue.dataset.coworkComment&&Un().catch(()=>{})};return e.article.addEventListener("mouseup",Ei),e.article.addEventListener("mousedown",vn),e.article.addEventListener("keydown",cn),e.article.addEventListener("click",zs),e.article.addEventListener("input",Zn),e.article.addEventListener("change",An),e.article.addEventListener("mouseover",_s),e.article.addEventListener("mouseleave",Qi),{destroy(){t=!0,V(),i?.(),e.article.removeEventListener("mouseup",Ei),e.article.removeEventListener("mousedown",vn),e.article.removeEventListener("keydown",cn),e.article.removeEventListener("click",zs),e.article.removeEventListener("input",Zn),e.article.removeEventListener("change",An),e.article.removeEventListener("mouseover",_s),e.article.removeEventListener("mouseleave",Qi),D.remove(),T.remove(),R.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function gv(e,t,n,i){return`<label class="cowork-selector"><span>${e}</span><select name="${t}" ${n.length?"":"disabled"}>${n.map(r=>`<option value="${mr(r)}" ${r===i?"selected":""}>${_t(r)}</option>`).join("")}</select></label>`}function rJ(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function aJ(e,t){return tJ(e,t).map(n=>{const i=Bs(n.markdown,{resolveWikiLink:r=>yp(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function OE(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||"Please revise this passage."}}function oJ(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function _v(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function DE(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function lJ(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function cJ(){try{const e=JSON.parse(localStorage.getItem(LN)??"{}");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 vv(e){try{localStorage.setItem(LN,JSON.stringify(e))}catch{}}const NN={create_wiki:"+",update_wiki:"↻"},MN={create_wiki:"Create",update_wiki:"Update"};function uJ(e,t){let n=!1,i=0,r=null,o=null,c=t,d="idle",p=null,f=null,_=null;Ip(e);function g(E){const M=E.target;if(!(M instanceof Element))return;const j=M.closest("[data-patch-id]");if(j){E.preventDefault();const Q=j.dataset.patchId||void 0;c.onPatchOpen?.(Q);return}const H=M.closest("[data-entry-id]");if(H?.dataset.entryId){E.preventDefault(),c.onRelatedClick(H.dataset.entryId);return}const U=M.closest("[data-drydock-action]");if(U){E.preventDefault(),b(U.dataset.drydockAction);return}}function b(E){if(E){if(E==="back"){c.onPatchOpen?.(void 0);return}if(E==="approve"){d="approving",p=null,w();return}if(E==="approve-confirm"){S("approve",void 0);return}if(E==="reject"){d="rejecting",p=null,w();return}if(E==="reject-submit"){const M=e.querySelector("#queue-reject-reason")?.value.trim();if(!M){p="Rejection reason is required.",w();return}S("reject",M);return}if(E==="cancel"){d="idle",p=null,w();return}}}async function S(E,M){if(_){d="submitting",p=null,w();try{await EZ(c.theaterId,_,E,M),c.onDecided?.()}catch(j){d=E==="approve"?"approving":"rejecting",p=j instanceof Error?j.message:String(j),w()}}}function w(){const E=e.querySelector("[data-decision-bar-wrap]");E&&(E.innerHTML=ON(d,p))}e.addEventListener("click",g);function x(){o?.destroy(),o=null,r?.(),r=null}async function k(E){if(!n){cf(e,t.tocContainer),x();try{const M=await wZ(c.theaterId,E);if(n)return;const{index:j}=jl(),{html:H,toc:U}=Bs(M.body,{omitDuplicateTitle:M.frontmatter.title,resolveWikiLink:Y=>yp(Y)});e.innerHTML=`
|
|
326
|
+
<article class="document">
|
|
327
|
+
<header class="document-header">
|
|
328
|
+
${hJ(M.frontmatter.title)}
|
|
329
|
+
<h1>${_t(M.frontmatter.title)}</h1>
|
|
330
|
+
${KZ(M.frontmatter)}
|
|
331
|
+
</header>
|
|
332
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
333
|
+
${H}
|
|
334
|
+
</div>
|
|
335
|
+
${dJ(M.frontmatter.id,M.frontmatter.tags,j)}
|
|
336
|
+
</article>
|
|
337
|
+
`,t.tocContainer.innerHTML=mv(U);const Q=e.querySelector("article");Q&&U.length>0&&(r=RE(Q,U,t.tocContainer));const oe=e.querySelector("#codex-reader-body");Q&&oe&&(o=sJ({theaterId:c.theaterId,entryId:E,title:M.frontmatter.title,article:Q,body:oe,onApplied:()=>{k(E)}}))}catch(M){n||uf(e,t.tocContainer,M)}}}async function A(E){if(!n){cf(e,t.tocContainer),x(),f=null,_=null,d="idle",p=null;try{if(E){const M=await xZ(c.theaterId,E);if(n)return;f=M.meta,_=E;const{html:j,toc:H}=Bs(M.wikiEntry.body,{omitDuplicateTitle:M.wikiEntry.title,resolveWikiLink:Q=>yp(Q)});e.innerHTML=mJ(M,j),t.tocContainer.innerHTML=mv(H);const U=e.querySelector("article");U&&H.length>0&&(r=RE(U,H,t.tocContainer))}else{const M=await xN(c.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=fJ(M.items,"Review queue — Pending patches")}}catch(M){n||uf(e,t.tocContainer,M)}}}async function B(E){if(!n){cf(e,t.tocContainer),x();try{if(E){const M=await AZ(c.theaterId,E);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=vJ(M)}else{const M=await TZ(c.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=yJ(M)}}catch(M){n||uf(e,t.tocContainer,M)}}}async function z(E){const M=++i,j=c.theaterId;cf(e,t.tocContainer),x();try{const H=await kZ(j,E);if(n||M!==i||j!==c.theaterId)return;const{html:U,toc:Q}=Bs(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">${_t(E??"Workspace schema")}</span></li></ol></nav><h1>${_t(E??"Workspace schema")}</h1><span class="queue-dl-mono">${_t(H.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${U}</div></article>`,t.tocContainer.innerHTML=mv(Q)}catch(H){!n&&M===i&&j===c.theaterId&&uf(e,t.tocContainer,H)}}return t.kind==="entry"&&t.initialEntryId?k(t.initialEntryId):t.kind==="drydock"?A(t.subId):t.kind==="conflicts"?B(t.subId):t.kind==="schema"&&z(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",g),x(),o?.destroy()},async setEntry(E){await k(E)},async navigateSub(E){t.kind==="drydock"?await A(E):t.kind==="conflicts"?await B(E):t.kind==="schema"&&await z(E)},refreshCallbacks(E){c={...c,...E}}}}function cf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function uf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${_t(i)}</div>`,t.innerHTML=""}function hJ(e){return`
|
|
338
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
339
|
+
<ol>
|
|
340
|
+
<li><span>Codex</span></li>
|
|
341
|
+
<li><span aria-current="page">${_t(e)}</span></li>
|
|
342
|
+
</ol>
|
|
343
|
+
</nav>
|
|
344
|
+
`}function dJ(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?"":`
|
|
345
|
+
<section class="related-list">
|
|
346
|
+
<h2>Related entries</h2>
|
|
347
|
+
<div class="related-items">
|
|
348
|
+
${r.map(o=>`<button class="related-card" type="button" data-entry-id="${mr(o.entry.id)}">
|
|
349
|
+
<strong>${_t(o.entry.title)}</strong>
|
|
350
|
+
<span>${AN(o.matchingTags)}</span>
|
|
351
|
+
</button>`).join("")}
|
|
352
|
+
</div>
|
|
353
|
+
</section>
|
|
354
|
+
`}function fJ(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
355
|
+
<article class="document">
|
|
356
|
+
<header class="document-header">
|
|
357
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
358
|
+
<ol>
|
|
359
|
+
<li><span>Codex</span></li>
|
|
360
|
+
<li><span aria-current="page">Review queue</span></li>
|
|
361
|
+
</ol>
|
|
362
|
+
</nav>
|
|
363
|
+
<h1>${_t(t)}</h1>
|
|
364
|
+
</header>
|
|
365
|
+
<div class="queue-row-list">
|
|
366
|
+
${e.map(pJ).join("")}
|
|
367
|
+
</div>
|
|
368
|
+
</article>
|
|
369
|
+
`}function pJ(e){const t=e.op??"create_wiki",n=NN[t]??"?",i=MN[t]??"Patch",r=e.target??e.id,c=[bJ(e.meta.createdAt)].filter(Boolean);return`
|
|
370
|
+
<button class="queue-row" type="button" data-patch-id="${mr(e.id)}" aria-label="${mr(i+": "+r)}">
|
|
371
|
+
<span class="queue-row-badge" aria-hidden="true">
|
|
372
|
+
<span class="op-badge">${n}</span>
|
|
373
|
+
</span>
|
|
374
|
+
<span class="queue-row-body">
|
|
375
|
+
<span class="queue-row-target">${_t(r)}</span>
|
|
376
|
+
${e.summary?`<span class="queue-row-summary">${_t(e.summary)}</span>`:""}
|
|
377
|
+
${c.length>0?`<span class="queue-row-meta">${c.map(_t).join(" · ")}</span>`:""}
|
|
378
|
+
</span>
|
|
379
|
+
</button>
|
|
380
|
+
`}function mJ(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,c=n.frontmatter.op,d=NN[c]??"?",p=MN[c]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",_=i.status==="pending";return`
|
|
381
|
+
<article class="document">
|
|
382
|
+
<header class="document-header">
|
|
383
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
384
|
+
<ol>
|
|
385
|
+
<li><span>Codex</span></li>
|
|
386
|
+
<li><span>Review queue</span></li>
|
|
387
|
+
<li><span aria-current="page">${_t(p)}</span></li>
|
|
388
|
+
</ol>
|
|
389
|
+
</nav>
|
|
390
|
+
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
391
|
+
<h1><span class="op-badge">${d}</span> ${_t(r.title)}</h1>
|
|
392
|
+
<p class="eyebrow">${_t(n.frontmatter.target)} · v${r.version} · ${_t(f)}</p>
|
|
393
|
+
${gJ(n.frontmatter.proposer,r.tags)}
|
|
394
|
+
</header>
|
|
395
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
396
|
+
${t}
|
|
397
|
+
</div>
|
|
398
|
+
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
399
|
+
${_?ON("idle",null):_J(i)}
|
|
400
|
+
</div>
|
|
401
|
+
</article>
|
|
402
|
+
`}function gJ(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${_t(e)}</span>`),t.length>0&&n.push(AN(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function ON(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
403
|
+
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
404
|
+
<div class="queue-action-buttons">
|
|
405
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
406
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
407
|
+
</div>
|
|
408
|
+
${t?`<p class="queue-action-error">${_t(t)}</p>`:""}
|
|
409
|
+
`:e==="rejecting"?`
|
|
410
|
+
<div class="queue-reject-form">
|
|
411
|
+
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
412
|
+
<div class="queue-action-buttons">
|
|
413
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
414
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
415
|
+
</div>
|
|
416
|
+
${t?`<p class="queue-action-error">${_t(t)}</p>`:""}
|
|
417
|
+
</div>
|
|
418
|
+
`:`
|
|
419
|
+
<div class="queue-action-buttons">
|
|
420
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
421
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
422
|
+
</div>
|
|
423
|
+
`}function _J(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${_t(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function vJ(e){return`
|
|
424
|
+
<article class="document">
|
|
425
|
+
<header class="document-header">
|
|
426
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
427
|
+
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
428
|
+
</nav>
|
|
429
|
+
<h1>${_t(e.id)}</h1>
|
|
430
|
+
<p class="eyebrow">Conflict · ${_t(e.meta?.status??"open")}</p>
|
|
431
|
+
</header>
|
|
432
|
+
<div class="markdown-body">
|
|
433
|
+
${e.current?`<h2>Current</h2><pre><code>${_t(e.current)}</code></pre>`:""}
|
|
434
|
+
${e.proposed?`<h2>Proposed</h2><pre><code>${_t(e.proposed)}</code></pre>`:""}
|
|
435
|
+
</div>
|
|
436
|
+
</article>
|
|
437
|
+
`}function yJ(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
438
|
+
<article class="document">
|
|
439
|
+
<header class="document-header">
|
|
440
|
+
<h1>Conflicts</h1>
|
|
441
|
+
</header>
|
|
442
|
+
<div class="markdown-body">
|
|
443
|
+
<ul class="queue-list">
|
|
444
|
+
${e.map(t=>`<li class="queue-item">
|
|
445
|
+
<strong>${_t(t.title||t.id)}</strong>
|
|
446
|
+
<span class="eyebrow">${_t(t.status)}</span>
|
|
447
|
+
</li>`).join("")}
|
|
448
|
+
</ul>
|
|
449
|
+
</div>
|
|
450
|
+
</article>
|
|
451
|
+
`}function bJ(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,dh=null,DN=null,za=null,To=null,Ba=null,Mf=null,yv=null,Of,xb=0;function jE(e){DN=e}function SJ(e,t){const n=CJ();n.parentElement!==e&&e.appendChild(n),dh||(dh=GZ(n,{initialTheaterId:t,onRequest:i=>DN?.(i)}))}function wJ(e){dh?.setTheater(e)}function jN(e,t,n){const i=kJ(),r=EJ(),o=i.parentElement,c=n.kind==="entry"&&Mf==="entry"&&n.initialEntryId===yv;o&&o!==e&&(xb=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Ba||Mf!==n.kind?(Ba?.destroy(),Ba=uJ(i,{...n,tocContainer:r}),Mf=n.kind,Of=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==yv?Ba.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==Of&&(Of=n.subId,Ba.navigateSub(n.subId)),yv=n.kind==="entry"?n.initialEntryId??null:null,Ba.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=c?xb:0;requestAnimationFrame(()=>{e.scrollTop=d})}function xJ(){const e=za?.parentElement;e&&(xb=e.scrollTop)}function IN(){Ba?.destroy(),Ba=null,Mf=null,Of=void 0,za?.parentElement&&za.parentElement.removeChild(za),To?.parentElement&&To.parentElement.removeChild(To)}function IE(){IN(),dh?.destroy(),dh=null,Eo?.parentElement&&Eo.parentElement.removeChild(Eo)}function CJ(){return Eo||(Eo=document.createElement("div"),Eo.className="codex-host"),Eo}function kJ(){return za||(za=document.createElement("div"),za.className="codex-reader-host"),za}function EJ(){return To||(To=document.createElement("div"),To.className="codex-toc-host"),To}const TJ={id:"codex",title:"Codex",icon:()=>u.jsx(MJ,{}),render:e=>u.jsx(AJ,{theaterId:e.theaterId})};function AJ({theaterId:e}){const t=er(),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,_=t.codexReaderExpanded,g=t.theaters.find(A=>A.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=c?.contextKey===S&&c.hasWiki?c.id:null,x=w!==null,k=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,s_(),!e){d({contextKey:S,hasWiki:!1,id:null});return}LJ(e).then(A=>{o.current===S&&d({contextKey:S,...A})}).catch(()=>{o.current===S&&d({contextKey:S,hasWiki:!1,id:null})})},[S,e]),y.useEffect(()=>{c?.contextKey===S&&!c.hasWiki&&IE()},[S,c]),y.useEffect(()=>()=>IE(),[]),y.useEffect(()=>{if(!x||!w)return;const A=n.current;if(A)return SJ(A,w),jE(B=>{B.kind==="entry"?hr({kind:"entry",entryId:B.id}):B.kind==="drydock"?hr({kind:"drydock",patchId:B.patchId}):B.kind==="conflicts"?hr({kind:"conflicts",id:B.id}):B.kind==="schema"&&hr({kind:"schema",templateId:B.templateId})}),()=>{jE(null)}},[x,w,f]),y.useEffect(()=>{x&&w&&wJ(w)},[x,w]),y.useEffect(()=>{if(!x||!w||!f||_||!i.current||!r.current||!p)return;const A=p.kind,B=A==="drydock"?p.patchId:A==="conflicts"?p.id:A==="schema"?p.templateId:void 0;jN(i.current,r.current,{initialEntryId:A==="entry"?p.entryId:"",kind:A,subId:B,theaterId:w,onRelatedClick:z=>hr({kind:"entry",entryId:z}),onClose:()=>s_(),onPatchOpen:z=>hr({kind:"drydock",patchId:z}),onDecided:()=>{vp(),hr({kind:"drydock",patchId:void 0})}})},[x,w,f,_,k]),y.useEffect(()=>{f||IN()},[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:gf,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:s_,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(RJ,{activeTheater:g,hasTheaters:b})}function RJ({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 LJ(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 NJ(await t.json())}function NJ(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 MJ(){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 OJ(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 DJ(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function Cb(e){return e.replace(/\s+/g," ").trim()}function jJ(e,t){const n=i=>Cb(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function BN(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 IJ(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 BJ(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function $J(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function PJ(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every($J)?"ready":"blocked"}const zJ="plans-changed",HJ=3e4;function FJ(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(zJ,()=>{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()},HJ))}};return c(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const UJ=360,WJ={id:"plans",title:"Plans",icon:XJ,render:e=>u.jsx(qJ,{...e})};function qJ(e){const t=e.theaterId;return u.jsx(GJ,{...e},t)}function GJ(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,_]=y.useState(0),[g,b]=y.useState(0),[S,w]=y.useState(()=>new Set),x=y.useRef(0),k=y.useRef(0),A=y.useRef(null),B=y.useRef(o),z=y.useRef(null),E=y.useRef(!1),M=y.useRef(!1),j=y.useRef(null),H=y.useRef(null),U=d?.theaterId===n?d.name:null;y.useEffect(()=>{j.current=U},[U]),y.useEffect(()=>{const P=++x.current;if(!n){r({kind:"no-theater"});return}const D=A.current!==null,T=M.current;M.current=!1,D||r({kind:"loading"}),mO(n).then(R=>{if(P!==x.current)return;const N=new Map(R.plans.map(O=>[O.name,DJ(O)])),F=A.current;if(F){const O=new Set(R.plans.filter(V=>F.get(V.name)!==N.get(V.name)).map(V=>V.name));O.size>0&&(H.current&&clearTimeout(H.current),w(O),H.current=setTimeout(()=>w(new Set),1200))}A.current=N,r({kind:"ready",plans:R.plans});const W=j.current;W&&(N.has(W)?N.get(W)!==z.current&&b(O=>O+1):(z.current=null,E.current=!0,b(O=>O+1)))}).catch(()=>{P===x.current&&(!D||T)&&r({kind:"error"})})},[n,f]),y.useEffect(()=>{const P=++k.current;if(!n||!U)return;const D=E.current;E.current=!1,!D&&B.current.kind==="ready"&&B.current.plan.name===U||(z.current=null,B.current={kind:"loading"},c({kind:"loading"})),gO(n,U).then(R=>{if(P===k.current){z.current=A.current?.get(R.name)??null;const N={kind:"ready",plan:R};B.current=N,c(N)}}).catch(()=>{P===k.current&&(B.current={kind:"error"},c({kind:"error"}))})},[g,U,n]),y.useEffect(()=>{if(n)return FJ(n,()=>{_(P=>P+1)})},[n]),y.useEffect(()=>()=>{H.current&&clearTimeout(H.current)},[]),y.useLayoutEffect(()=>(t?.(U?UJ:null),()=>t?.(null)),[t,U]);const Q=y.useCallback(P=>{n&&p({theaterId:n,name:P})},[n]),oe=y.useCallback(()=>{p(null),z.current=null,B.current={kind:"loading"},c({kind:"loading"})},[]),$=y.useCallback(()=>{M.current=!0,_(P=>P+1)},[]),L=y.useCallback(()=>b(P=>P+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${U?" is-reader-open":""}`,onKeyDown:P=>{P.key==="Escape"&&U&&oe()},children:[U&&u.jsx(VJ,{state:o,onClose:oe,onRetry:L}),U&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(KJ,{selectedName:U,state:i,onRetry:$,onSelect:Q,pulsedNames:S})]})})}function KJ({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,c]=y.useState(""),[d,p]=y.useState("all"),[f,_]=y.useState(null),g=y.useRef(new Map);if(t.kind==="no-theater")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(bv,{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($N,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return u.jsx("div",{className:"plans-list-pane",children:u.jsx(bv,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=OJ(t.plans,o,d),S=(k,A)=>{const B=(k+A+b.length)%b.length;g.current.get(b[B]?.name??"")?.focus()},w=(k,A)=>{(k.key==="ArrowDown"||k.key==="ArrowUp")&&(k.preventDefault(),S(A,k.key==="ArrowDown"?1:-1))},x=(k,A)=>{k.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${A}`).then(()=>{_(A),window.setTimeout(()=>_(B=>B===A?null:B),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:k=>c(k.target.value)})]}),u.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(k=>u.jsx("button",{type:"button",className:`plans-filter${d===k?" is-active":""}`,"aria-pressed":d===k,onClick:()=>p(k),children:k==="all"?"ALL":k==="in-progress"?"IN PROGRESS":"COMPLETE"},k))}),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(bv,{children:"No matching plans."}),b.map((k,A)=>{const B=IJ(k.tasksDone,k.tasksTotal),z=B===100;return u.jsxs("div",{className:`plans-row${e===k.name?" is-selected":""}${r.has(k.name)?" is-pulsing":""}`,children:[u.jsxs("button",{ref:E=>{E?g.current.set(k.name,E):g.current.delete(k.name)},type:"button",className:"plans-row-select",onClick:()=>i(k.name),onKeyDown:E=>w(E,A),children:[u.jsx("span",{className:"plans-row-name",children:k.name}),u.jsxs("span",{className:"plans-row-meta",children:[k.waveCount," waves · ",k.tasksDone,"/",k.tasksTotal," tasks · ",BN(k.updatedAt),k.executionMode==="parallel"?" · parallel":""]}),B!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":`${B}% complete`,children:u.jsx("span",{className:`plans-progress-fill${z?" is-complete":""}`,style:{width:`${B}%`}})})]}),u.jsx("button",{type:"button",className:"plans-copy",onClick:E=>x(E,k.name),"aria-label":f===k.name?`Copied plans/${k.name}`:`Copy plans/${k.name}`,children:f===k.name?"COPIED":"COPY"})]},k.name)})]})]})}function VJ({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(kb,{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(kb,{onClose:t})]}),u.jsx($N,{message:"Unable to load plan.",onRetry:n})]}):u.jsx(YJ,{plan:e.plan,onClose:t})}function YJ({plan:e,onClose:t}){const n=y.useMemo(()=>{const d=new DOMParser().parseFromString(Bs(e.content).html,"text/html");return Sv(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 _=[...f.querySelectorAll(d)].find(b=>d==="h3"?jJ(b.textContent??"",p):Cb(b.textContent??"")===Cb(p));if(!_)return;const g=window.matchMedia("(prefers-reduced-motion: reduce)").matches;_.scrollIntoView({behavior:g?"auto":"smooth",block:"start"}),_.classList.remove("plans-heading-flash"),_.getBoundingClientRect(),_.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>_.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 _=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=_},1200)},[]);return y.useEffect(()=>{const d=i.current;if(!d)return;Ip(d),Sv(d);const p=new MutationObserver(()=>Sv(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 ",BN(e.updatedAt)]})]}),u.jsx(kb,{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=BJ(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=PJ(e.waves,p,_);return u.jsxs("div",{className:`plans-lane is-${b}`,children:[u.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",_.heading),children:_.id??_.heading}),_.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[_.tasksDone,"/",_.tasksTotal]}),b==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:"READY"})]},_.id??`${d.index}-${g}`)})})]},d.index)})}),u.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:c,dangerouslySetInnerHTML:{__html:n}})]})]})}function kb({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function bv({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 $N({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 Sv(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 XJ(){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 ZJ=[pZ,TJ,WJ];function JJ(e="right"){const{railPanels:t}=dc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const QJ=360;function eQ(e){const{codexReader:t}=er();return e==="codex"&&t!==null?QJ:0}const PN=240,tQ=312,zN="fleet-console.rail.panelWidth",BE="Theater";function nQ(){try{const e=localStorage.getItem(zN);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=PN)return t}}catch{}return tQ}function iQ({theaterId:e,api:t}){const n=y.useSyncExternalStore(k5,()=>jo().theaters.find(M=>M.id===e)?.label??BE,()=>BE),i=y.useRef(null),r=z5(),o=H5(),c=y.useRef(o),d=JJ(),p=ZJ,_=[...p,...d].find(M=>M.id===r)??null,g=_!==null,b=eQ(r)+(_?.preferredExtraWidth??0)+lj(),S=y.useRef(b);S.current=b;const[w,x]=y.useState(nQ),k=y.useRef(w),[A,B]=y.useState(!1);y.useLayoutEffect(()=>{c.current&&!o&&SL(i.current,".command-band-rail-toggle"),c.current=o},[o]);const z=y.useCallback(M=>{M.preventDefault();const j=M.clientX,H=k.current;B(!0);const U=oe=>{const Y=j-oe.clientX,$=window.innerWidth-148-S.current,L=Math.max(PN,Math.min($,H+Y));k.current=L,x(L)},Q=()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",Q),B(!1);try{localStorage.setItem(zN,String(k.current))}catch{}};document.addEventListener("pointermove",U),document.addEventListener("pointerup",Q)},[]),E=y.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:n},api:t,requestExtraWidth:M=>{r!==null&&oj(r,M)}}),[e,n,t,r]);return u.jsxs("div",{ref:i,className:`right-rail${g?" is-open":""}${o?" is-expanded":" is-closed"}${A?" is-dragging":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${g?w+b:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:w+b}:void 0,children:[g&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:z,"aria-hidden":"true"}),_&&u.jsx(sQ,{activePanel:_,activeId:r,ctx:E})]}),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:[p.map(M=>u.jsx($E,{panel:M,isActive:r===M.id},M.id)),p.length>0&&d.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,d.map(M=>u.jsx($E,{panel:M,isActive:r===M.id},M.id))]})})]})}const sQ=y.memo(function({activePanel:t,activeId:n,ctx:i}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:rj,children:"✕"})]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:t.render(i)})]})});function $E({panel:e,isActive:t}){const n=y.useCallback(()=>sj(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 rQ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function aQ(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=er(),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(()=>{xJ(),dD()},[]);return y.useEffect(()=>{if(!d)return;const f=e;document.body.setAttribute("data-codex-reading","true");const _=document.querySelector(".operations-canvas"),g=document.querySelector(".operations-side-bar");_?.setAttribute("inert",""),g?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&oQ(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),_?.removeAttribute("inert"),g?.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,_=f==="drydock"?e.patchId:f==="conflicts"?e.id:f==="schema"?e.templateId:void 0;jN(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:_,theaterId:n,onRelatedClick:g=>{hr({kind:"entry",entryId:g}),gf()},onClose:p,onPatchOpen:g=>{hr({kind:"drydock",patchId:g}),gf()},onDecided:()=>{vp(),hr({kind:"drydock",patchId:void 0}),gf()}}),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 oQ(e,t){if(!e)return;const n=[...e.querySelectorAll(rQ)].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 hf=Up().api,Eb=560,Tb=360,Df=new Set;function lQ({state:e,claimBootPanelMinimization:t}){const n=y.useRef(null),i=AL(),r=RL(),o=zp(),c=NL(),d=dc(),[p,f]=y.useState([]),_=y.useMemo(()=>cQ(e).map(R=>R.id),[e.operations,e.activeTheaterId]),g=y.useRef(e),b=y.useRef(0);g.current=e,y.useEffect(()=>{nV(e.activeTheaterId)},[e.activeTheaterId]),y.useEffect(()=>{if(!e.activeTheaterId){f([]);return}UE().then(f).catch(()=>{})},[e.activeTheaterId]),y.useEffect(()=>{const R=N=>{if(!LD()||!N.altKey||N.metaKey||N.ctrlKey)return;const F=document.activeElement;if(F instanceof HTMLElement&&F.matches("input, textarea, [contenteditable='true']")&&!F.closest(".xterm"))return;if(N.code==="KeyF"&&!N.shiftKey){N.preventDefault(),N.stopImmediatePropagation(),sV();return}if(N.shiftKey||N.key!=="ArrowLeft"&&N.key!=="ArrowRight")return;const W=g.current,O=Ga(),V=uD(W.operations.filter(fe=>fe.theaterId===W.activeTheaterId),W.groups.filter(fe=>fe.theaterId===W.activeTheaterId),O.operationOrder,O.collapsedGroups,ms()===null&&Ys()===null?O.minimized:[]);if(N.preventDefault(),N.stopImmediatePropagation(),V.length===0)return;const J=ms()??Ys()??g.current.activeOperationId,he=cD(V,J,N.key==="ArrowRight"?1:-1);he&&wv(he,d.operationKinds,hf,b,()=>{O.minimized.includes(he)&&gp(he),Qu(he)})};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[r,o,i,d.operationKinds]),y.useEffect(()=>{for(const F of _)eV(F);if(!e.operationsHydrated||(tV(_),!e.activeTheaterId))return;const R=t(e.activeTheaterId);if(R===null)return;const N=new Set([g.current.pendingOperationFocus,ms(),Ys()].filter(F=>F!==null));QK(R.filter(F=>!N.has(F)))},[t,_,e.activeTheaterId,e.operationsHydrated]),y.useEffect(()=>{const R=e.pendingOperationFocus;R!==null&&(wv(R,d.operationKinds,hf,b,()=>{const N=PE(n.current);N&&Q2(R,N)}),lD())},[d.operationKinds,e.pendingOperationFocus]);const S=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(R=>R.theaterId===e.activeTheaterId);const w=y.useCallback((R,N)=>d.plugins.find(W=>W.id===R)?.renderLaunchIcon?.(N)??null,[d.plugins]),x=y.useCallback((R,N,F)=>{if(!g.current.activeTheaterId)return;const W={...zE(F),zIndex:zo()};xv(R,N,W,g.current.activeTheaterId,d.plugins)},[d.plugins]),k=y.useCallback((R,N)=>{if(!g.current.activeTheaterId)return;const F=hQ(n.current),W={...zE(F),zIndex:zo()};xv(R,N,W,g.current.activeTheaterId,d.plugins)},[d.plugins]),A=y.useCallback((R,N,F)=>{g.current.activeTheaterId&&xv(R,N,F,g.current.activeTheaterId,d.plugins)},[d.plugins]),B=y.useCallback(()=>{OL({x:0,y:0,zoom:1})},[]),z=y.useCallback(R=>{const N=g.current.operations.find(F=>F.id===R);if(N){if(N.theaterId!==g.current.activeTheaterId){b.current+=1,Qu(R);return}wv(R,d.operationKinds,hf,b,()=>{const F=Ga(),W=F.operations[R]??N.geometry??uQ(N);F.operations[R]||hb(R,W),gp(R),Di(R);const O=PE(n.current);O&&Q2(R,O)})}},[d.operationKinds]),E=y.useCallback(R=>{g.current.activeOperationId===R&&Di(null),DL(R)},[]),M=y.useCallback((R,N)=>{mf(R,{accent:N}).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),j=y.useCallback((R,N)=>{g5(R,N).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),H=y.useCallback((R,N)=>{mf(R,{groupId:N}).then(()=>Xi(null)).then(fs).catch(()=>{})},[]),U=y.useCallback((R,N,F)=>{vO({theaterId:R,name:N,color:"blue"}).then(W=>F?mf(F,{groupId:W.id}).then(()=>{}):void 0).then(()=>Promise.all([Xi(null).then(fs),bo().then(So)])).catch(()=>{})},[]),Q=y.useCallback((R,N)=>{N&&n_(R,{color:N}).then(()=>bo()).then(So).catch(()=>{})},[]),oe=y.useCallback((R,N)=>{n_(R,{name:N}).then(()=>bo()).then(So).catch(()=>{})},[]),Y=y.useCallback(R=>{const N=new Map(g.current.groups.map(W=>[W.id,W])),F=R.flatMap((W,O)=>{const V=N.get(W);return!V||V.order===O?[]:[n_(W,{order:O})]});F.length!==0&&Promise.allSettled(F).then(()=>bo()).then(So).catch(()=>{})},[]),$=y.useCallback(R=>{const N=new Map(g.current.theaters.map(W=>[W.id,W])),F=R.flatMap((W,O)=>{const V=N.get(W);return!V||V.order===O?[]:[fO(W,O)]});F.length!==0&&Promise.allSettled(F).then(()=>Gx(null)).then(Ov).catch(()=>{})},[]),L=y.useCallback(R=>{yO(R).then(()=>Promise.all([Xi(null).then(fs),bo().then(So)])).catch(()=>{})},[]),P=y.useCallback(R=>{if(Df.has(R))return;ms()===R&&Qs(),Df.add(R);const N=g.current.operations.find(W=>W.id===R)?.pluginId,F=(N?d.plugins.find(W=>W.id===N):null)??null;dQ(R,F).finally(()=>Df.delete(R))},[d.plugins]),D=y.useCallback(async R=>{T5();try{const N=await m5(R),F=await p5(N);A5(F),Gx(null).then(Ov).catch(()=>{})}catch(N){Dv(N instanceof Error?N.message:String(N))}},[]),T=y.useCallback(async R=>{const N=()=>Promise.all([Xi(null).then(fs),bo().then(So)]).then(()=>{}).catch(()=>{});try{await _O(R),Jx(R),await N()}catch(F){if(F instanceof en&&F.status===404){Jx(R),await N();return}Dv(F instanceof Error?F.message:String(F))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(VV,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:c,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:p,canLaunch:S,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:w,onLaunchKind:k,onResetView:B,onClose:P,onMinimize:E,onFocus:z,onSetAccent:M,onRename:j,onSetGroupId:H,onCreateGroup:U,onSetGroupColor:Q,onRenameGroup:oe,onReorderGroups:Y,onReorderTheaters:$,onUngroupAll:L,onSelectTheater:sD,onAddTheater:D,onCancelAddTheater:oD,onForgetTheater:T}),u.jsx("div",{className:"operations-center-stage",ref:n,children:u.jsx(nZ,{state:e,catalog:p,canLaunch:S,renderKindIcon:w,onLaunchKind:x,onLaunchAtGeometry:A,onClose:P,onFocus:z,onRename:j,onSetAccent:M})}),u.jsx(iQ,{theaterId:e.activeTheaterId,api:hf}),u.jsx(aQ,{})]})}async function wv(e,t,n,i,r){const o=++i.current,c=Z2(),d=ms();if(d!==null){if(d===e){Di(e);return}const p=jo().operations.find(b=>b.id===e),f=Ga().minimized.includes(e),_=p&&t.find(b=>b.pluginId===p.pluginId&&b.type===p.type);let g=!0;if(p&&_?.companions?.length&&_.canOpenCompanions){try{g=await _.canOpenCompanions({api:n,operation:p})}catch{g=!1}const b=jo(),S=b.operations.find(x=>x.id===e),w=!f&&Ga().minimized.includes(e);if(i.current!==o||Z2()!==c||ms()!==d||b.activeTheaterId!==p.theaterId||EL()!==p.theaterId||w||Df.has(e)||!S||S.pluginId!==p.pluginId||S.type!==p.type||S.theaterId!==p.theaterId)return}if(p&&(!_||!_.companions?.length||!g)){if(Qs(),mp()){gp(e),Di(e);return}r();return}Di(e),jL(e);return}if(Ys()!==null){Di(e),z0(e);return}if(mp()){gp(e),Di(e);return}r()}function cQ(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(jv)}function PE(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function uQ(e){return e.geometry??{x:0,y:0,width:Eb,height:Tb,zIndex:0}}function hQ(e){const t=Ga(),n=e?.clientWidth??800,i=e?.clientHeight??600;return hh({x:n/2,y:i/2},t.viewport)}function zE(e){return{x:e.x-Eb/2,y:e.y-Tb/2,width:Eb,height:Tb}}async function xv(e,t,n,i,r){const o=r.find(g=>g.id===e),d=Up(()=>{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=EL()===i,_=jo().operations.some(g=>g.id===p);YK(i)===null&&(f&&_&&Ys()!==null?(Di(p),z0(p)):Qu(p))}async function dQ(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 fQ=3e4;let df=1e3,Ru=null,Cv=null,kv=!1;function HN(){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);pQ(i.operation)&&iD(i.operation)}catch{}}),e.addEventListener("update:available",()=>{fh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{rN(JSON.parse(n.data))}catch{cE()}}),e.onopen=()=>{df=1e3,fh()},e.onerror=()=>{e.close(),cE(),Ru=setTimeout(()=>{Ru=null,df=Math.min(df*2,fQ),Xi().then(fs).catch(()=>{}).finally(HN)},df)}}function fh(){if(Cv){kv=!0;return}Cv=cO(jo().activeTheaterId).then(VO).catch(()=>{}).finally(()=>{Cv=null,kv&&(kv=!1,fh())})}function pQ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const mQ=6e3;function gQ(){const e=er(),t=y.useRef(new Set),n=y.useRef(null),i=Ps(),r=dc(),o=X0(),c=pN(o.state?.language??"auto"),p=i.pathname.startsWith("/operations"),f=y.useCallback(_=>n.current===null||t.current.has(_)?null:(t.current.add(_),n.current),[]);return y.useEffect(()=>{const _=Up(()=>{Xi().then(fs).catch(()=>{})}),g=r.plugins.map(b=>b.install?.(_)).filter(b=>typeof b=="function");return()=>{for(const b of g)b()}},[r.plugins]),y.useEffect(()=>{KO(p)},[p]),y.useEffect(()=>{const _=new AbortController;f5(_.signal).then(S=>{tD(S),Zx()}).catch(S=>{_.signal.aborted||(mt({theaterError:S instanceof Error?S.message:String(S)}),Zx())});const g=Date.now();Xi(null,_.signal).then(S=>{n.current=S.filter(w=>w.ts.createdAt<g).map(w=>w.id),nD(S)}).catch(()=>{}),bo(null,_.signal).then(So).catch(()=>{}),fh();const b=window.setTimeout(fh,mQ);return()=>{window.clearTimeout(b),_.abort()}},[]),y.useEffect(()=>(fN({locale:c}),BY),[c]),y.useEffect(()=>XY({getSideBarCollapsed:()=>mb().collapsed,setSideBarCollapsed:V0,toggleOperationSearch:L5,toggleRailChrome:P5}),[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(mY,{operationsViewVisible:p}),u.jsx("main",{className:"console-route-content",children:u.jsxs(A4,{children:[u.jsx(Ll,{path:"/",element:u.jsx(e_,{to:"/operations",replace:!0})}),u.jsx(Ll,{path:"/operations",element:u.jsx(lQ,{state:e,claimBootPanelMinimization:f})}),u.jsx(Ll,{path:"/carrier-settings",element:u.jsx(e_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),u.jsx(Ll,{path:"/settings",element:u.jsx(pX,{})}),u.jsx(Ll,{path:"*",element:u.jsx(e_,{to:"/operations",replace:!0})})]})}),u.jsx(CY,{state:e}),u.jsx(qY,{state:e}),u.jsx(SY,{state:e}),u.jsx(LY,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:jf,"react/jsx-runtime":K3,"@fleet-console/sdk/plugin/browser":f6,"@fleet-console/sdk/settings/browser":b6,"@fleet-console/sdk/operations/browser":t6,"@fleet-console/sdk/notifications/browser":w6,"@fleet-console/sdk/react/browser":C6};Ff("instrument");QO();try{const e=await cN();Ff(e.theme),Mv(e.uiFont),DY(e)}catch{}const _Q=await pK();HN();const HE=document.querySelector("#app");HE&&L6.createRoot(HE).render(u.jsx(y.StrictMode,{children:u.jsx(J4,{basename:"/console",children:u.jsx(fK,{value:_Q,children:u.jsx(gQ,{})})})}));export{Yz as _,vQ as a,Ab as g,Xt as k,Ku as p};
|