@dotobokuri/fleet-console 1.25.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +41 -18
- package/dist/client/assets/{_baseUniq-CftO_qma.js → _baseUniq-tUJy1-kT.js} +1 -1
- package/dist/client/assets/{arc-CIUNumHO.js → arc-CGw4Qvmn.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-TpVISJv_.js → architectureDiagram-Q4EWVU46-2k-upKST.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-iHi0B0P6.js → blockDiagram-DXYQGD6D-B6tV45QW.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CYAcFDrF.js → c4Diagram-AHTNJAMY-Cvz-gvmw.js} +1 -1
- package/dist/client/assets/channel-CwKYdtaM.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-B3Nh-xBT.js → chunk-4BX2VUAB-D1HAKsna.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CDbmqVYQ.js → chunk-4TB4RGXK-CPQ1WwIY.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DRXIVd03.js → chunk-55IACEB6-EBDrBpcM.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-b05C0dVN.js → chunk-EDXVE4YY-DXkVIMxQ.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-ByrEd9CG.js → chunk-FMBD7UC4-Hh-pXKlX.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-BpEVT-V-.js → chunk-OYMX7WX6-BTKoQCZt.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CfdhAAA9.js → chunk-QZHKN3VN-t_NFg8Nt.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-Fdx8QRTs.js → chunk-YZCP3GAM-CbbNY-Y7.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-BMulJ6hF.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-BMulJ6hF.js +1 -0
- package/dist/client/assets/clone-D76WC0Bz.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-D8w9KovE.js → cose-bilkent-S5V4N54A-ClR8SWe0.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-D4fw7rTF.js → dagre-KV5264BT-CkHFxgvb.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-BRFcBwDM.js → diagram-5BDNPKRD-sq8RZZQY.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BKzuEau8.js → diagram-G4DWMVQ6-C6HCLzDf.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DkqP7aZ4.js → diagram-MMDJMWI5-BI9jyS0c.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-NelXGAN3.js → diagram-TYMM5635-BfWdzF7z.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-DHH5btR9.js → erDiagram-SMLLAGMA-Cw8mj3en.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-BmqHUJoi.js → flowDiagram-DWJPFMVM-DXiFqtKz.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-BtmWEvNP.js → ganttDiagram-T4ZO3ILL-CFNR4A1x.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-B64kk9Nb.js → gitGraphDiagram-UUTBAWPF-vYNjJsh8.js} +1 -1
- package/dist/client/assets/{graph-CEjP0hvY.js → graph-CGkhzltD.js} +1 -1
- package/dist/client/assets/index-BmhFrtGr.css +1 -0
- package/dist/client/assets/index-CZYuPH8_.js +395 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-CaTXrw5R.js → infoDiagram-42DDH7IO-C4lcu1mS.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-D9-Ds_71.js → ishikawaDiagram-UXIWVN3A-D2E79gEK.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-Cv4qWOhs.js → journeyDiagram-VCZTEJTY-CMJAA45g.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-CWBLcIpD.js → kanban-definition-6JOO6SKY-BYnBQou2.js} +1 -1
- package/dist/client/assets/{layout-D8eNRDnf.js → layout-CyfFEQ40.js} +1 -1
- package/dist/client/assets/{linear-lDifS_HV.js → linear-C2wjQAuy.js} +1 -1
- package/dist/client/assets/{mermaid.core-DcGkHMSR.js → mermaid.core-CKMZH6J-.js} +4 -4
- package/dist/client/assets/{min-Dz_jFvYt.js → min-B0B_lTwc.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-F3RmDOG-.js → mindmap-definition-QFDTVHPH-DDP_qkv3.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B1fDKBcl.js → pieDiagram-DEJITSTG-Cknm2rtj.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D93hlO3O.js → quadrantDiagram-34T5L4WZ-DZARSnQm.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-B4wj4AQL.js → requirementDiagram-MS252O5E-Bm_GIARG.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZRwx77Xd.js → sankeyDiagram-XADWPNL6-BUCr78fU.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-COMMRNyM.js → sequenceDiagram-FGHM5R23-Coq-jYr8.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-CpBccMyi.js → stateDiagram-FHFEXIEX-CIZCg5tw.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-I40ud2eo.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-C44EI_-o.js → timeline-definition-GMOUNBTQ-CxRr-mP_.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-BiBJbCdD.js → vennDiagram-DHZGUBPP-CWWV2O4a.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-Dm5-kWNd.js → wardley-RL74JXVD-CwkNZigV.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BjbesihY.js → wardleyDiagram-NUSXRM2D-CMF3BkPH.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-5P6xhAMr.js → xychartDiagram-5P7HB3ND-C1MudNRb.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/file-explorer/routes.mjs +1 -1
- package/dist/fleet-plugins/terminal/routes.mjs +370 -513
- package/package.json +1 -1
- package/dist/client/assets/channel-B-2UBgQ_.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DiaCSZq-.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DiaCSZq-.js +0 -1
- package/dist/client/assets/clone-Dq4F-r1q.js +0 -1
- package/dist/client/assets/index-B3gs6ohi.js +0 -380
- package/dist/client/assets/index-DDfl_vPx.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-UCYrbaKP.js +0 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
function eE(e,t){for(var i=0;i<t.length;i++){const n=t[i];if(typeof n!="string"&&!Array.isArray(n)){for(const r in n)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(n,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>n[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"]'))n(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"&&n(c)}).observe(document,{childList:!0,subtree:!0});function i(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 n(r){if(r.ep)return;r.ep=!0;const o=i(r);fetch(r.href,o)}})();function lb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function UX(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var i=function n(){var r=!1;try{r=this instanceof n}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}),i}var Dg={exports:{}},Gc={};var Qw;function jM(){if(Qw)return Gc;Qw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(n,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:n,key:c,ref:r!==void 0?r:null,props:o}}return Gc.Fragment=t,Gc.jsx=i,Gc.jsxs=i,Gc}var ex;function IM(){return ex||(ex=1,Dg.exports=jM()),Dg.exports}var u=IM();const BM=lb(u),PM=eE({__proto__:null,default:BM},[u]);var jg={exports:{}},Xe={};var tx;function zM(){if(tx)return Xe;tx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function S(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function R(B,Z,W){this.props=B,this.context=Z,this.refs=k,this.updater=W||w}R.prototype.isReactComponent={},R.prototype.setState=function(B,Z){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,Z,"setState")},R.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function O(){}O.prototype=R.prototype;function I(B,Z,W){this.props=B,this.context=Z,this.refs=k,this.updater=W||w}var A=I.prototype=new O;A.constructor=I,x(A,R.prototype),A.isPureReactComponent=!0;var $=Array.isArray;function L(){}var H={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function oe(B,Z,W){var re=W.ref;return{$$typeof:e,type:B,key:Z,ref:re!==void 0?re:null,props:W}}function fe(B,Z){return oe(B.type,Z,B.props)}function K(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function z(B){var Z={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(W){return Z[W]})}var N=/\/+/g;function D(B,Z){return typeof B=="object"&&B!==null&&B.key!=null?z(""+B.key):Z.toString(36)}function T(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(L,L):(B.status="pending",B.then(function(Z){B.status==="pending"&&(B.status="fulfilled",B.value=Z)},function(Z){B.status==="pending"&&(B.status="rejected",B.reason=Z)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function E(B,Z,W,re,ie){var ve=typeof B;(ve==="undefined"||ve==="boolean")&&(B=null);var xe=!1;if(B===null)xe=!0;else switch(ve){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(B.$$typeof){case e:case t:xe=!0;break;case g:return xe=B._init,E(xe(B._payload),Z,W,re,ie)}}if(xe)return ie=ie(B),xe=re===""?"."+D(B,0):re,$(ie)?(W="",xe!=null&&(W=xe.replace(N,"$&/")+"/"),E(ie,Z,W,"",function(_t){return _t})):ie!=null&&(K(ie)&&(ie=fe(ie,W+(ie.key==null||B&&B.key===ie.key?"":(""+ie.key).replace(N,"$&/")+"/")+xe)),Z.push(ie)),1;xe=0;var Te=re===""?".":re+":";if($(B))for(var Ie=0;Ie<B.length;Ie++)re=B[Ie],ve=Te+D(re,Ie),xe+=E(re,Z,W,ve,ie);else if(Ie=S(B),typeof Ie=="function")for(B=Ie.call(B),Ie=0;!(re=B.next()).done;)re=re.value,ve=Te+D(re,Ie++),xe+=E(re,Z,W,ve,ie);else if(ve==="object"){if(typeof B.then=="function")return E(T(B),Z,W,re,ie);throw Z=String(B),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return xe}function j(B,Z,W){if(B==null)return B;var re=[],ie=0;return E(B,re,"","",function(ve){return Z.call(W,ve,ie++)}),re}function P(B){if(B._status===-1){var Z=B._result;Z=Z(),Z.then(function(W){(B._status===0||B._status===-1)&&(B._status=1,B._result=W)},function(W){(B._status===0||B._status===-1)&&(B._status=2,B._result=W)}),B._status===-1&&(B._status=0,B._result=Z)}if(B._status===1)return B._result.default;throw B._result}var V=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},Q={map:j,forEach:function(B,Z,W){j(B,function(){Z.apply(this,arguments)},W)},count:function(B){var Z=0;return j(B,function(){Z++}),Z},toArray:function(B){return j(B,function(Z){return Z})||[]},only:function(B){if(!K(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Xe.Activity=v,Xe.Children=Q,Xe.Component=R,Xe.Fragment=i,Xe.Profiler=r,Xe.PureComponent=I,Xe.StrictMode=n,Xe.Suspense=p,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(B){return H.H.useMemoCache(B)}},Xe.cache=function(B){return function(){return B.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(B,Z,W){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var re=x({},B.props),ie=B.key;if(Z!=null)for(ve in Z.key!==void 0&&(ie=""+Z.key),Z)!U.call(Z,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&Z.ref===void 0||(re[ve]=Z[ve]);var ve=arguments.length-2;if(ve===1)re.children=W;else if(1<ve){for(var xe=Array(ve),Te=0;Te<ve;Te++)xe[Te]=arguments[Te+2];re.children=xe}return oe(B.type,ie,re)},Xe.createContext=function(B){return B={$$typeof:c,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},Xe.createElement=function(B,Z,W){var re,ie={},ve=null;if(Z!=null)for(re in Z.key!==void 0&&(ve=""+Z.key),Z)U.call(Z,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(ie[re]=Z[re]);var xe=arguments.length-2;if(xe===1)ie.children=W;else if(1<xe){for(var Te=Array(xe),Ie=0;Ie<xe;Ie++)Te[Ie]=arguments[Ie+2];ie.children=Te}if(B&&B.defaultProps)for(re in xe=B.defaultProps,xe)ie[re]===void 0&&(ie[re]=xe[re]);return oe(B,ve,ie)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(B){return{$$typeof:d,render:B}},Xe.isValidElement=K,Xe.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:P}},Xe.memo=function(B,Z){return{$$typeof:f,type:B,compare:Z===void 0?null:Z}},Xe.startTransition=function(B){var Z=H.T,W={};H.T=W;try{var re=B(),ie=H.S;ie!==null&&ie(W,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(L,V)}catch(ve){V(ve)}finally{Z!==null&&W.types!==null&&(Z.types=W.types),H.T=Z}},Xe.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},Xe.use=function(B){return H.H.use(B)},Xe.useActionState=function(B,Z,W){return H.H.useActionState(B,Z,W)},Xe.useCallback=function(B,Z){return H.H.useCallback(B,Z)},Xe.useContext=function(B){return H.H.useContext(B)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(B,Z){return H.H.useDeferredValue(B,Z)},Xe.useEffect=function(B,Z){return H.H.useEffect(B,Z)},Xe.useEffectEvent=function(B){return H.H.useEffectEvent(B)},Xe.useId=function(){return H.H.useId()},Xe.useImperativeHandle=function(B,Z,W){return H.H.useImperativeHandle(B,Z,W)},Xe.useInsertionEffect=function(B,Z){return H.H.useInsertionEffect(B,Z)},Xe.useLayoutEffect=function(B,Z){return H.H.useLayoutEffect(B,Z)},Xe.useMemo=function(B,Z){return H.H.useMemo(B,Z)},Xe.useOptimistic=function(B,Z){return H.H.useOptimistic(B,Z)},Xe.useReducer=function(B,Z,W){return H.H.useReducer(B,Z,W)},Xe.useRef=function(B){return H.H.useRef(B)},Xe.useState=function(B){return H.H.useState(B)},Xe.useSyncExternalStore=function(B,Z,W){return H.H.useSyncExternalStore(B,Z,W)},Xe.useTransition=function(){return H.H.useTransition()},Xe.version="19.2.7",Xe}var ix;function cb(){return ix||(ix=1,jg.exports=zM()),jg.exports}var b=cb();const $M=lb(b),Tf=eE({__proto__:null,default:$M},[b]),HM="fc-operation-body";let wn=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function tE(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new wn(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(UM).filter(n=>n!==null):[]}function Af(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)||iE(t))throw new wn(500,"Invalid operation response");return t}function iE(e){return cv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function FM({children:e,className:t}){return u.jsx("div",{className:GM(HM,t),children:e})}function UM(e){if(!nE(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(WM).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function WM(e){return!nE(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 nE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>cv(i,t)):Object.entries(e).some(([i,n])=>t.has(i)||cv(n,t))}function GM(...e){return e.filter(t=>!!t).join(" ")}const qM=Object.freeze(Object.defineProperty({__proto__:null,ApiError:wn,OperationBody:FM,assertOperationNode:Af,fetchOperationCatalog:tE,hasForbiddenBrowserPayloadKey:iE},Symbol.toStringTag,{value:"Module"}));function KM(e){return e}function VM(e){return e}function sE(e=()=>{}){const t=new Set;return{api:{fetch:(i,n,r)=>fetch(Ig(i,n),r).then(e3),subscribe:(i,n,r)=>{const o=new EventSource(Ig(i,n));o.onmessage=r;const c=()=>o.close();return t.add(c),()=>{c(),t.delete(c)}},resync:e},lifecycle:{onDispose:i=>(t.add(i),()=>t.delete(i))},terminal:{requestTicket:async(i,n,r,o)=>{const c=await fetch(Ig(i,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!c.ok)throw new wn(c.status,`Terminal ticket request failed: ${c.status}`);const d=await c.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new wn(c.status,"Invalid terminal ticket response");return{ticket:d.ticket,ttlMs:d.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async i=>{const n=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new wn(n.status,`Operation create failed: ${n.status}`);const r=await n.json();return Af(r.operation)},rename:async(i,n)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n})});if(!r.ok)throw new wn(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Af(o.operation)},remove:async i=>{const n=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!n.ok)throw new wn(n.status,`Operation remove failed: ${n.status}`)}},preferences:{read:(i,n)=>i3(i,n),write:(i,n)=>n3(i,n)},settings:{read:async i=>{const n=await fetch(nx(i));if(!n.ok)throw new wn(n.status,`Plugin settings read failed: ${n.status}`);const o=(await n.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(i,n)=>{const r=await fetch(nx(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new wn(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function rE(e,t){return b.useSyncExternalStore(e,t,t)}function YM(){const[e,t]=b.useState([]),i=b.useCallback(async()=>{const n=await fetch("/api/v1/operations");if(!n.ok)throw new wn(n.status,`Operations request failed: ${n.status}`);const r=await n.json();t(Array.isArray(r.operations)?r.operations.map(Af):[])},[]);return b.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function XM(e,t){return b.useMemo(()=>({fetch:(i,n)=>e.fetch(t,i,n),subscribe:(i,n)=>e.subscribe(t,i,n)}),[e,t])}function ZM(e,t){return b.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function JM(e,t,i){const[n,r]=b.useState(()=>e.read(t,i)),o=b.useCallback(c=>{r(c),e.write(t,c)},[e,t]);return[n,o]}function QM(e,t){return b.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function e3(e){if(!e.ok)throw new wn(e.status,`Plugin request failed: ${e.status}`);return e}function Ig(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new wn(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new wn(400,"Invalid plugin path");return`/plugins/${e}${i}`}const t3=/^[a-z0-9][a-z0-9._-]*$/;function nx(e){if(!t3.test(e))throw new wn(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function i3(e,t){if(typeof window>"u")return t;try{const i=window.localStorage.getItem(`fleet-plugin.${e}`);return i===null?t:JSON.parse(i)}catch{return t}}function n3(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const s3=Object.freeze(Object.defineProperty({__proto__:null,React:Tf,createClientCapabilities:sE,defineOperationKind:VM,definePlugin:KM,useOperationStatus:QM,useOperations:YM,usePluginApi:XM,usePluginSettings:ZM,usePluginStorage:JM,useStoreSnapshot:rE},Symbol.toStringTag,{value:"Module"}));function r3(e){return e}function a3({title:e,description:t,children:i}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:i})]})}function o3({label:e,hint:t,children:i}){const n=b.useId(),r=b.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":n,"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:n,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:i})]})}function l3({checked:e,onChange:t,label:i,disabled:n=!1}){const r=b.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:n,"aria-label":i?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),i?u.jsx("span",{className:"fc-settings-toggle__label",children:i}):null]})}function c3({value:e,options:t,onChange:i,label:n,disabled:r=!1}){const o=b.useId(),c=u.jsx("select",{id:o,className:"fc-settings-select__control",value:e,disabled:r,"aria-label":n?void 0:"Select setting",onChange:d=>i(d.currentTarget.value),children:t.map(d=>u.jsx("option",{value:d.value,children:d.label},d.value))});return n?u.jsxs("label",{className:"fc-settings-select",htmlFor:o,children:[u.jsx("span",{className:"fc-settings-select__label",children:n}),c]}):u.jsx("div",{className:"fc-settings-select",children:c})}function u3({label:e,hint:t,children:i}){const n=b.useId(),r=b.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":n,"aria-describedby":t?r:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:n,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:i})]})}const h3=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:a3,SettingsField:u3,SettingsRow:o3,SettingsSelect:c3,SettingsToggle:l3,defineSettingsSection:r3},Symbol.toStringTag,{value:"Module"}));function d3(e){return e}const f3=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:d3},Symbol.toStringTag,{value:"Module"})),p3=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class ub extends b.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??p3:this.props.children}}const m3=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:ub,React:Tf,default:Tf},Symbol.toStringTag,{value:"Module"}));var Bg={exports:{}},qc={},Pg={exports:{}},zg={};var sx;function g3(){return sx||(sx=1,(function(e){function t(E,j){var P=E.length;E.push(j);e:for(;0<P;){var V=P-1>>>1,Q=E[V];if(0<r(Q,j))E[V]=j,E[P]=Q,P=V;else break e}}function i(E){return E.length===0?null:E[0]}function n(E){if(E.length===0)return null;var j=E[0],P=E.pop();if(P!==j){E[0]=P;e:for(var V=0,Q=E.length,B=Q>>>1;V<B;){var Z=2*(V+1)-1,W=E[Z],re=Z+1,ie=E[re];if(0>r(W,P))re<Q&&0>r(ie,W)?(E[V]=ie,E[re]=P,V=re):(E[V]=W,E[Z]=P,V=Z);else if(re<Q&&0>r(ie,P))E[V]=ie,E[re]=P,V=re;else break e}}return j}function r(E,j){var P=E.sortIndex-j.sortIndex;return P!==0?P:E.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],f=[],g=1,v=null,y=3,S=!1,w=!1,x=!1,k=!1,R=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function A(E){for(var j=i(f);j!==null;){if(j.callback===null)n(f);else if(j.startTime<=E)n(f),j.sortIndex=j.expirationTime,t(p,j);else break;j=i(f)}}function $(E){if(x=!1,A(E),!w)if(i(p)!==null)w=!0,L||(L=!0,z());else{var j=i(f);j!==null&&T($,j.startTime-E)}}var L=!1,H=-1,U=5,oe=-1;function fe(){return k?!0:!(e.unstable_now()-oe<U)}function K(){if(k=!1,L){var E=e.unstable_now();oe=E;var j=!0;try{e:{w=!1,x&&(x=!1,O(H),H=-1),S=!0;var P=y;try{t:{for(A(E),v=i(p);v!==null&&!(v.expirationTime>E&&fe());){var V=v.callback;if(typeof V=="function"){v.callback=null,y=v.priorityLevel;var Q=V(v.expirationTime<=E);if(E=e.unstable_now(),typeof Q=="function"){v.callback=Q,A(E),j=!0;break t}v===i(p)&&n(p),A(E)}else n(p);v=i(p)}if(v!==null)j=!0;else{var B=i(f);B!==null&&T($,B.startTime-E),j=!1}}break e}finally{v=null,y=P,S=!1}j=void 0}}finally{j?z():L=!1}}}var z;if(typeof I=="function")z=function(){I(K)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,D=N.port2;N.port1.onmessage=K,z=function(){D.postMessage(null)}}else z=function(){R(K,0)};function T(E,j){H=R(function(){E(e.unstable_now())},j)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(E){switch(y){case 1:case 2:case 3:var j=3;break;default:j=y}var P=y;y=j;try{return E()}finally{y=P}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(E,j){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=y;y=E;try{return j()}finally{y=P}},e.unstable_scheduleCallback=function(E,j,P){var V=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?V+P:V):P=V,E){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=P+Q,E={id:g++,callback:j,priorityLevel:E,startTime:P,expirationTime:Q,sortIndex:-1},P>V?(E.sortIndex=P,t(f,E),i(p)===null&&E===i(f)&&(x?(O(H),H=-1):x=!0,T($,P-V))):(E.sortIndex=Q,t(p,E),w||S||(w=!0,L||(L=!0,z()))),E},e.unstable_shouldYield=fe,e.unstable_wrapCallback=function(E){var j=y;return function(){var P=y;y=j;try{return E.apply(this,arguments)}finally{y=P}}}})(zg)),zg}var rx;function _3(){return rx||(rx=1,Pg.exports=g3()),Pg.exports}var $g={exports:{}},dn={};var ax;function v3(){if(ax)return dn;ax=1;var e=cb();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(p,f,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:v==null?null:""+v,children:p,containerInfo:f,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,dn.createPortal=function(p,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(p,f,null,g)},dn.flushSync=function(p){var f=c.T,g=n.p;try{if(c.T=null,n.p=2,p)return p()}finally{c.T=f,n.p=g,n.d.f()}},dn.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,n.d.C(p,f))},dn.prefetchDNS=function(p){typeof p=="string"&&n.d.D(p)},dn.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var g=f.as,v=d(g,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?n.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:S}):g==="script"&&n.d.X(p,{crossOrigin:v,integrity:y,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},dn.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=d(f.as,f.crossOrigin);n.d.M(p,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&n.d.M(p)},dn.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,v=d(g,f.crossOrigin);n.d.L(p,g,{crossOrigin:v,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})}},dn.preloadModule=function(p,f){if(typeof p=="string")if(f){var g=d(f.as,f.crossOrigin);n.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else n.d.m(p)},dn.requestFormReset=function(p){n.d.r(p)},dn.unstable_batchedUpdates=function(p,f){return p(f)},dn.useFormState=function(p,f,g){return c.H.useFormState(p,f,g)},dn.useFormStatus=function(){return c.H.useHostTransitionStatus()},dn.version="19.2.7",dn}var ox;function aE(){if(ox)return $g.exports;ox=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(),$g.exports=v3(),$g.exports}var lx;function y3(){if(lx)return qc;lx=1;var e=_3(),t=cb(),i=aE();function n(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(n(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(n(188));return a!==s?null:s}for(var l=s,h=a;;){var m=l.return;if(m===null)break;var _=m.alternate;if(_===null){if(h=m.return,h!==null){l=h;continue}break}if(m.child===_.child){for(_=m.child;_;){if(_===l)return p(m),s;if(_===h)return p(m),a;_=_.sibling}throw Error(n(188))}if(l.return!==h.return)l=m,h=_;else{for(var C=!1,M=m.child;M;){if(M===l){C=!0,l=m,h=_;break}if(M===h){C=!0,h=m,l=_;break}M=M.sibling}if(!C){for(M=_.child;M;){if(M===l){C=!0,l=_,h=m;break}if(M===h){C=!0,h=_,l=m;break}M=M.sibling}if(!C)throw Error(n(189))}}if(l.alternate!==h)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var v=Object.assign,y=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"),R=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),I=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function z(s){return s===null||typeof s!="object"?null:(s=K&&s[K]||s["@@iterator"],typeof s=="function"?s:null)}var N=Symbol.for("react.client.reference");function D(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===N?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case R:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case L:return"SuspenseList";case oe:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case I:return s.displayName||"Context";case O:return(s._context.displayName||"Context")+".Consumer";case A: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:D(s.type)||"Memo";case U:a=s._payload,s=s._init;try{return D(s(a))}catch{}}return null}var T=Array.isArray,E=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},V=[],Q=-1;function B(s){return{current:s}}function Z(s){0>Q||(s.current=V[Q],V[Q]=null,Q--)}function W(s,a){Q++,V[Q]=s.current,s.current=a}var re=B(null),ie=B(null),ve=B(null),xe=B(null);function Te(s,a){switch(W(ve,a),W(ie,s),W(re,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?ww(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=ww(a),s=xw(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(re),W(re,s)}function Ie(){Z(re),Z(ie),Z(ve)}function _t(s){s.memoizedState!==null&&W(xe,s);var a=re.current,l=xw(a,s.type);a!==l&&(W(ie,s),W(re,l))}function qe(s){ie.current===s&&(Z(re),Z(ie)),xe.current===s&&(Z(xe),Hc._currentValue=P)}var Re,Se;function Ue(s){if(Re===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",Se=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Re+s+Se}var Ye=!1;function pt(s,a){if(!s||Ye)return"";Ye=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(se){var ne=se}Reflect.construct(s,[],de)}else{try{de.call()}catch(se){ne=se}s.call(de.prototype)}}else{try{throw Error()}catch(se){ne=se}(de=s())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(se){if(se&&ne&&typeof se.stack=="string")return[se.stack,ne.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 _=h.DetermineComponentFrameRoot(),C=_[0],M=_[1];if(C&&M){var q=C.split(`
|
|
4
|
+
`),te=M.split(`
|
|
5
|
+
`);for(m=h=0;h<q.length&&!q[h].includes("DetermineComponentFrameRoot");)h++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(h===q.length||m===te.length)for(h=q.length-1,m=te.length-1;1<=h&&0<=m&&q[h]!==te[m];)m--;for(;1<=h&&0<=m;h--,m--)if(q[h]!==te[m]){if(h!==1||m!==1)do if(h--,m--,0>m||q[h]!==te[m]){var le=`
|
|
6
|
+
`+q[h].replace(" at new "," at ");return s.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",s.displayName)),le}while(1<=h&&0<=m);break}}}finally{Ye=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ue(l):""}function nt(s,a){switch(s.tag){case 26:case 27:case 5:return Ue(s.type);case 16:return Ue("Lazy");case 13:return s.child!==a&&a!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return pt(s.type,!1);case 11:return pt(s.type.render,!1);case 1:return pt(s.type,!0);case 31:return Ue("Activity");default:return""}}function ge(s){try{var a="",l=null;do a+=nt(s,l),l=s,s=s.return;while(s);return a}catch(h){return`
|
|
7
|
+
Error generating stack: `+h.message+`
|
|
8
|
+
`+h.stack}}var Le=Object.prototype.hasOwnProperty,Gt=e.unstable_scheduleCallback,Wn=e.unstable_cancelCallback,Ks=e.unstable_shouldYield,Vs=e.unstable_requestPaint,Mt=e.unstable_now,us=e.unstable_getCurrentPriorityLevel,Pi=e.unstable_ImmediatePriority,_i=e.unstable_UserBlockingPriority,An=e.unstable_NormalPriority,gn=e.unstable_LowPriority,Gn=e.unstable_IdlePriority,dr=e.log,qn=e.unstable_setDisableYieldValue,ln=null,qt=null;function Ot(s){if(typeof dr=="function"&&qn(s),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(ln,s)}catch{}}var Dt=Math.clz32?Math.clz32:hs,fr=Math.log,Li=Math.LN2;function hs(s){return s>>>=0,s===0?32:31-(fr(s)/Li|0)|0}var Xi=256,ds=262144,Ms=4194304;function jt(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,_=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var M=h&134217727;return M!==0?(h=M&~_,h!==0?m=jt(h):(C&=M,C!==0?m=jt(C):l||(l=M&~s,l!==0&&(m=jt(l))))):(M=h&~_,M!==0?m=jt(M):C!==0?m=jt(C):l||(l=h&~s,l!==0&&(m=jt(l)))),m===0?0:a!==0&&a!==m&&(a&_)===0&&(_=m&-m,l=a&-a,_>=l||_===32&&(l&4194048)!==0)?a:m}function ce(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function _e(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 Pe(){var s=Ms;return Ms<<=1,(Ms&62914560)===0&&(Ms=4194304),s}function Tt(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function bt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ae(s,a,l,h,m,_){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 M=s.entanglements,q=s.expirationTimes,te=s.hiddenUpdates;for(l=C&~l;0<l;){var le=31-Dt(l),de=1<<le;M[le]=0,q[le]=-1;var ne=te[le];if(ne!==null)for(te[le]=null,le=0;le<ne.length;le++){var se=ne[le];se!==null&&(se.lane&=-536870913)}l&=~de}h!==0&&ke(s,h,0),_!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=_&~(C&~a))}function ke(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-Dt(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|l&261930}function $e(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var h=31-Dt(l),m=1<<h;m&a|s[h]&a&&(s[h]|=a),l&=~m}}function Ft(s,a){var l=a&-a;return l=(l&42)!==0?1:st(l),(l&(s.suspendedLanes|a))!==0?0:l}function st(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 Si(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ue(){var s=j.p;return s!==0?s:(s=window.event,s===void 0?32:qw(s.type))}function ut(s,a){var l=j.p;try{return j.p=s,a()}finally{j.p=l}}var St=Math.random().toString(36).slice(2),He="__reactFiber$"+St,ye="__reactProps$"+St,vt="__reactContainer$"+St,Qt="__reactEvents$"+St,_n="__reactListeners$"+St,cn="__reactHandles$"+St,Kn="__reactResources$"+St,un="__reactMarker$"+St;function Me(s){delete s[He],delete s[ye],delete s[Qt],delete s[_n],delete s[cn]}function F(s){var a=s[He];if(a)return a;for(var l=s.parentNode;l;){if(a=l[vt]||l[He]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Nw(s);s!==null;){if(l=s[He])return l;s=Nw(s)}return a}s=l,l=s.parentNode}return null}function ae(s){if(s=s[He]||s[vt]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Ce(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(n(33))}function Ze(s){var a=s[Kn];return a||(a=s[Kn]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Qe(s){s[un]=!0}var At=new Set,ei={};function ti(s,a){me(s,a),me(s+"Capture",a)}function me(s,a){for(ei[s]=a,s=0;s<a.length;s++)At.add(a[s])}var je=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]*$"),Be={},wt={};function ii(s){return Le.call(wt,s)?!0:Le.call(Be,s)?!1:je.test(s)?wt[s]=!0:(Be[s]=!0,!1)}function hn(s,a,l){if(ii(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 Vn(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 Rn(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 Wt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Yn(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function gh(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,_=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return m.call(this)},set:function(C){l=""+C,_.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 Lo(s){if(!s._valueTracker){var a=Yn(s)?"checked":"value";s._valueTracker=gh(s,a,""+s[a])}}function ec(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return s&&(h=Yn(s)?s.checked?"true":"false":s.value),s=h,s!==l?(a.setValue(s),!0):!1}function Mo(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 Op=/[\n"\\]/g;function Nn(s){return s.replace(Op,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function tc(s,a,l,h,m,_,C,M){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=""+Wt(a)):s.value!==""+Wt(a)&&(s.value=""+Wt(a)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),a!=null?Oo(s,C,Wt(a)):l!=null?Oo(s,C,Wt(l)):h!=null&&s.removeAttribute("value"),m==null&&_!=null&&(s.defaultChecked=!!_),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?s.name=""+Wt(M):s.removeAttribute("name")}function $a(s,a,l,h,m,_,C,M){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.type=_),a!=null||l!=null){if(!(_!=="submit"&&_!=="reset"||a!=null)){Lo(s);return}l=l!=null?""+Wt(l):"",a=a!=null?""+Wt(a):l,M||a===s.value||(s.value=a),s.defaultValue=a}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=M?s.checked:!!h,s.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),Lo(s)}function Oo(s,a,l){a==="number"&&Mo(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function Zi(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=""+Wt(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 _h(s,a,l){if(a!=null&&(a=""+Wt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+Wt(l):""}function Do(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(n(92));if(T(h)){if(1<h.length)throw Error(n(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=Wt(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),Lo(s)}function Ge(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var vh=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 wi(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||vh.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Rt(s,a,l){if(a!=null&&typeof a!="object")throw Error(n(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&&wi(s,m,h)}else for(var _ in a)a.hasOwnProperty(_)&&wi(s,_,a[_])}function Vr(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 pr=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"]]),ic=/^[\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 Yr(s){return ic.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function we(){}var Oe=null;function Je(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ht=null,ai=null;function fs(s){var a=ae(s);if(a&&(s=a.stateNode)){var l=s[ye]||null;e:switch(s=a.stateNode,a.type){case"input":if(tc(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="'+Nn(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==s&&h.form===s.form){var m=h[ye]||null;if(!m)throw Error(n(90));tc(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&&ec(h)}break e;case"textarea":_h(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&Zi(s,!!l.multiple,a,!1)}}}var nc=!1;function yh(s,a,l){if(nc)return s(a,l);nc=!0;try{var h=s(a);return h}finally{if(nc=!1,(ht!==null||ai!==null)&&(ad(),ht&&(a=ht,s=ai,ai=ht=null,fs(a),s)))for(a=0;a<s.length;a++)fs(s[a])}}function sc(s,a){var l=s.stateNode;if(l===null)return null;var h=l[ye]||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(n(231,a,typeof l));return l}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dp=!1;if(mr)try{var rc={};Object.defineProperty(rc,"passive",{get:function(){Dp=!0}}),window.addEventListener("test",rc,rc),window.removeEventListener("test",rc,rc)}catch{Dp=!1}var Xr=null,jp=null,bh=null;function x0(){if(bh)return bh;var s,a=jp,l=a.length,h,m="value"in Xr?Xr.value:Xr.textContent,_=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[_-h];h++);return bh=m.slice(s,1<h?1-h:void 0)}function Sh(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 wh(){return!0}function C0(){return!1}function Ln(s){function a(l,h,m,_,C){this._reactName=l,this._targetInst=m,this.type=h,this.nativeEvent=_,this.target=C,this.currentTarget=null;for(var M in s)s.hasOwnProperty(M)&&(l=s[M],this[M]=l?l(_):_[M]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?wh:C0,this.isPropagationStopped=C0,this}return v(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=wh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=wh)},persist:function(){},isPersistent:wh}),a}var Ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xh=Ln(Ha),ac=v({},Ha,{view:0,detail:0}),ON=Ln(ac),Ip,Bp,oc,Ch=v({},ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zp,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!==oc&&(oc&&s.type==="mousemove"?(Ip=s.screenX-oc.screenX,Bp=s.screenY-oc.screenY):Bp=Ip=0,oc=s),Ip)},movementY:function(s){return"movementY"in s?s.movementY:Bp}}),k0=Ln(Ch),DN=v({},Ch,{dataTransfer:0}),jN=Ln(DN),IN=v({},ac,{relatedTarget:0}),Pp=Ln(IN),BN=v({},Ha,{animationName:0,elapsedTime:0,pseudoElement:0}),PN=Ln(BN),zN=v({},Ha,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),$N=Ln(zN),HN=v({},Ha,{data:0}),E0=Ln(HN),FN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},UN={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"},WN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GN(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=WN[s])?!!a[s]:!1}function zp(){return GN}var qN=v({},ac,{key:function(s){if(s.key){var a=FN[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Sh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?UN[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zp,charCode:function(s){return s.type==="keypress"?Sh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Sh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),KN=Ln(qN),VN=v({},Ch,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),T0=Ln(VN),YN=v({},ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zp}),XN=Ln(YN),ZN=v({},Ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),JN=Ln(ZN),QN=v({},Ch,{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}),eL=Ln(QN),tL=v({},Ha,{newState:0,oldState:0}),iL=Ln(tL),nL=[9,13,27,32],$p=mr&&"CompositionEvent"in window,lc=null;mr&&"documentMode"in document&&(lc=document.documentMode);var sL=mr&&"TextEvent"in window&&!lc,A0=mr&&(!$p||lc&&8<lc&&11>=lc),R0=" ",N0=!1;function L0(s,a){switch(s){case"keyup":return nL.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M0(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var jo=!1;function rL(s,a){switch(s){case"compositionend":return M0(a);case"keypress":return a.which!==32?null:(N0=!0,R0);case"textInput":return s=a.data,s===R0&&N0?null:s;default:return null}}function aL(s,a){if(jo)return s==="compositionend"||!$p&&L0(s,a)?(s=x0(),bh=jp=Xr=null,jo=!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 A0&&a.locale!=="ko"?null:a.data;default:return null}}var oL={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 O0(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!oL[s.type]:a==="textarea"}function D0(s,a,l,h){ht?ai?ai.push(h):ai=[h]:ht=h,a=fd(a,"onChange"),0<a.length&&(l=new xh("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var cc=null,uc=null;function lL(s){gw(s,0)}function kh(s){var a=Ce(s);if(ec(a))return s}function j0(s,a){if(s==="change")return a}var I0=!1;if(mr){var Hp;if(mr){var Fp="oninput"in document;if(!Fp){var B0=document.createElement("div");B0.setAttribute("oninput","return;"),Fp=typeof B0.oninput=="function"}Hp=Fp}else Hp=!1;I0=Hp&&(!document.documentMode||9<document.documentMode)}function P0(){cc&&(cc.detachEvent("onpropertychange",z0),uc=cc=null)}function z0(s){if(s.propertyName==="value"&&kh(uc)){var a=[];D0(a,uc,s,Je(s)),yh(lL,a)}}function cL(s,a,l){s==="focusin"?(P0(),cc=a,uc=l,cc.attachEvent("onpropertychange",z0)):s==="focusout"&&P0()}function uL(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return kh(uc)}function hL(s,a){if(s==="click")return kh(a)}function dL(s,a){if(s==="input"||s==="change")return kh(a)}function fL(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var Xn=typeof Object.is=="function"?Object.is:fL;function hc(s,a){if(Xn(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(!Le.call(a,m)||!Xn(s[m],a[m]))return!1}return!0}function $0(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function H0(s,a){var l=$0(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=$0(l)}}function F0(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?F0(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function U0(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Mo(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=Mo(s.document)}return a}function Up(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 pL=mr&&"documentMode"in document&&11>=document.documentMode,Io=null,Wp=null,dc=null,Gp=!1;function W0(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Gp||Io==null||Io!==Mo(h)||(h=Io,"selectionStart"in h&&Up(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}),dc&&hc(dc,h)||(dc=h,h=fd(Wp,"onSelect"),0<h.length&&(a=new xh("onSelect","select",null,a,l),s.push({event:a,listeners:h}),a.target=Io)))}function Fa(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var Bo={animationend:Fa("Animation","AnimationEnd"),animationiteration:Fa("Animation","AnimationIteration"),animationstart:Fa("Animation","AnimationStart"),transitionrun:Fa("Transition","TransitionRun"),transitionstart:Fa("Transition","TransitionStart"),transitioncancel:Fa("Transition","TransitionCancel"),transitionend:Fa("Transition","TransitionEnd")},qp={},G0={};mr&&(G0=document.createElement("div").style,"AnimationEvent"in window||(delete Bo.animationend.animation,delete Bo.animationiteration.animation,delete Bo.animationstart.animation),"TransitionEvent"in window||delete Bo.transitionend.transition);function Ua(s){if(qp[s])return qp[s];if(!Bo[s])return s;var a=Bo[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in G0)return qp[s]=a[l];return s}var q0=Ua("animationend"),K0=Ua("animationiteration"),V0=Ua("animationstart"),mL=Ua("transitionrun"),gL=Ua("transitionstart"),_L=Ua("transitioncancel"),Y0=Ua("transitionend"),X0=new Map,Kp="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(" ");Kp.push("scrollEnd");function Os(s,a){X0.set(s,a),ti(a,[s])}var Eh=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)},ps=[],Po=0,Vp=0;function Th(){for(var s=Po,a=Vp=Po=0;a<s;){var l=ps[a];ps[a++]=null;var h=ps[a];ps[a++]=null;var m=ps[a];ps[a++]=null;var _=ps[a];if(ps[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}_!==0&&Z0(l,m,_)}}function Ah(s,a,l,h){ps[Po++]=s,ps[Po++]=a,ps[Po++]=l,ps[Po++]=h,Vp|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function Yp(s,a,l,h){return Ah(s,a,l,h),Rh(s)}function Wa(s,a){return Ah(s,null,null,a),Rh(s)}function Z0(s,a,l){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l);for(var m=!1,_=s.return;_!==null;)_.childLanes|=l,h=_.alternate,h!==null&&(h.childLanes|=l),_.tag===22&&(s=_.stateNode,s===null||s._visibility&1||(m=!0)),s=_,_=_.return;return s.tag===3?(_=s.stateNode,m&&a!==null&&(m=31-Dt(l),s=_.hiddenUpdates,h=s[m],h===null?s[m]=[a]:h.push(a),a.lane=l|536870912),_):null}function Rh(s){if(50<Dc)throw Dc=0,sg=null,Error(n(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var zo={};function vL(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 Zn(s,a,l,h){return new vL(s,a,l,h)}function Xp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function gr(s,a){var l=s.alternate;return l===null?(l=Zn(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 J0(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 Nh(s,a,l,h,m,_){var C=0;if(h=s,typeof s=="function")Xp(s)&&(C=1);else if(typeof s=="string")C=xM(s,l,re.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case oe:return s=Zn(31,l,a,m),s.elementType=oe,s.lanes=_,s;case x:return Ga(l.children,m,_,a);case k:C=8,m|=24;break;case R:return s=Zn(12,l,a,m|2),s.elementType=R,s.lanes=_,s;case $:return s=Zn(13,l,a,m),s.elementType=$,s.lanes=_,s;case L:return s=Zn(19,l,a,m),s.elementType=L,s.lanes=_,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case I:C=10;break e;case O:C=9;break e;case A:C=11;break e;case H:C=14;break e;case U:C=16,h=null;break e}C=29,l=Error(n(130,s===null?"null":typeof s,"")),h=null}return a=Zn(C,l,a,m),a.elementType=s,a.type=h,a.lanes=_,a}function Ga(s,a,l,h){return s=Zn(7,s,h,a),s.lanes=l,s}function Zp(s,a,l){return s=Zn(6,s,null,a),s.lanes=l,s}function Q0(s){var a=Zn(18,null,null,0);return a.stateNode=s,a}function Jp(s,a,l){return a=Zn(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var e1=new WeakMap;function ms(s,a){if(typeof s=="object"&&s!==null){var l=e1.get(s);return l!==void 0?l:(a={value:s,source:a,stack:ge(a)},e1.set(s,a),a)}return{value:s,source:a,stack:ge(a)}}var $o=[],Ho=0,Lh=null,fc=0,gs=[],_s=0,Zr=null,Ys=1,Xs="";function _r(s,a){$o[Ho++]=fc,$o[Ho++]=Lh,Lh=s,fc=a}function t1(s,a,l){gs[_s++]=Ys,gs[_s++]=Xs,gs[_s++]=Zr,Zr=s;var h=Ys;s=Xs;var m=32-Dt(h)-1;h&=~(1<<m),l+=1;var _=32-Dt(a)+m;if(30<_){var C=m-m%5;_=(h&(1<<C)-1).toString(32),h>>=C,m-=C,Ys=1<<32-Dt(a)+m|l<<m|h,Xs=_+s}else Ys=1<<_|l<<m|h,Xs=s}function Qp(s){s.return!==null&&(_r(s,1),t1(s,1,0))}function em(s){for(;s===Lh;)Lh=$o[--Ho],$o[Ho]=null,fc=$o[--Ho],$o[Ho]=null;for(;s===Zr;)Zr=gs[--_s],gs[_s]=null,Xs=gs[--_s],gs[_s]=null,Ys=gs[--_s],gs[_s]=null}function i1(s,a){gs[_s++]=Ys,gs[_s++]=Xs,gs[_s++]=Zr,Ys=a.id,Xs=a.overflow,Zr=s}var Ji=null,Kt=null,mt=!1,Jr=null,vs=!1,tm=Error(n(519));function Qr(s){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pc(ms(a,s)),tm}function n1(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[He]=s,a[ye]=h,l){case"dialog":ct("cancel",a),ct("close",a);break;case"iframe":case"object":case"embed":ct("load",a);break;case"video":case"audio":for(l=0;l<Ic.length;l++)ct(Ic[l],a);break;case"source":ct("error",a);break;case"img":case"image":case"link":ct("error",a),ct("load",a);break;case"details":ct("toggle",a);break;case"input":ct("invalid",a),$a(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":ct("invalid",a);break;case"textarea":ct("invalid",a),Do(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||bw(a.textContent,l)?(h.popover!=null&&(ct("beforetoggle",a),ct("toggle",a)),h.onScroll!=null&&ct("scroll",a),h.onScrollEnd!=null&&ct("scrollend",a),h.onClick!=null&&(a.onclick=we),a=!0):a=!1,a||Qr(s,!0)}function s1(s){for(Ji=s.return;Ji;)switch(Ji.tag){case 5:case 31:case 13:vs=!1;return;case 27:case 3:vs=!0;return;default:Ji=Ji.return}}function Fo(s){if(s!==Ji)return!1;if(!mt)return s1(s),mt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||yg(s.type,s.memoizedProps)),l=!l),l&&Kt&&Qr(s),s1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));Kt=Rw(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));Kt=Rw(s)}else a===27?(a=Kt,fa(s.type)?(s=Cg,Cg=null,Kt=s):Kt=a):Kt=Ji?bs(s.stateNode.nextSibling):null;return!0}function qa(){Kt=Ji=null,mt=!1}function im(){var s=Jr;return s!==null&&(jn===null?jn=s:jn.push.apply(jn,s),Jr=null),s}function pc(s){Jr===null?Jr=[s]:Jr.push(s)}var nm=B(null),Ka=null,vr=null;function ea(s,a,l){W(nm,a._currentValue),a._currentValue=l}function yr(s){s._currentValue=nm.current,Z(nm)}function sm(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 rm(s,a,l,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var _=m.dependencies;if(_!==null){var C=m.child;_=_.firstContext;e:for(;_!==null;){var M=_;_=m;for(var q=0;q<a.length;q++)if(M.context===a[q]){_.lanes|=l,M=_.alternate,M!==null&&(M.lanes|=l),sm(_.return,l,s),h||(C=null);break e}_=M.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(n(341));C.lanes|=l,_=C.alternate,_!==null&&(_.lanes|=l),sm(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 Uo(s,a,l,h){s=null;for(var m=a,_=!1;m!==null;){if(!_){if((m.flags&524288)!==0)_=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var C=m.alternate;if(C===null)throw Error(n(387));if(C=C.memoizedProps,C!==null){var M=m.type;Xn(m.pendingProps.value,C.value)||(s!==null?s.push(M):s=[M])}}else if(m===xe.current){if(C=m.alternate,C===null)throw Error(n(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Hc):s=[Hc])}m=m.return}s!==null&&rm(a,s,l,h),a.flags|=262144}function Mh(s){for(s=s.firstContext;s!==null;){if(!Xn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Va(s){Ka=s,vr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Qi(s){return r1(Ka,s)}function Oh(s,a){return Ka===null&&Va(s),r1(s,a)}function r1(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},vr===null){if(s===null)throw Error(n(308));vr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else vr=vr.next=a;return l}var yL=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()})}},bL=e.unstable_scheduleCallback,SL=e.unstable_NormalPriority,xi={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function am(){return{controller:new yL,data:new Map,refCount:0}}function mc(s){s.refCount--,s.refCount===0&&bL(SL,function(){s.controller.abort()})}var gc=null,om=0,Wo=0,Go=null;function wL(s,a){if(gc===null){var l=gc=[];om=0,Wo=ug(),Go={status:"pending",value:void 0,then:function(h){l.push(h)}}}return om++,a.then(a1,a1),a}function a1(){if(--om===0&&gc!==null){Go!==null&&(Go.status="fulfilled");var s=gc;gc=null,Wo=0,Go=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function xL(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 o1=E.S;E.S=function(s,a){WS=Mt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&wL(s,a),o1!==null&&o1(s,a)};var Ya=B(null);function lm(){var s=Ya.current;return s!==null?s:Ut.pooledCache}function Dh(s,a){a===null?W(Ya,Ya.current):W(Ya,a.pool)}function l1(){var s=lm();return s===null?null:{parent:xi._currentValue,pool:s}}var qo=Error(n(460)),cm=Error(n(474)),jh=Error(n(542)),Ih={then:function(){}};function c1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function u1(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(we,we),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,d1(s),s;default:if(typeof a.status=="string")a.then(we,we);else{if(s=Ut,s!==null&&100<s.shellSuspendCounter)throw Error(n(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,d1(s),s}throw Za=a,qo}}function Xa(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Za=l,qo):l}}var Za=null;function h1(){if(Za===null)throw Error(n(459));var s=Za;return Za=null,s}function d1(s){if(s===qo||s===jh)throw Error(n(483))}var Ko=null,_c=0;function Bh(s){var a=_c;return _c+=1,Ko===null&&(Ko=[]),u1(Ko,s,a)}function vc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Ph(s,a){throw a.$$typeof===y?Error(n(525)):(s=Object.prototype.toString.call(a),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function f1(s){function a(X,Y){if(s){var ee=X.deletions;ee===null?(X.deletions=[Y],X.flags|=16):ee.push(Y)}}function l(X,Y){if(!s)return null;for(;Y!==null;)a(X,Y),Y=Y.sibling;return null}function h(X){for(var Y=new Map;X!==null;)X.key!==null?Y.set(X.key,X):Y.set(X.index,X),X=X.sibling;return Y}function m(X,Y){return X=gr(X,Y),X.index=0,X.sibling=null,X}function _(X,Y,ee){return X.index=ee,s?(ee=X.alternate,ee!==null?(ee=ee.index,ee<Y?(X.flags|=67108866,Y):ee):(X.flags|=67108866,Y)):(X.flags|=1048576,Y)}function C(X){return s&&X.alternate===null&&(X.flags|=67108866),X}function M(X,Y,ee,he){return Y===null||Y.tag!==6?(Y=Zp(ee,X.mode,he),Y.return=X,Y):(Y=m(Y,ee),Y.return=X,Y)}function q(X,Y,ee,he){var ze=ee.type;return ze===x?le(X,Y,ee.props.children,he,ee.key):Y!==null&&(Y.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&Xa(ze)===Y.type)?(Y=m(Y,ee.props),vc(Y,ee),Y.return=X,Y):(Y=Nh(ee.type,ee.key,ee.props,null,X.mode,he),vc(Y,ee),Y.return=X,Y)}function te(X,Y,ee,he){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ee.containerInfo||Y.stateNode.implementation!==ee.implementation?(Y=Jp(ee,X.mode,he),Y.return=X,Y):(Y=m(Y,ee.children||[]),Y.return=X,Y)}function le(X,Y,ee,he,ze){return Y===null||Y.tag!==7?(Y=Ga(ee,X.mode,he,ze),Y.return=X,Y):(Y=m(Y,ee),Y.return=X,Y)}function de(X,Y,ee){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Zp(""+Y,X.mode,ee),Y.return=X,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return ee=Nh(Y.type,Y.key,Y.props,null,X.mode,ee),vc(ee,Y),ee.return=X,ee;case w:return Y=Jp(Y,X.mode,ee),Y.return=X,Y;case U:return Y=Xa(Y),de(X,Y,ee)}if(T(Y)||z(Y))return Y=Ga(Y,X.mode,ee,null),Y.return=X,Y;if(typeof Y.then=="function")return de(X,Bh(Y),ee);if(Y.$$typeof===I)return de(X,Oh(X,Y),ee);Ph(X,Y)}return null}function ne(X,Y,ee,he){var ze=Y!==null?Y.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ze!==null?null:M(X,Y,""+ee,he);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case S:return ee.key===ze?q(X,Y,ee,he):null;case w:return ee.key===ze?te(X,Y,ee,he):null;case U:return ee=Xa(ee),ne(X,Y,ee,he)}if(T(ee)||z(ee))return ze!==null?null:le(X,Y,ee,he,null);if(typeof ee.then=="function")return ne(X,Y,Bh(ee),he);if(ee.$$typeof===I)return ne(X,Y,Oh(X,ee),he);Ph(X,ee)}return null}function se(X,Y,ee,he,ze){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return X=X.get(ee)||null,M(Y,X,""+he,ze);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case S:return X=X.get(he.key===null?ee:he.key)||null,q(Y,X,he,ze);case w:return X=X.get(he.key===null?ee:he.key)||null,te(Y,X,he,ze);case U:return he=Xa(he),se(X,Y,ee,he,ze)}if(T(he)||z(he))return X=X.get(ee)||null,le(Y,X,he,ze,null);if(typeof he.then=="function")return se(X,Y,ee,Bh(he),ze);if(he.$$typeof===I)return se(X,Y,ee,Oh(Y,he),ze);Ph(Y,he)}return null}function Ne(X,Y,ee,he){for(var ze=null,xt=null,De=Y,tt=Y=0,ft=null;De!==null&&tt<ee.length;tt++){De.index>tt?(ft=De,De=null):ft=De.sibling;var Ct=ne(X,De,ee[tt],he);if(Ct===null){De===null&&(De=ft);break}s&&De&&Ct.alternate===null&&a(X,De),Y=_(Ct,Y,tt),xt===null?ze=Ct:xt.sibling=Ct,xt=Ct,De=ft}if(tt===ee.length)return l(X,De),mt&&_r(X,tt),ze;if(De===null){for(;tt<ee.length;tt++)De=de(X,ee[tt],he),De!==null&&(Y=_(De,Y,tt),xt===null?ze=De:xt.sibling=De,xt=De);return mt&&_r(X,tt),ze}for(De=h(De);tt<ee.length;tt++)ft=se(De,X,tt,ee[tt],he),ft!==null&&(s&&ft.alternate!==null&&De.delete(ft.key===null?tt:ft.key),Y=_(ft,Y,tt),xt===null?ze=ft:xt.sibling=ft,xt=ft);return s&&De.forEach(function(va){return a(X,va)}),mt&&_r(X,tt),ze}function We(X,Y,ee,he){if(ee==null)throw Error(n(151));for(var ze=null,xt=null,De=Y,tt=Y=0,ft=null,Ct=ee.next();De!==null&&!Ct.done;tt++,Ct=ee.next()){De.index>tt?(ft=De,De=null):ft=De.sibling;var va=ne(X,De,Ct.value,he);if(va===null){De===null&&(De=ft);break}s&&De&&va.alternate===null&&a(X,De),Y=_(va,Y,tt),xt===null?ze=va:xt.sibling=va,xt=va,De=ft}if(Ct.done)return l(X,De),mt&&_r(X,tt),ze;if(De===null){for(;!Ct.done;tt++,Ct=ee.next())Ct=de(X,Ct.value,he),Ct!==null&&(Y=_(Ct,Y,tt),xt===null?ze=Ct:xt.sibling=Ct,xt=Ct);return mt&&_r(X,tt),ze}for(De=h(De);!Ct.done;tt++,Ct=ee.next())Ct=se(De,X,tt,Ct.value,he),Ct!==null&&(s&&Ct.alternate!==null&&De.delete(Ct.key===null?tt:Ct.key),Y=_(Ct,Y,tt),xt===null?ze=Ct:xt.sibling=Ct,xt=Ct);return s&&De.forEach(function(DM){return a(X,DM)}),mt&&_r(X,tt),ze}function Pt(X,Y,ee,he){if(typeof ee=="object"&&ee!==null&&ee.type===x&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case S:e:{for(var ze=ee.key;Y!==null;){if(Y.key===ze){if(ze=ee.type,ze===x){if(Y.tag===7){l(X,Y.sibling),he=m(Y,ee.props.children),he.return=X,X=he;break e}}else if(Y.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&Xa(ze)===Y.type){l(X,Y.sibling),he=m(Y,ee.props),vc(he,ee),he.return=X,X=he;break e}l(X,Y);break}else a(X,Y);Y=Y.sibling}ee.type===x?(he=Ga(ee.props.children,X.mode,he,ee.key),he.return=X,X=he):(he=Nh(ee.type,ee.key,ee.props,null,X.mode,he),vc(he,ee),he.return=X,X=he)}return C(X);case w:e:{for(ze=ee.key;Y!==null;){if(Y.key===ze)if(Y.tag===4&&Y.stateNode.containerInfo===ee.containerInfo&&Y.stateNode.implementation===ee.implementation){l(X,Y.sibling),he=m(Y,ee.children||[]),he.return=X,X=he;break e}else{l(X,Y);break}else a(X,Y);Y=Y.sibling}he=Jp(ee,X.mode,he),he.return=X,X=he}return C(X);case U:return ee=Xa(ee),Pt(X,Y,ee,he)}if(T(ee))return Ne(X,Y,ee,he);if(z(ee)){if(ze=z(ee),typeof ze!="function")throw Error(n(150));return ee=ze.call(ee),We(X,Y,ee,he)}if(typeof ee.then=="function")return Pt(X,Y,Bh(ee),he);if(ee.$$typeof===I)return Pt(X,Y,Oh(X,ee),he);Ph(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,Y!==null&&Y.tag===6?(l(X,Y.sibling),he=m(Y,ee),he.return=X,X=he):(l(X,Y),he=Zp(ee,X.mode,he),he.return=X,X=he),C(X)):l(X,Y)}return function(X,Y,ee,he){try{_c=0;var ze=Pt(X,Y,ee,he);return Ko=null,ze}catch(De){if(De===qo||De===jh)throw De;var xt=Zn(29,De,null,X.mode);return xt.lanes=he,xt.return=X,xt}}}var Ja=f1(!0),p1=f1(!1),ta=!1;function um(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hm(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 ia(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function na(s,a,l){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Et&2)!==0){var m=h.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),h.pending=a,a=Rh(s),Z0(s,null,l),a}return Ah(s,h,a,l),Rh(s)}function yc(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,$e(s,l)}}function dm(s,a){var l=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var m=null,_=null;if(l=l.firstBaseUpdate,l!==null){do{var C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};_===null?m=_=C:_=_.next=C,l=l.next}while(l!==null);_===null?m=_=a:_=_.next=a}else m=_=a;l={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:_,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 fm=!1;function bc(){if(fm){var s=Go;if(s!==null)throw s}}function Sc(s,a,l,h){fm=!1;var m=s.updateQueue;ta=!1;var _=m.firstBaseUpdate,C=m.lastBaseUpdate,M=m.shared.pending;if(M!==null){m.shared.pending=null;var q=M,te=q.next;q.next=null,C===null?_=te:C.next=te,C=q;var le=s.alternate;le!==null&&(le=le.updateQueue,M=le.lastBaseUpdate,M!==C&&(M===null?le.firstBaseUpdate=te:M.next=te,le.lastBaseUpdate=q))}if(_!==null){var de=m.baseState;C=0,le=te=q=null,M=_;do{var ne=M.lane&-536870913,se=ne!==M.lane;if(se?(dt&ne)===ne:(h&ne)===ne){ne!==0&&ne===Wo&&(fm=!0),le!==null&&(le=le.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Ne=s,We=M;ne=a;var Pt=l;switch(We.tag){case 1:if(Ne=We.payload,typeof Ne=="function"){de=Ne.call(Pt,de,ne);break e}de=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=We.payload,ne=typeof Ne=="function"?Ne.call(Pt,de,ne):Ne,ne==null)break e;de=v({},de,ne);break e;case 2:ta=!0}}ne=M.callback,ne!==null&&(s.flags|=64,se&&(s.flags|=8192),se=m.callbacks,se===null?m.callbacks=[ne]:se.push(ne))}else se={lane:ne,tag:M.tag,payload:M.payload,callback:M.callback,next:null},le===null?(te=le=se,q=de):le=le.next=se,C|=ne;if(M=M.next,M===null){if(M=m.shared.pending,M===null)break;se=M,M=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);le===null&&(q=de),m.baseState=q,m.firstBaseUpdate=te,m.lastBaseUpdate=le,_===null&&(m.shared.lanes=0),la|=C,s.lanes=C,s.memoizedState=de}}function m1(s,a){if(typeof s!="function")throw Error(n(191,s));s.call(a)}function g1(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)m1(l[s],a)}var Vo=B(null),zh=B(0);function _1(s,a){s=Ar,W(zh,s),W(Vo,a),Ar=s|a.baseLanes}function pm(){W(zh,Ar),W(Vo,Vo.current)}function mm(){Ar=zh.current,Z(Vo),Z(zh)}var Jn=B(null),ys=null;function sa(s){var a=s.alternate;W(vi,vi.current&1),W(Jn,s),ys===null&&(a===null||Vo.current!==null||a.memoizedState!==null)&&(ys=s)}function gm(s){W(vi,vi.current),W(Jn,s),ys===null&&(ys=s)}function v1(s){s.tag===22?(W(vi,vi.current),W(Jn,s),ys===null&&(ys=s)):ra()}function ra(){W(vi,vi.current),W(Jn,Jn.current)}function Qn(s){Z(Jn),ys===s&&(ys=null),Z(vi)}var vi=B(0);function $h(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||wg(l)||xg(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 br=0,et=null,It=null,Ci=null,Hh=!1,Yo=!1,Qa=!1,Fh=0,wc=0,Xo=null,CL=0;function ci(){throw Error(n(321))}function _m(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!Xn(s[l],a[l]))return!1;return!0}function vm(s,a,l,h,m,_){return br=_,et=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,E.H=s===null||s.memoizedState===null?tS:Om,Qa=!1,_=l(h,m),Qa=!1,Yo&&(_=b1(a,l,h,m)),y1(s),_}function y1(s){E.H=kc;var a=It!==null&&It.next!==null;if(br=0,Ci=It=et=null,Hh=!1,wc=0,Xo=null,a)throw Error(n(300));s===null||ki||(s=s.dependencies,s!==null&&Mh(s)&&(ki=!0))}function b1(s,a,l,h){et=s;var m=0;do{if(Yo&&(Xo=null),wc=0,Yo=!1,25<=m)throw Error(n(301));if(m+=1,Ci=It=null,s.updateQueue!=null){var _=s.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}E.H=iS,_=a(l,h)}while(Yo);return _}function kL(){var s=E.H,a=s.useState()[0];return a=typeof a.then=="function"?xc(a):a,s=s.useState()[0],(It!==null?It.memoizedState:null)!==s&&(et.flags|=1024),a}function ym(){var s=Fh!==0;return Fh=0,s}function bm(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Sm(s){if(Hh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Hh=!1}br=0,Ci=It=et=null,Yo=!1,wc=Fh=0,Xo=null}function vn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ci===null?et.memoizedState=Ci=s:Ci=Ci.next=s,Ci}function yi(){if(It===null){var s=et.alternate;s=s!==null?s.memoizedState:null}else s=It.next;var a=Ci===null?et.memoizedState:Ci.next;if(a!==null)Ci=a,It=s;else{if(s===null)throw et.alternate===null?Error(n(467)):Error(n(310));It=s,s={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},Ci===null?et.memoizedState=Ci=s:Ci=Ci.next=s}return Ci}function Uh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xc(s){var a=wc;return wc+=1,Xo===null&&(Xo=[]),s=u1(Xo,s,a),a=et,(Ci===null?a.memoizedState:Ci.next)===null&&(a=a.alternate,E.H=a===null||a.memoizedState===null?tS:Om),s}function Wh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return xc(s);if(s.$$typeof===I)return Qi(s)}throw Error(n(438,String(s)))}function wm(s){var a=null,l=et.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=et.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=Uh(),et.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]=fe;return a.index++,l}function Sr(s,a){return typeof a=="function"?a(s):a}function Gh(s){var a=yi();return xm(a,It,s)}function xm(s,a,l){var h=s.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=l;var m=s.baseQueue,_=h.pending;if(_!==null){if(m!==null){var C=m.next;m.next=_.next,_.next=C}a.baseQueue=m=_,h.pending=null}if(_=s.baseState,m===null)s.memoizedState=_;else{a=m.next;var M=C=null,q=null,te=a,le=!1;do{var de=te.lane&-536870913;if(de!==te.lane?(dt&de)===de:(br&de)===de){var ne=te.revertLane;if(ne===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),de===Wo&&(le=!0);else if((br&ne)===ne){te=te.next,ne===Wo&&(le=!0);continue}else de={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},q===null?(M=q=de,C=_):q=q.next=de,et.lanes|=ne,la|=ne;de=te.action,Qa&&l(_,de),_=te.hasEagerState?te.eagerState:l(_,de)}else ne={lane:de,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},q===null?(M=q=ne,C=_):q=q.next=ne,et.lanes|=de,la|=de;te=te.next}while(te!==null&&te!==a);if(q===null?C=_:q.next=M,!Xn(_,s.memoizedState)&&(ki=!0,le&&(l=Go,l!==null)))throw l;s.memoizedState=_,s.baseState=C,s.baseQueue=q,h.lastRenderedState=_}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Cm(s){var a=yi(),l=a.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=s;var h=l.dispatch,m=l.pending,_=a.memoizedState;if(m!==null){l.pending=null;var C=m=m.next;do _=s(_,C.action),C=C.next;while(C!==m);Xn(_,a.memoizedState)||(ki=!0),a.memoizedState=_,a.baseQueue===null&&(a.baseState=_),l.lastRenderedState=_}return[_,h]}function S1(s,a,l){var h=et,m=yi(),_=mt;if(_){if(l===void 0)throw Error(n(407));l=l()}else l=a();var C=!Xn((It||m).memoizedState,l);if(C&&(m.memoizedState=l,ki=!0),m=m.queue,Tm(C1.bind(null,h,m,s),[s]),m.getSnapshot!==a||C||Ci!==null&&Ci.memoizedState.tag&1){if(h.flags|=2048,Zo(9,{destroy:void 0},x1.bind(null,h,m,l,a),null),Ut===null)throw Error(n(349));_||(br&127)!==0||w1(h,a,l)}return l}function w1(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=et.updateQueue,a===null?(a=Uh(),et.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function x1(s,a,l,h){a.value=l,a.getSnapshot=h,k1(a)&&E1(s)}function C1(s,a,l){return l(function(){k1(a)&&E1(s)})}function k1(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!Xn(s,l)}catch{return!0}}function E1(s){var a=Wa(s,2);a!==null&&In(a,s,2)}function km(s){var a=vn();if(typeof s=="function"){var l=s;if(s=l(),Qa){Ot(!0);try{l()}finally{Ot(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:s},a}function T1(s,a,l,h){return s.baseState=l,xm(s,It,typeof h=="function"?h:Sr)}function EL(s,a,l,h,m){if(Vh(s))throw Error(n(485));if(s=a.action,s!==null){var _={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){_.listeners.push(C)}};E.T!==null?l(!0):_.isTransition=!1,h(_),l=a.pending,l===null?(_.next=a.pending=_,A1(a,_)):(_.next=l.next,a.pending=l.next=_)}}function A1(s,a){var l=a.action,h=a.payload,m=s.state;if(a.isTransition){var _=E.T,C={};E.T=C;try{var M=l(m,h),q=E.S;q!==null&&q(C,M),R1(s,a,M)}catch(te){Em(s,a,te)}finally{_!==null&&C.types!==null&&(_.types=C.types),E.T=_}}else try{_=l(m,h),R1(s,a,_)}catch(te){Em(s,a,te)}}function R1(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){N1(s,a,h)},function(h){return Em(s,a,h)}):N1(s,a,l)}function N1(s,a,l){a.status="fulfilled",a.value=l,L1(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,A1(s,l)))}function Em(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,L1(a),a=a.next;while(a!==h)}s.action=null}function L1(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function M1(s,a){return a}function O1(s,a){if(mt){var l=Ut.formState;if(l!==null){e:{var h=et;if(mt){if(Kt){t:{for(var m=Kt,_=vs;m.nodeType!==8;){if(!_){m=null;break t}if(m=bs(m.nextSibling),m===null){m=null;break t}}_=m.data,m=_==="F!"||_==="F"?m:null}if(m){Kt=bs(m.nextSibling),h=m.data==="F!";break e}}Qr(h)}h=!1}h&&(a=l[0])}}return l=vn(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:M1,lastRenderedState:a},l.queue=h,l=J1.bind(null,et,h),h.dispatch=l,h=km(!1),_=Mm.bind(null,et,!1,h.queue),h=vn(),m={state:a,dispatch:null,action:s,pending:null},h.queue=m,l=EL.bind(null,et,m,_,l),m.dispatch=l,h.memoizedState=s,[a,l,!1]}function D1(s){var a=yi();return j1(a,It,s)}function j1(s,a,l){if(a=xm(s,a,M1)[0],s=Gh(Sr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=xc(a)}catch(C){throw C===qo?jh:C}else h=a;a=yi();var m=a.queue,_=m.dispatch;return l!==a.memoizedState&&(et.flags|=2048,Zo(9,{destroy:void 0},TL.bind(null,m,l),null)),[h,_,s]}function TL(s,a){s.action=a}function I1(s){var a=yi(),l=It;if(l!==null)return j1(a,l,s);yi(),a=a.memoizedState,l=yi();var h=l.queue.dispatch;return l.memoizedState=s,[a,h,!1]}function Zo(s,a,l,h){return s={tag:s,create:l,deps:h,inst:a,next:null},a=et.updateQueue,a===null&&(a=Uh(),et.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 B1(){return yi().memoizedState}function qh(s,a,l,h){var m=vn();et.flags|=s,m.memoizedState=Zo(1|a,{destroy:void 0},l,h===void 0?null:h)}function Kh(s,a,l,h){var m=yi();h=h===void 0?null:h;var _=m.memoizedState.inst;It!==null&&h!==null&&_m(h,It.memoizedState.deps)?m.memoizedState=Zo(a,_,l,h):(et.flags|=s,m.memoizedState=Zo(1|a,_,l,h))}function P1(s,a){qh(8390656,8,s,a)}function Tm(s,a){Kh(2048,8,s,a)}function AL(s){et.flags|=4;var a=et.updateQueue;if(a===null)a=Uh(),et.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function z1(s){var a=yi().memoizedState;return AL({ref:a,nextImpl:s}),function(){if((Et&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function $1(s,a){return Kh(4,2,s,a)}function H1(s,a){return Kh(4,4,s,a)}function F1(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 U1(s,a,l){l=l!=null?l.concat([s]):null,Kh(4,4,F1.bind(null,a,s),l)}function Am(){}function W1(s,a){var l=yi();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&_m(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function G1(s,a){var l=yi();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&_m(a,h[1]))return h[0];if(h=s(),Qa){Ot(!0);try{s()}finally{Ot(!1)}}return l.memoizedState=[h,a],h}function Rm(s,a,l){return l===void 0||(br&1073741824)!==0&&(dt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=qS(),et.lanes|=s,la|=s,l)}function q1(s,a,l,h){return Xn(l,a)?l:Vo.current!==null?(s=Rm(s,l,h),Xn(s,a)||(ki=!0),s):(br&42)===0||(br&1073741824)!==0&&(dt&261930)===0?(ki=!0,s.memoizedState=l):(s=qS(),et.lanes|=s,la|=s,a)}function K1(s,a,l,h,m){var _=j.p;j.p=_!==0&&8>_?_:8;var C=E.T,M={};E.T=M,Mm(s,!1,a,l);try{var q=m(),te=E.S;if(te!==null&&te(M,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var le=xL(q,h);Cc(s,a,le,is(s))}else Cc(s,a,h,is(s))}catch(de){Cc(s,a,{then:function(){},status:"rejected",reason:de},is())}finally{j.p=_,C!==null&&M.types!==null&&(C.types=M.types),E.T=C}}function RL(){}function Nm(s,a,l,h){if(s.tag!==5)throw Error(n(476));var m=V1(s).queue;K1(s,m,a,P,l===null?RL:function(){return Y1(s),l(h)})}function V1(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:P},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function Y1(s){var a=V1(s);a.next===null&&(a=s.alternate.memoizedState),Cc(s,a.next.queue,{},is())}function Lm(){return Qi(Hc)}function X1(){return yi().memoizedState}function Z1(){return yi().memoizedState}function NL(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=is();s=ia(l);var h=na(a,s,l);h!==null&&(In(h,a,l),yc(h,a,l)),a={cache:am()},s.payload=a;return}a=a.return}}function LL(s,a,l){var h=is();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Vh(s)?Q1(a,l):(l=Yp(s,a,l,h),l!==null&&(In(l,s,h),eS(l,a,h)))}function J1(s,a,l){var h=is();Cc(s,a,l,h)}function Cc(s,a,l,h){var m={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Vh(s))Q1(a,m);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=a.lastRenderedReducer,_!==null))try{var C=a.lastRenderedState,M=_(C,l);if(m.hasEagerState=!0,m.eagerState=M,Xn(M,C))return Ah(s,a,m,0),Ut===null&&Th(),!1}catch{}if(l=Yp(s,a,m,h),l!==null)return In(l,s,h),eS(l,a,h),!0}return!1}function Mm(s,a,l,h){if(h={lane:2,revertLane:ug(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Vh(s)){if(a)throw Error(n(479))}else a=Yp(s,l,h,2),a!==null&&In(a,s,2)}function Vh(s){var a=s.alternate;return s===et||a!==null&&a===et}function Q1(s,a){Yo=Hh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function eS(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,$e(s,l)}}var kc={readContext:Qi,use:Wh,useCallback:ci,useContext:ci,useEffect:ci,useImperativeHandle:ci,useLayoutEffect:ci,useInsertionEffect:ci,useMemo:ci,useReducer:ci,useRef:ci,useState:ci,useDebugValue:ci,useDeferredValue:ci,useTransition:ci,useSyncExternalStore:ci,useId:ci,useHostTransitionStatus:ci,useFormState:ci,useActionState:ci,useOptimistic:ci,useMemoCache:ci,useCacheRefresh:ci};kc.useEffectEvent=ci;var tS={readContext:Qi,use:Wh,useCallback:function(s,a){return vn().memoizedState=[s,a===void 0?null:a],s},useContext:Qi,useEffect:P1,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,qh(4194308,4,F1.bind(null,a,s),l)},useLayoutEffect:function(s,a){return qh(4194308,4,s,a)},useInsertionEffect:function(s,a){qh(4,2,s,a)},useMemo:function(s,a){var l=vn();a=a===void 0?null:a;var h=s();if(Qa){Ot(!0);try{s()}finally{Ot(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=vn();if(l!==void 0){var m=l(a);if(Qa){Ot(!0);try{l(a)}finally{Ot(!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=LL.bind(null,et,s),[h.memoizedState,s]},useRef:function(s){var a=vn();return s={current:s},a.memoizedState=s},useState:function(s){s=km(s);var a=s.queue,l=J1.bind(null,et,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Am,useDeferredValue:function(s,a){var l=vn();return Rm(l,s,a)},useTransition:function(){var s=km(!1);return s=K1.bind(null,et,s.queue,!0,!1),vn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=et,m=vn();if(mt){if(l===void 0)throw Error(n(407));l=l()}else{if(l=a(),Ut===null)throw Error(n(349));(dt&127)!==0||w1(h,a,l)}m.memoizedState=l;var _={value:l,getSnapshot:a};return m.queue=_,P1(C1.bind(null,h,_,s),[s]),h.flags|=2048,Zo(9,{destroy:void 0},x1.bind(null,h,_,l,a),null),l},useId:function(){var s=vn(),a=Ut.identifierPrefix;if(mt){var l=Xs,h=Ys;l=(h&~(1<<32-Dt(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=Fh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=CL++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Lm,useFormState:O1,useActionState:O1,useOptimistic:function(s){var a=vn();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Mm.bind(null,et,!0,l),l.dispatch=a,[s,a]},useMemoCache:wm,useCacheRefresh:function(){return vn().memoizedState=NL.bind(null,et)},useEffectEvent:function(s){var a=vn(),l={impl:s};return a.memoizedState=l,function(){if((Et&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}},Om={readContext:Qi,use:Wh,useCallback:W1,useContext:Qi,useEffect:Tm,useImperativeHandle:U1,useInsertionEffect:$1,useLayoutEffect:H1,useMemo:G1,useReducer:Gh,useRef:B1,useState:function(){return Gh(Sr)},useDebugValue:Am,useDeferredValue:function(s,a){var l=yi();return q1(l,It.memoizedState,s,a)},useTransition:function(){var s=Gh(Sr)[0],a=yi().memoizedState;return[typeof s=="boolean"?s:xc(s),a]},useSyncExternalStore:S1,useId:X1,useHostTransitionStatus:Lm,useFormState:D1,useActionState:D1,useOptimistic:function(s,a){var l=yi();return T1(l,It,s,a)},useMemoCache:wm,useCacheRefresh:Z1};Om.useEffectEvent=z1;var iS={readContext:Qi,use:Wh,useCallback:W1,useContext:Qi,useEffect:Tm,useImperativeHandle:U1,useInsertionEffect:$1,useLayoutEffect:H1,useMemo:G1,useReducer:Cm,useRef:B1,useState:function(){return Cm(Sr)},useDebugValue:Am,useDeferredValue:function(s,a){var l=yi();return It===null?Rm(l,s,a):q1(l,It.memoizedState,s,a)},useTransition:function(){var s=Cm(Sr)[0],a=yi().memoizedState;return[typeof s=="boolean"?s:xc(s),a]},useSyncExternalStore:S1,useId:X1,useHostTransitionStatus:Lm,useFormState:I1,useActionState:I1,useOptimistic:function(s,a){var l=yi();return It!==null?T1(l,It,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:wm,useCacheRefresh:Z1};iS.useEffectEvent=z1;function Dm(s,a,l,h){a=s.memoizedState,l=l(h,a),l=l==null?a:v({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var jm={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=is(),m=ia(h);m.payload=a,l!=null&&(m.callback=l),a=na(s,m,h),a!==null&&(In(a,s,h),yc(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=is(),m=ia(h);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=na(s,m,h),a!==null&&(In(a,s,h),yc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=is(),h=ia(l);h.tag=2,a!=null&&(h.callback=a),a=na(s,h,l),a!==null&&(In(a,s,l),yc(a,s,l))}};function nS(s,a,l,h,m,_,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,_,C):a.prototype&&a.prototype.isPureReactComponent?!hc(l,h)||!hc(m,_):!0}function sS(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&&jm.enqueueReplaceState(a,a.state,null)}function eo(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=v({},l));for(var m in s)l[m]===void 0&&(l[m]=s[m])}return l}function rS(s){Eh(s)}function aS(s){console.error(s)}function oS(s){Eh(s)}function Yh(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function lS(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 Im(s,a,l){return l=ia(l),l.tag=3,l.payload={element:null},l.callback=function(){Yh(s,a)},l}function cS(s){return s=ia(s),s.tag=3,s}function uS(s,a,l,h){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var _=h.value;s.payload=function(){return m(_)},s.callback=function(){lS(a,l,h)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){lS(a,l,h),typeof m!="function"&&(ca===null?ca=new Set([this]):ca.add(this));var M=h.stack;this.componentDidCatch(h.value,{componentStack:M!==null?M:""})})}function ML(s,a,l,h,m){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&Uo(a,l,m,!0),l=Jn.current,l!==null){switch(l.tag){case 31:case 13:return ys===null?od():l.alternate===null&&ui===0&&(ui=3),l.flags&=-257,l.flags|=65536,l.lanes=m,h===Ih?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),og(s,h,m)),!1;case 22:return l.flags|=65536,h===Ih?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)),og(s,h,m)),!1}throw Error(n(435,l.tag))}return og(s,h,m),od(),!1}if(mt)return a=Jn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,h!==tm&&(s=Error(n(422),{cause:h}),pc(ms(s,l)))):(h!==tm&&(a=Error(n(423),{cause:h}),pc(ms(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=ms(h,l),m=Im(s.stateNode,h,m),dm(s,m),ui!==4&&(ui=2)),!1;var _=Error(n(520),{cause:h});if(_=ms(_,l),Oc===null?Oc=[_]:Oc.push(_),ui!==4&&(ui=2),a===null)return!0;h=ms(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=Im(l.stateNode,h,s),dm(l,s),!1;case 1:if(a=l.type,_=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(ca===null||!ca.has(_))))return l.flags|=65536,m&=-m,l.lanes|=m,m=cS(m),uS(m,s,l,h),dm(l,m),!1}l=l.return}while(l!==null);return!1}var Bm=Error(n(461)),ki=!1;function en(s,a,l,h){a.child=s===null?p1(a,null,l,h):Ja(a,s.child,l,h)}function hS(s,a,l,h,m){l=l.render;var _=a.ref;if("ref"in h){var C={};for(var M in h)M!=="ref"&&(C[M]=h[M])}else C=h;return Va(a),h=vm(s,a,l,C,_,m),M=ym(),s!==null&&!ki?(bm(s,a,m),wr(s,a,m)):(mt&&M&&Qp(a),a.flags|=1,en(s,a,h,m),a.child)}function dS(s,a,l,h,m){if(s===null){var _=l.type;return typeof _=="function"&&!Xp(_)&&_.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=_,fS(s,a,_,h,m)):(s=Nh(l.type,null,h,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(_=s.child,!Gm(s,m)){var C=_.memoizedProps;if(l=l.compare,l=l!==null?l:hc,l(C,h)&&s.ref===a.ref)return wr(s,a,m)}return a.flags|=1,s=gr(_,h),s.ref=a.ref,s.return=a,a.child=s}function fS(s,a,l,h,m){if(s!==null){var _=s.memoizedProps;if(hc(_,h)&&s.ref===a.ref)if(ki=!1,a.pendingProps=h=_,Gm(s,m))(s.flags&131072)!==0&&(ki=!0);else return a.lanes=s.lanes,wr(s,a,m)}return Pm(s,a,l,h,m)}function pS(s,a,l,h){var m=h.children,_=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(_=_!==null?_.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&~_}else h=0,a.child=null;return mS(s,a,_,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Dh(a,_!==null?_.cachePool:null),_!==null?_1(a,_):pm(),v1(a);else return h=a.lanes=536870912,mS(s,a,_!==null?_.baseLanes|l:l,l,h)}else _!==null?(Dh(a,_.cachePool),_1(a,_),ra(),a.memoizedState=null):(s!==null&&Dh(a,null),pm(),ra());return en(s,a,m,l),a.child}function Ec(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function mS(s,a,l,h,m){var _=lm();return _=_===null?null:{parent:xi._currentValue,pool:_},a.memoizedState={baseLanes:l,cachePool:_},s!==null&&Dh(a,null),pm(),v1(a),s!==null&&Uo(s,a,h,!0),a.childLanes=m,null}function Xh(s,a){return a=Jh({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function gS(s,a,l){return Ja(a,s.child,null,l),s=Xh(a,a.pendingProps),s.flags|=2,Qn(a),a.memoizedState=null,s}function OL(s,a,l){var h=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(mt){if(h.mode==="hidden")return s=Xh(a,h),a.lanes=536870912,Ec(null,s);if(gm(a),(s=Kt)?(s=Aw(s,vs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Zr!==null?{id:Ys,overflow:Xs}:null,retryLane:536870912,hydrationErrors:null},l=Q0(s),l.return=a,a.child=l,Ji=a,Kt=null)):s=null,s===null)throw Qr(a);return a.lanes=536870912,null}return Xh(a,h)}var _=s.memoizedState;if(_!==null){var C=_.dehydrated;if(gm(a),m)if(a.flags&256)a.flags&=-257,a=gS(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(n(558));else if(ki||Uo(s,a,l,!1),m=(l&s.childLanes)!==0,ki||m){if(h=Ut,h!==null&&(C=Ft(h,l),C!==0&&C!==_.retryLane))throw _.retryLane=C,Wa(s,C),In(h,s,C),Bm;od(),a=gS(s,a,l)}else s=_.treeContext,Kt=bs(C.nextSibling),Ji=a,mt=!0,Jr=null,vs=!1,s!==null&&i1(a,s),a=Xh(a,h),a.flags|=4096;return a}return s=gr(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Zh(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(n(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function Pm(s,a,l,h,m){return Va(a),l=vm(s,a,l,h,void 0,m),h=ym(),s!==null&&!ki?(bm(s,a,m),wr(s,a,m)):(mt&&h&&Qp(a),a.flags|=1,en(s,a,l,m),a.child)}function _S(s,a,l,h,m,_){return Va(a),a.updateQueue=null,l=b1(a,h,l,m),y1(s),h=ym(),s!==null&&!ki?(bm(s,a,_),wr(s,a,_)):(mt&&h&&Qp(a),a.flags|=1,en(s,a,l,_),a.child)}function vS(s,a,l,h,m){if(Va(a),a.stateNode===null){var _=zo,C=l.contextType;typeof C=="object"&&C!==null&&(_=Qi(C)),_=new l(h,_),a.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=jm,a.stateNode=_,_._reactInternals=a,_=a.stateNode,_.props=h,_.state=a.memoizedState,_.refs={},um(a),C=l.contextType,_.context=typeof C=="object"&&C!==null?Qi(C):zo,_.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(Dm(a,l,C,h),_.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(C=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),C!==_.state&&jm.enqueueReplaceState(_,_.state,null),Sc(a,h,_,m),bc(),_.state=a.memoizedState),typeof _.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){_=a.stateNode;var M=a.memoizedProps,q=eo(l,M);_.props=q;var te=_.context,le=l.contextType;C=zo,typeof le=="object"&&le!==null&&(C=Qi(le));var de=l.getDerivedStateFromProps;le=typeof de=="function"||typeof _.getSnapshotBeforeUpdate=="function",M=a.pendingProps!==M,le||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(M||te!==C)&&sS(a,_,h,C),ta=!1;var ne=a.memoizedState;_.state=ne,Sc(a,h,_,m),bc(),te=a.memoizedState,M||ne!==te||ta?(typeof de=="function"&&(Dm(a,l,de,h),te=a.memoizedState),(q=ta||nS(a,l,q,h,ne,te,C))?(le||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(a.flags|=4194308)):(typeof _.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=te),_.props=h,_.state=te,_.context=C,h=q):(typeof _.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{_=a.stateNode,hm(s,a),C=a.memoizedProps,le=eo(l,C),_.props=le,de=a.pendingProps,ne=_.context,te=l.contextType,q=zo,typeof te=="object"&&te!==null&&(q=Qi(te)),M=l.getDerivedStateFromProps,(te=typeof M=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(C!==de||ne!==q)&&sS(a,_,h,q),ta=!1,ne=a.memoizedState,_.state=ne,Sc(a,h,_,m),bc();var se=a.memoizedState;C!==de||ne!==se||ta||s!==null&&s.dependencies!==null&&Mh(s.dependencies)?(typeof M=="function"&&(Dm(a,l,M,h),se=a.memoizedState),(le=ta||nS(a,l,le,h,ne,se,q)||s!==null&&s.dependencies!==null&&Mh(s.dependencies))?(te||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(h,se,q),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(h,se,q)),typeof _.componentDidUpdate=="function"&&(a.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof _.componentDidUpdate!="function"||C===s.memoizedProps&&ne===s.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ne===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=se),_.props=h,_.state=se,_.context=q,h=le):(typeof _.componentDidUpdate!="function"||C===s.memoizedProps&&ne===s.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ne===s.memoizedState||(a.flags|=1024),h=!1)}return _=h,Zh(s,a),h=(a.flags&128)!==0,_||h?(_=a.stateNode,l=h&&typeof l.getDerivedStateFromError!="function"?null:_.render(),a.flags|=1,s!==null&&h?(a.child=Ja(a,s.child,null,m),a.child=Ja(a,null,l,m)):en(s,a,l,m),a.memoizedState=_.state,s=a.child):s=wr(s,a,m),s}function yS(s,a,l,h){return qa(),a.flags|=256,en(s,a,l,h),a.child}var zm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $m(s){return{baseLanes:s,cachePool:l1()}}function Hm(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=ts),s}function bS(s,a,l){var h=a.pendingProps,m=!1,_=(a.flags&128)!==0,C;if((C=_)||(C=s!==null&&s.memoizedState===null?!1:(vi.current&2)!==0),C&&(m=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,s===null){if(mt){if(m?sa(a):ra(),(s=Kt)?(s=Aw(s,vs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Zr!==null?{id:Ys,overflow:Xs}:null,retryLane:536870912,hydrationErrors:null},l=Q0(s),l.return=a,a.child=l,Ji=a,Kt=null)):s=null,s===null)throw Qr(a);return xg(s)?a.lanes=32:a.lanes=536870912,null}var M=h.children;return h=h.fallback,m?(ra(),m=a.mode,M=Jh({mode:"hidden",children:M},m),h=Ga(h,m,l,null),M.return=a,h.return=a,M.sibling=h,a.child=M,h=a.child,h.memoizedState=$m(l),h.childLanes=Hm(s,C,l),a.memoizedState=zm,Ec(null,h)):(sa(a),Fm(a,M))}var q=s.memoizedState;if(q!==null&&(M=q.dehydrated,M!==null)){if(_)a.flags&256?(sa(a),a.flags&=-257,a=Um(s,a,l)):a.memoizedState!==null?(ra(),a.child=s.child,a.flags|=128,a=null):(ra(),M=h.fallback,m=a.mode,h=Jh({mode:"visible",children:h.children},m),M=Ga(M,m,l,null),M.flags|=2,h.return=a,M.return=a,h.sibling=M,a.child=h,Ja(a,s.child,null,l),h=a.child,h.memoizedState=$m(l),h.childLanes=Hm(s,C,l),a.memoizedState=zm,a=Ec(null,h));else if(sa(a),xg(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var te=C.dgst;C=te,h=Error(n(419)),h.stack="",h.digest=C,pc({value:h,source:null,stack:null}),a=Um(s,a,l)}else if(ki||Uo(s,a,l,!1),C=(l&s.childLanes)!==0,ki||C){if(C=Ut,C!==null&&(h=Ft(C,l),h!==0&&h!==q.retryLane))throw q.retryLane=h,Wa(s,h),In(C,s,h),Bm;wg(M)||od(),a=Um(s,a,l)}else wg(M)?(a.flags|=192,a.child=s.child,a=null):(s=q.treeContext,Kt=bs(M.nextSibling),Ji=a,mt=!0,Jr=null,vs=!1,s!==null&&i1(a,s),a=Fm(a,h.children),a.flags|=4096);return a}return m?(ra(),M=h.fallback,m=a.mode,q=s.child,te=q.sibling,h=gr(q,{mode:"hidden",children:h.children}),h.subtreeFlags=q.subtreeFlags&65011712,te!==null?M=gr(te,M):(M=Ga(M,m,l,null),M.flags|=2),M.return=a,h.return=a,h.sibling=M,a.child=h,Ec(null,h),h=a.child,M=s.child.memoizedState,M===null?M=$m(l):(m=M.cachePool,m!==null?(q=xi._currentValue,m=m.parent!==q?{parent:q,pool:q}:m):m=l1(),M={baseLanes:M.baseLanes|l,cachePool:m}),h.memoizedState=M,h.childLanes=Hm(s,C,l),a.memoizedState=zm,Ec(s.child,h)):(sa(a),l=s.child,s=l.sibling,l=gr(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 Fm(s,a){return a=Jh({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Jh(s,a){return s=Zn(22,s,null,a),s.lanes=0,s}function Um(s,a,l){return Ja(a,s.child,null,l),s=Fm(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function SS(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),sm(s.return,a,l)}function Wm(s,a,l,h,m,_){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:m,treeForkCount:_}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=l,C.tailMode=m,C.treeForkCount=_)}function wS(s,a,l){var h=a.pendingProps,m=h.revealOrder,_=h.tail;h=h.children;var C=vi.current,M=(C&2)!==0;if(M?(C=C&1|2,a.flags|=128):C&=1,W(vi,C),en(s,a,h,l),h=mt?fc:0,!M&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&SS(s,l,a);else if(s.tag===19)SS(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&&$h(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),Wm(a,!1,m,l,_,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&&$h(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}Wm(a,!0,l,null,_,h);break;case"together":Wm(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function wr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),la|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(Uo(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(n(153));if(a.child!==null){for(s=a.child,l=gr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=gr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function Gm(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Mh(s)))}function DL(s,a,l){switch(a.tag){case 3:Te(a,a.stateNode.containerInfo),ea(a,xi,s.memoizedState.cache),qa();break;case 27:case 5:_t(a);break;case 4:Te(a,a.stateNode.containerInfo);break;case 10:ea(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,gm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(sa(a),a.flags|=128,null):(l&a.child.childLanes)!==0?bS(s,a,l):(sa(a),s=wr(s,a,l),s!==null?s.sibling:null);sa(a);break;case 19:var m=(s.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(Uo(s,a,l,!1),h=(l&a.childLanes)!==0),m){if(h)return wS(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),W(vi,vi.current),h)break;return null;case 22:return a.lanes=0,pS(s,a,l,a.pendingProps);case 24:ea(a,xi,s.memoizedState.cache)}return wr(s,a,l)}function xS(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)ki=!0;else{if(!Gm(s,l)&&(a.flags&128)===0)return ki=!1,DL(s,a,l);ki=(s.flags&131072)!==0}else ki=!1,mt&&(a.flags&1048576)!==0&&t1(a,fc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=Xa(a.elementType),a.type=s,typeof s=="function")Xp(s)?(h=eo(s,h),a.tag=1,a=vS(null,a,s,h,l)):(a.tag=0,a=Pm(null,a,s,h,l));else{if(s!=null){var m=s.$$typeof;if(m===A){a.tag=11,a=hS(null,a,s,h,l);break e}else if(m===H){a.tag=14,a=dS(null,a,s,h,l);break e}}throw a=D(s)||s,Error(n(306,a,""))}}return a;case 0:return Pm(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,m=eo(h,a.pendingProps),vS(s,a,h,m,l);case 3:e:{if(Te(a,a.stateNode.containerInfo),s===null)throw Error(n(387));h=a.pendingProps;var _=a.memoizedState;m=_.element,hm(s,a),Sc(a,h,null,l);var C=a.memoizedState;if(h=C.cache,ea(a,xi,h),h!==_.cache&&rm(a,[xi],l,!0),bc(),h=C.element,_.isDehydrated)if(_={element:h,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=_,a.memoizedState=_,a.flags&256){a=yS(s,a,h,l);break e}else if(h!==m){m=ms(Error(n(424)),a),pc(m),a=yS(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,Kt=bs(s.firstChild),Ji=a,mt=!0,Jr=null,vs=!0,l=p1(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(qa(),h===m){a=wr(s,a,l);break e}en(s,a,h,l)}a=a.child}return a;case 26:return Zh(s,a),s===null?(l=Dw(a.type,null,a.pendingProps,null))?a.memoizedState=l:mt||(l=a.type,s=a.pendingProps,h=pd(ve.current).createElement(l),h[He]=a,h[ye]=s,tn(h,l,s),Qe(h),a.stateNode=h):a.memoizedState=Dw(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return _t(a),s===null&&mt&&(h=a.stateNode=Lw(a.type,a.pendingProps,ve.current),Ji=a,vs=!0,m=Kt,fa(a.type)?(Cg=m,Kt=bs(h.firstChild)):Kt=m),en(s,a,a.pendingProps.children,l),Zh(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&mt&&((m=h=Kt)&&(h=uM(h,a.type,a.pendingProps,vs),h!==null?(a.stateNode=h,Ji=a,Kt=bs(h.firstChild),vs=!1,m=!0):m=!1),m||Qr(a)),_t(a),m=a.type,_=a.pendingProps,C=s!==null?s.memoizedProps:null,h=_.children,yg(m,_)?h=null:C!==null&&yg(m,C)&&(a.flags|=32),a.memoizedState!==null&&(m=vm(s,a,kL,null,null,l),Hc._currentValue=m),Zh(s,a),en(s,a,h,l),a.child;case 6:return s===null&&mt&&((s=l=Kt)&&(l=hM(l,a.pendingProps,vs),l!==null?(a.stateNode=l,Ji=a,Kt=null,s=!0):s=!1),s||Qr(a)),null;case 13:return bS(s,a,l);case 4:return Te(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=Ja(a,null,h,l):en(s,a,h,l),a.child;case 11:return hS(s,a,a.type,a.pendingProps,l);case 7:return en(s,a,a.pendingProps,l),a.child;case 8:return en(s,a,a.pendingProps.children,l),a.child;case 12:return en(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,ea(a,a.type,h.value),en(s,a,h.children,l),a.child;case 9:return m=a.type._context,h=a.pendingProps.children,Va(a),m=Qi(m),h=h(m),a.flags|=1,en(s,a,h,l),a.child;case 14:return dS(s,a,a.type,a.pendingProps,l);case 15:return fS(s,a,a.type,a.pendingProps,l);case 19:return wS(s,a,l);case 31:return OL(s,a,l);case 22:return pS(s,a,l,a.pendingProps);case 24:return Va(a),h=Qi(xi),s===null?(m=lm(),m===null&&(m=Ut,_=am(),m.pooledCache=_,_.refCount++,_!==null&&(m.pooledCacheLanes|=l),m=_),a.memoizedState={parent:h,cache:m},um(a),ea(a,xi,m)):((s.lanes&l)!==0&&(hm(s,a),Sc(a,null,null,l),bc()),m=s.memoizedState,_=a.memoizedState,m.parent!==h?(m={parent:h,cache:h},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),ea(a,xi,h)):(h=_.cache,ea(a,xi,h),h!==m.cache&&rm(a,[xi],l,!0))),en(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function xr(s){s.flags|=4}function qm(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(XS())s.flags|=8192;else throw Za=Ih,cm}else s.flags&=-16777217}function CS(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!zw(a))if(XS())s.flags|=8192;else throw Za=Ih,cm}function Qh(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Pe():536870912,s.lanes|=a,tl|=a)}function Tc(s,a){if(!mt)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 Vt(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 jL(s,a,l){var h=a.pendingProps;switch(em(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(a),null;case 1:return Vt(a),null;case 3:return l=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),yr(xi),Ie(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(Fo(a)?xr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,im())),Vt(a),null;case 26:var m=a.type,_=a.memoizedState;return s===null?(xr(a),_!==null?(Vt(a),CS(a,_)):(Vt(a),qm(a,m,null,h,l))):_?_!==s.memoizedState?(xr(a),Vt(a),CS(a,_)):(Vt(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&xr(a),Vt(a),qm(a,m,s,h,l)),null;case 27:if(qe(a),l=ve.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&xr(a);else{if(!h){if(a.stateNode===null)throw Error(n(166));return Vt(a),null}s=re.current,Fo(a)?n1(a):(s=Lw(m,h,l),a.stateNode=s,xr(a))}return Vt(a),null;case 5:if(qe(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&xr(a);else{if(!h){if(a.stateNode===null)throw Error(n(166));return Vt(a),null}if(_=re.current,Fo(a))n1(a);else{var C=pd(ve.current);switch(_){case 1:_=C.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:_=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":_=C.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":_=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":_=C.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?_.multiple=!0:h.size&&(_.size=h.size);break;default:_=typeof h.is=="string"?C.createElement(m,{is:h.is}):C.createElement(m)}}_[He]=a,_[ye]=h;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)_.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=_;e:switch(tn(_,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&&xr(a)}}return Vt(a),qm(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&xr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(n(166));if(s=ve.current,Fo(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,m=Ji,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[He]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||bw(s.nodeValue,l)),s||Qr(a,!0)}else s=pd(s).createTextNode(h),s[He]=a,a.stateNode=s}return Vt(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(h=Fo(a),l!==null){if(s===null){if(!h)throw Error(n(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[He]=a}else qa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Vt(a),s=!1}else l=im(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(Qn(a),a):(Qn(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Vt(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Fo(a),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[He]=a}else qa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Vt(a),m=!1}else m=im(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(Qn(a),a):(Qn(a),null)}return Qn(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),_=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(_=h.memoizedState.cachePool.pool),_!==m&&(h.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),Qh(a,a.updateQueue),Vt(a),null);case 4:return Ie(),s===null&&pg(a.stateNode.containerInfo),Vt(a),null;case 10:return yr(a.type),Vt(a),null;case 19:if(Z(vi),h=a.memoizedState,h===null)return Vt(a),null;if(m=(a.flags&128)!==0,_=h.rendering,_===null)if(m)Tc(h,!1);else{if(ui!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(_=$h(s),_!==null){for(a.flags|=128,Tc(h,!1),s=_.updateQueue,a.updateQueue=s,Qh(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)J0(l,s),l=l.sibling;return W(vi,vi.current&1|2),mt&&_r(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&Mt()>sd&&(a.flags|=128,m=!0,Tc(h,!1),a.lanes=4194304)}else{if(!m)if(s=$h(_),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,Qh(a,s),Tc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!_.alternate&&!mt)return Vt(a),null}else 2*Mt()-h.renderingStartTime>sd&&l!==536870912&&(a.flags|=128,m=!0,Tc(h,!1),a.lanes=4194304);h.isBackwards?(_.sibling=a.child,a.child=_):(s=h.last,s!==null?s.sibling=_:a.child=_,h.last=_)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Mt(),s.sibling=null,l=vi.current,W(vi,m?l&1|2:l&1),mt&&_r(a,h.treeForkCount),s):(Vt(a),null);case 22:case 23:return Qn(a),mm(),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&&(Vt(a),a.subtreeFlags&6&&(a.flags|=8192)):Vt(a),l=a.updateQueue,l!==null&&Qh(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&&Z(Ya),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),yr(xi),Vt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function IL(s,a){switch(em(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return yr(xi),Ie(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return qe(a),null;case 31:if(a.memoizedState!==null){if(Qn(a),a.alternate===null)throw Error(n(340));qa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Qn(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(n(340));qa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Z(vi),null;case 4:return Ie(),null;case 10:return yr(a.type),null;case 22:case 23:return Qn(a),mm(),s!==null&&Z(Ya),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return yr(xi),null;case 25:return null;default:return null}}function kS(s,a){switch(em(a),a.tag){case 3:yr(xi),Ie();break;case 26:case 27:case 5:qe(a);break;case 4:Ie();break;case 31:a.memoizedState!==null&&Qn(a);break;case 13:Qn(a);break;case 19:Z(vi);break;case 10:yr(a.type);break;case 22:case 23:Qn(a),mm(),s!==null&&Z(Ya);break;case 24:yr(xi)}}function Ac(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 _=l.create,C=l.inst;h=_(),C.destroy=h}l=l.next}while(l!==m)}}catch(M){Lt(a,a.return,M)}}function aa(s,a,l){try{var h=a.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var _=m.next;h=_;do{if((h.tag&s)===s){var C=h.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,m=a;var q=l,te=M;try{te()}catch(le){Lt(m,q,le)}}}h=h.next}while(h!==_)}}catch(le){Lt(a,a.return,le)}}function ES(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{g1(a,l)}catch(h){Lt(s,s.return,h)}}}function TS(s,a,l){l.props=eo(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){Lt(s,a,h)}}function Rc(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){Lt(s,a,m)}}function Zs(s,a){var l=s.ref,h=s.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(m){Lt(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){Lt(s,a,m)}else l.current=null}function AS(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){Lt(s,s.return,m)}}function Km(s,a,l){try{var h=s.stateNode;sM(h,s.type,l,a),h[ye]=a}catch(m){Lt(s,s.return,m)}}function RS(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&fa(s.type)||s.tag===4}function Vm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||RS(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&&fa(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 Ym(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=we));else if(h!==4&&(h===27&&fa(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(Ym(s,a,l),s=s.sibling;s!==null;)Ym(s,a,l),s=s.sibling}function ed(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&&fa(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(ed(s,a,l),s=s.sibling;s!==null;)ed(s,a,l),s=s.sibling}function NS(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);tn(a,h,l),a[He]=s,a[ye]=l}catch(_){Lt(s,s.return,_)}}var Cr=!1,Ei=!1,Xm=!1,LS=typeof WeakSet=="function"?WeakSet:Set,zi=null;function BL(s,a){if(s=s.containerInfo,_g=Sd,s=U0(s),Up(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,_=h.focusNode;h=h.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var C=0,M=-1,q=-1,te=0,le=0,de=s,ne=null;t:for(;;){for(var se;de!==l||m!==0&&de.nodeType!==3||(M=C+m),de!==_||h!==0&&de.nodeType!==3||(q=C+h),de.nodeType===3&&(C+=de.nodeValue.length),(se=de.firstChild)!==null;)ne=de,de=se;for(;;){if(de===s)break t;if(ne===l&&++te===m&&(M=C),ne===_&&++le===h&&(q=C),(se=de.nextSibling)!==null)break;de=ne,ne=de.parentNode}de=se}l=M===-1||q===-1?null:{start:M,end:q}}else l=null}l=l||{start:0,end:0}}else l=null;for(vg={focusedElem:s,selectionRange:l},Sd=!1,zi=a;zi!==null;)if(a=zi,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,zi=s;else for(;zi!==null;){switch(a=zi,_=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&&_!==null){s=void 0,l=a,m=_.memoizedProps,_=_.memoizedState,h=l.stateNode;try{var Ne=eo(l.type,m);s=h.getSnapshotBeforeUpdate(Ne,_),h.__reactInternalSnapshotBeforeUpdate=s}catch(We){Lt(l,l.return,We)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Sg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Sg(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(n(163))}if(s=a.sibling,s!==null){s.return=a.return,zi=s;break}zi=a.return}}function MS(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Er(s,l),h&4&&Ac(5,l);break;case 1:if(Er(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(C){Lt(l,l.return,C)}else{var m=eo(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(C){Lt(l,l.return,C)}}h&64&&ES(l),h&512&&Rc(l,l.return);break;case 3:if(Er(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{g1(s,a)}catch(C){Lt(l,l.return,C)}}break;case 27:a===null&&h&4&&NS(l);case 26:case 5:Er(s,l),a===null&&h&4&&AS(l),h&512&&Rc(l,l.return);break;case 12:Er(s,l);break;case 31:Er(s,l),h&4&&jS(s,l);break;case 13:Er(s,l),h&4&&IS(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=qL.bind(null,l),dM(s,l))));break;case 22:if(h=l.memoizedState!==null||Cr,!h){a=a!==null&&a.memoizedState!==null||Ei,m=Cr;var _=Ei;Cr=h,(Ei=a)&&!_?Tr(s,l,(l.subtreeFlags&8772)!==0):Er(s,l),Cr=m,Ei=_}break;case 30:break;default:Er(s,l)}}function OS(s){var a=s.alternate;a!==null&&(s.alternate=null,OS(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Me(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 ni=null,Mn=!1;function kr(s,a,l){for(l=l.child;l!==null;)DS(s,a,l),l=l.sibling}function DS(s,a,l){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(ln,l)}catch{}switch(l.tag){case 26:Ei||Zs(l,a),kr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Ei||Zs(l,a);var h=ni,m=Mn;fa(l.type)&&(ni=l.stateNode,Mn=!1),kr(s,a,l),Pc(l.stateNode),ni=h,Mn=m;break;case 5:Ei||Zs(l,a);case 6:if(h=ni,m=Mn,ni=null,kr(s,a,l),ni=h,Mn=m,ni!==null)if(Mn)try{(ni.nodeType===9?ni.body:ni.nodeName==="HTML"?ni.ownerDocument.body:ni).removeChild(l.stateNode)}catch(_){Lt(l,a,_)}else try{ni.removeChild(l.stateNode)}catch(_){Lt(l,a,_)}break;case 18:ni!==null&&(Mn?(s=ni,Ew(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),cl(s)):Ew(ni,l.stateNode));break;case 4:h=ni,m=Mn,ni=l.stateNode.containerInfo,Mn=!0,kr(s,a,l),ni=h,Mn=m;break;case 0:case 11:case 14:case 15:aa(2,l,a),Ei||aa(4,l,a),kr(s,a,l);break;case 1:Ei||(Zs(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&TS(l,a,h)),kr(s,a,l);break;case 21:kr(s,a,l);break;case 22:Ei=(h=Ei)||l.memoizedState!==null,kr(s,a,l),Ei=h;break;default:kr(s,a,l)}}function jS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{cl(s)}catch(l){Lt(a,a.return,l)}}}function IS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{cl(s)}catch(l){Lt(a,a.return,l)}}function PL(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new LS),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new LS),a;default:throw Error(n(435,s.tag))}}function td(s,a){var l=PL(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var m=KL.bind(null,s,h);h.then(m,m)}})}function On(s,a){var l=a.deletions;if(l!==null)for(var h=0;h<l.length;h++){var m=l[h],_=s,C=a,M=C;e:for(;M!==null;){switch(M.tag){case 27:if(fa(M.type)){ni=M.stateNode,Mn=!1;break e}break;case 5:ni=M.stateNode,Mn=!1;break e;case 3:case 4:ni=M.stateNode.containerInfo,Mn=!0;break e}M=M.return}if(ni===null)throw Error(n(160));DS(_,C,m),ni=null,Mn=!1,_=m.alternate,_!==null&&(_.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)BS(a,s),a=a.sibling}var Ds=null;function BS(s,a){var l=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:On(a,s),Dn(s),h&4&&(aa(3,s,s.return),Ac(3,s),aa(5,s,s.return));break;case 1:On(a,s),Dn(s),h&512&&(Ei||l===null||Zs(l,l.return)),h&64&&Cr&&(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=Ds;if(On(a,s),Dn(s),h&512&&(Ei||l===null||Zs(l,l.return)),h&4){var _=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":_=m.getElementsByTagName("title")[0],(!_||_[un]||_[He]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=m.createElement(h),m.head.insertBefore(_,m.querySelector("head > title"))),tn(_,h,l),_[He]=s,Qe(_),h=_;break e;case"link":var C=Bw("link","href",m).get(h+(l.href||""));if(C){for(var M=0;M<C.length;M++)if(_=C[M],_.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&_.getAttribute("rel")===(l.rel==null?null:l.rel)&&_.getAttribute("title")===(l.title==null?null:l.title)&&_.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){C.splice(M,1);break t}}_=m.createElement(h),tn(_,h,l),m.head.appendChild(_);break;case"meta":if(C=Bw("meta","content",m).get(h+(l.content||""))){for(M=0;M<C.length;M++)if(_=C[M],_.getAttribute("content")===(l.content==null?null:""+l.content)&&_.getAttribute("name")===(l.name==null?null:l.name)&&_.getAttribute("property")===(l.property==null?null:l.property)&&_.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&_.getAttribute("charset")===(l.charSet==null?null:l.charSet)){C.splice(M,1);break t}}_=m.createElement(h),tn(_,h,l),m.head.appendChild(_);break;default:throw Error(n(468,h))}_[He]=s,Qe(_),h=_}s.stateNode=h}else Pw(m,s.type,s.stateNode);else s.stateNode=Iw(m,h,s.memoizedProps);else _!==h?(_===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):_.count--,h===null?Pw(m,s.type,s.stateNode):Iw(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Km(s,s.memoizedProps,l.memoizedProps)}break;case 27:On(a,s),Dn(s),h&512&&(Ei||l===null||Zs(l,l.return)),l!==null&&h&4&&Km(s,s.memoizedProps,l.memoizedProps);break;case 5:if(On(a,s),Dn(s),h&512&&(Ei||l===null||Zs(l,l.return)),s.flags&32){m=s.stateNode;try{Ge(m,"")}catch(Ne){Lt(s,s.return,Ne)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,Km(s,m,l!==null?l.memoizedProps:m)),h&1024&&(Xm=!0);break;case 6:if(On(a,s),Dn(s),h&4){if(s.stateNode===null)throw Error(n(162));h=s.memoizedProps,l=s.stateNode;try{l.nodeValue=h}catch(Ne){Lt(s,s.return,Ne)}}break;case 3:if(_d=null,m=Ds,Ds=md(a.containerInfo),On(a,s),Ds=m,Dn(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{cl(a.containerInfo)}catch(Ne){Lt(s,s.return,Ne)}Xm&&(Xm=!1,PS(s));break;case 4:h=Ds,Ds=md(s.stateNode.containerInfo),On(a,s),Dn(s),Ds=h;break;case 12:On(a,s),Dn(s);break;case 31:On(a,s),Dn(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,td(s,h)));break;case 13:On(a,s),Dn(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(nd=Mt()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,td(s,h)));break;case 22:m=s.memoizedState!==null;var q=l!==null&&l.memoizedState!==null,te=Cr,le=Ei;if(Cr=te||m,Ei=le||q,On(a,s),Ei=le,Cr=te,Dn(s),h&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||q||Cr||Ei||to(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){q=l=a;try{if(_=q.stateNode,m)C=_.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{M=q.stateNode;var de=q.memoizedProps.style,ne=de!=null&&de.hasOwnProperty("display")?de.display:null;M.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){Lt(q,q.return,Ne)}}}else if(a.tag===6){if(l===null){q=a;try{q.stateNode.nodeValue=m?"":q.memoizedProps}catch(Ne){Lt(q,q.return,Ne)}}}else if(a.tag===18){if(l===null){q=a;try{var se=q.stateNode;m?Tw(se,!0):Tw(q.stateNode,!1)}catch(Ne){Lt(q,q.return,Ne)}}}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,td(s,l))));break;case 19:On(a,s),Dn(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,td(s,h)));break;case 30:break;case 21:break;default:On(a,s),Dn(s)}}function Dn(s){var a=s.flags;if(a&2){try{for(var l,h=s.return;h!==null;){if(RS(h)){l=h;break}h=h.return}if(l==null)throw Error(n(160));switch(l.tag){case 27:var m=l.stateNode,_=Vm(s);ed(s,_,m);break;case 5:var C=l.stateNode;l.flags&32&&(Ge(C,""),l.flags&=-33);var M=Vm(s);ed(s,M,C);break;case 3:case 4:var q=l.stateNode.containerInfo,te=Vm(s);Ym(s,te,q);break;default:throw Error(n(161))}}catch(le){Lt(s,s.return,le)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function PS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;PS(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Er(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)MS(s,a.alternate,a),a=a.sibling}function to(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:aa(4,a,a.return),to(a);break;case 1:Zs(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&TS(a,a.return,l),to(a);break;case 27:Pc(a.stateNode);case 26:case 5:Zs(a,a.return),to(a);break;case 22:a.memoizedState===null&&to(a);break;case 30:to(a);break;default:to(a)}s=s.sibling}}function Tr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,m=s,_=a,C=_.flags;switch(_.tag){case 0:case 11:case 15:Tr(m,_,l),Ac(4,_);break;case 1:if(Tr(m,_,l),h=_,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){Lt(h,h.return,te)}if(h=_,m=h.updateQueue,m!==null){var M=h.stateNode;try{var q=m.shared.hiddenCallbacks;if(q!==null)for(m.shared.hiddenCallbacks=null,m=0;m<q.length;m++)m1(q[m],M)}catch(te){Lt(h,h.return,te)}}l&&C&64&&ES(_),Rc(_,_.return);break;case 27:NS(_);case 26:case 5:Tr(m,_,l),l&&h===null&&C&4&&AS(_),Rc(_,_.return);break;case 12:Tr(m,_,l);break;case 31:Tr(m,_,l),l&&C&4&&jS(m,_);break;case 13:Tr(m,_,l),l&&C&4&&IS(m,_);break;case 22:_.memoizedState===null&&Tr(m,_,l),Rc(_,_.return);break;case 30:break;default:Tr(m,_,l)}a=a.sibling}}function Zm(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&&mc(l))}function Jm(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&mc(s))}function js(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)zS(s,a,l,h),a=a.sibling}function zS(s,a,l,h){var m=a.flags;switch(a.tag){case 0:case 11:case 15:js(s,a,l,h),m&2048&&Ac(9,a);break;case 1:js(s,a,l,h);break;case 3:js(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&&mc(s)));break;case 12:if(m&2048){js(s,a,l,h),s=a.stateNode;try{var _=a.memoizedProps,C=_.id,M=_.onPostCommit;typeof M=="function"&&M(C,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(q){Lt(a,a.return,q)}}else js(s,a,l,h);break;case 31:js(s,a,l,h);break;case 13:js(s,a,l,h);break;case 23:break;case 22:_=a.stateNode,C=a.alternate,a.memoizedState!==null?_._visibility&2?js(s,a,l,h):Nc(s,a):_._visibility&2?js(s,a,l,h):(_._visibility|=2,Jo(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),m&2048&&Zm(C,a);break;case 24:js(s,a,l,h),m&2048&&Jm(a.alternate,a);break;default:js(s,a,l,h)}}function Jo(s,a,l,h,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var _=s,C=a,M=l,q=h,te=C.flags;switch(C.tag){case 0:case 11:case 15:Jo(_,C,M,q,m),Ac(8,C);break;case 23:break;case 22:var le=C.stateNode;C.memoizedState!==null?le._visibility&2?Jo(_,C,M,q,m):Nc(_,C):(le._visibility|=2,Jo(_,C,M,q,m)),m&&te&2048&&Zm(C.alternate,C);break;case 24:Jo(_,C,M,q,m),m&&te&2048&&Jm(C.alternate,C);break;default:Jo(_,C,M,q,m)}a=a.sibling}}function Nc(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:Nc(l,h),m&2048&&Zm(h.alternate,h);break;case 24:Nc(l,h),m&2048&&Jm(h.alternate,h);break;default:Nc(l,h)}a=a.sibling}}var Lc=8192;function Qo(s,a,l){if(s.subtreeFlags&Lc)for(s=s.child;s!==null;)$S(s,a,l),s=s.sibling}function $S(s,a,l){switch(s.tag){case 26:Qo(s,a,l),s.flags&Lc&&s.memoizedState!==null&&CM(l,Ds,s.memoizedState,s.memoizedProps);break;case 5:Qo(s,a,l);break;case 3:case 4:var h=Ds;Ds=md(s.stateNode.containerInfo),Qo(s,a,l),Ds=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Lc,Lc=16777216,Qo(s,a,l),Lc=h):Qo(s,a,l));break;default:Qo(s,a,l)}}function HS(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 Mc(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];zi=h,US(h,s)}HS(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)FS(s),s=s.sibling}function FS(s){switch(s.tag){case 0:case 11:case 15:Mc(s),s.flags&2048&&aa(9,s,s.return);break;case 3:Mc(s);break;case 12:Mc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,id(s)):Mc(s);break;default:Mc(s)}}function id(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];zi=h,US(h,s)}HS(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:aa(8,a,a.return),id(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,id(a));break;default:id(a)}s=s.sibling}}function US(s,a){for(;zi!==null;){var l=zi;switch(l.tag){case 0:case 11:case 15:aa(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:mc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,zi=h;else e:for(l=s;zi!==null;){h=zi;var m=h.sibling,_=h.return;if(OS(h),h===l){zi=null;break e}if(m!==null){m.return=_,zi=m;break e}zi=_}}}var zL={getCacheForType:function(s){var a=Qi(xi),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return Qi(xi).controller.signal}},$L=typeof WeakMap=="function"?WeakMap:Map,Et=0,Ut=null,lt=null,dt=0,Nt=0,es=null,oa=!1,el=!1,Qm=!1,Ar=0,ui=0,la=0,io=0,eg=0,ts=0,tl=0,Oc=null,jn=null,tg=!1,nd=0,WS=0,sd=1/0,rd=null,ca=null,Mi=0,ua=null,il=null,Rr=0,ig=0,ng=null,GS=null,Dc=0,sg=null;function is(){return(Et&2)!==0&&dt!==0?dt&-dt:E.T!==null?ug():ue()}function qS(){if(ts===0)if((dt&536870912)===0||mt){var s=ds;ds<<=1,(ds&3932160)===0&&(ds=262144),ts=s}else ts=536870912;return s=Jn.current,s!==null&&(s.flags|=32),ts}function In(s,a,l){(s===Ut&&(Nt===2||Nt===9)||s.cancelPendingCommit!==null)&&(nl(s,0),ha(s,dt,ts,!1)),bt(s,l),((Et&2)===0||s!==Ut)&&(s===Ut&&((Et&2)===0&&(io|=l),ui===4&&ha(s,dt,ts,!1)),Js(s))}function KS(s,a,l){if((Et&6)!==0)throw Error(n(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||ce(s,a),m=h?UL(s,a):ag(s,a,!0),_=h;do{if(m===0){el&&!h&&ha(s,a,0,!1);break}else{if(l=s.current.alternate,_&&!HL(l)){m=ag(s,a,!1),_=!1;continue}if(m===2){if(_=a,s.errorRecoveryDisabledLanes&_)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var M=s;m=Oc;var q=M.current.memoizedState.isDehydrated;if(q&&(nl(M,C).flags|=256),C=ag(M,C,!1),C!==2){if(Qm&&!q){M.errorRecoveryDisabledLanes|=_,io|=_,m=4;break e}_=jn,jn=m,_!==null&&(jn===null?jn=_:jn.push.apply(jn,_))}m=C}if(_=!1,m!==2)continue}}if(m===1){nl(s,0),ha(s,a,0,!0);break}e:{switch(h=s,_=m,_){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:ha(h,a,ts,!oa);break e;case 2:jn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(m=nd+300-Mt(),10<m)){if(ha(h,a,ts,!oa),G(h,0,!0)!==0)break e;Rr=a,h.timeoutHandle=Cw(VS.bind(null,h,l,jn,rd,tg,a,ts,io,tl,oa,_,"Throttled",-0,0),m);break e}VS(h,l,jn,rd,tg,a,ts,io,tl,oa,_,null,-0,0)}}break}while(!0);Js(s)}function VS(s,a,l,h,m,_,C,M,q,te,le,de,ne,se){if(s.timeoutHandle=-1,de=a.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:we},$S(a,_,de);var Ne=(_&62914560)===_?nd-Mt():(_&4194048)===_?WS-Mt():0;if(Ne=kM(de,Ne),Ne!==null){Rr=_,s.cancelPendingCommit=Ne(iw.bind(null,s,a,_,l,h,m,C,M,q,le,de,null,ne,se)),ha(s,_,C,!te);return}}iw(s,a,_,l,h,m,C,M,q)}function HL(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],_=m.getSnapshot;m=m.value;try{if(!Xn(_(),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 ha(s,a,l,h){a&=~eg,a&=~io,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var m=a;0<m;){var _=31-Dt(m),C=1<<_;h[_]=-1,m&=~C}l!==0&&ke(s,l,a)}function ad(){return(Et&6)===0?(jc(0),!1):!0}function rg(){if(lt!==null){if(Nt===0)var s=lt.return;else s=lt,vr=Ka=null,Sm(s),Ko=null,_c=0,s=lt;for(;s!==null;)kS(s.alternate,s),s=s.return;lt=null}}function nl(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,oM(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Rr=0,rg(),Ut=s,lt=l=gr(s.current,null),dt=a,Nt=0,es=null,oa=!1,el=ce(s,a),Qm=!1,tl=ts=eg=io=la=ui=0,jn=Oc=null,tg=!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-Dt(h),_=1<<m;a|=s[m],h&=~_}return Ar=a,Th(),l}function YS(s,a){et=null,E.H=kc,a===qo||a===jh?(a=h1(),Nt=3):a===cm?(a=h1(),Nt=4):Nt=a===Bm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,es=a,lt===null&&(ui=1,Yh(s,ms(a,s.current)))}function XS(){var s=Jn.current;return s===null?!0:(dt&4194048)===dt?ys===null:(dt&62914560)===dt||(dt&536870912)!==0?s===ys:!1}function ZS(){var s=E.H;return E.H=kc,s===null?kc:s}function JS(){var s=E.A;return E.A=zL,s}function od(){ui=4,oa||(dt&4194048)!==dt&&Jn.current!==null||(el=!0),(la&134217727)===0&&(io&134217727)===0||Ut===null||ha(Ut,dt,ts,!1)}function ag(s,a,l){var h=Et;Et|=2;var m=ZS(),_=JS();(Ut!==s||dt!==a)&&(rd=null,nl(s,a)),a=!1;var C=ui;e:do try{if(Nt!==0&<!==null){var M=lt,q=es;switch(Nt){case 8:rg(),C=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(a=!0);var te=Nt;if(Nt=0,es=null,sl(s,M,q,te),l&&el){C=0;break e}break;default:te=Nt,Nt=0,es=null,sl(s,M,q,te)}}FL(),C=ui;break}catch(le){YS(s,le)}while(!0);return a&&s.shellSuspendCounter++,vr=Ka=null,Et=h,E.H=m,E.A=_,lt===null&&(Ut=null,dt=0,Th()),C}function FL(){for(;lt!==null;)QS(lt)}function UL(s,a){var l=Et;Et|=2;var h=ZS(),m=JS();Ut!==s||dt!==a?(rd=null,sd=Mt()+500,nl(s,a)):el=ce(s,a);e:do try{if(Nt!==0&<!==null){a=lt;var _=es;t:switch(Nt){case 1:Nt=0,es=null,sl(s,a,_,1);break;case 2:case 9:if(c1(_)){Nt=0,es=null,ew(a);break}a=function(){Nt!==2&&Nt!==9||Ut!==s||(Nt=7),Js(s)},_.then(a,a);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:c1(_)?(Nt=0,es=null,ew(a)):(Nt=0,es=null,sl(s,a,_,7));break;case 5:var C=null;switch(lt.tag){case 26:C=lt.memoizedState;case 5:case 27:var M=lt;if(C?zw(C):M.stateNode.complete){Nt=0,es=null;var q=M.sibling;if(q!==null)lt=q;else{var te=M.return;te!==null?(lt=te,ld(te)):lt=null}break t}}Nt=0,es=null,sl(s,a,_,5);break;case 6:Nt=0,es=null,sl(s,a,_,6);break;case 8:rg(),ui=6;break e;default:throw Error(n(462))}}WL();break}catch(le){YS(s,le)}while(!0);return vr=Ka=null,E.H=h,E.A=m,Et=l,lt!==null?0:(Ut=null,dt=0,Th(),ui)}function WL(){for(;lt!==null&&!Ks();)QS(lt)}function QS(s){var a=xS(s.alternate,s,Ar);s.memoizedProps=s.pendingProps,a===null?ld(s):lt=a}function ew(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=_S(l,a,a.pendingProps,a.type,void 0,dt);break;case 11:a=_S(l,a,a.pendingProps,a.type.render,a.ref,dt);break;case 5:Sm(a);default:kS(l,a),a=lt=J0(a,Ar),a=xS(l,a,Ar)}s.memoizedProps=s.pendingProps,a===null?ld(s):lt=a}function sl(s,a,l,h){vr=Ka=null,Sm(a),Ko=null,_c=0;var m=a.return;try{if(ML(s,m,a,l,dt)){ui=1,Yh(s,ms(l,s.current)),lt=null;return}}catch(_){if(m!==null)throw lt=m,_;ui=1,Yh(s,ms(l,s.current)),lt=null;return}a.flags&32768?(mt||h===1?s=!0:el||(dt&536870912)!==0?s=!1:(oa=s=!0,(h===2||h===9||h===3||h===6)&&(h=Jn.current,h!==null&&h.tag===13&&(h.flags|=16384))),tw(a,s)):ld(a)}function ld(s){var a=s;do{if((a.flags&32768)!==0){tw(a,oa);return}s=a.return;var l=jL(a.alternate,a,Ar);if(l!==null){lt=l;return}if(a=a.sibling,a!==null){lt=a;return}lt=a=s}while(a!==null);ui===0&&(ui=5)}function tw(s,a){do{var l=IL(s.alternate,s);if(l!==null){l.flags&=32767,lt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){lt=s;return}lt=s=l}while(s!==null);ui=6,lt=null}function iw(s,a,l,h,m,_,C,M,q){s.cancelPendingCommit=null;do cd();while(Mi!==0);if((Et&6)!==0)throw Error(n(327));if(a!==null){if(a===s.current)throw Error(n(177));if(_=a.lanes|a.childLanes,_|=Vp,Ae(s,l,_,C,M,q),s===Ut&&(lt=Ut=null,dt=0),il=a,ua=s,Rr=l,ig=_,ng=m,GS=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,VL(An,function(){return ow(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=E.T,E.T=null,m=j.p,j.p=2,C=Et,Et|=4;try{BL(s,a,l)}finally{Et=C,j.p=m,E.T=h}}Mi=1,nw(),sw(),rw()}}function nw(){if(Mi===1){Mi=0;var s=ua,a=il,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var h=j.p;j.p=2;var m=Et;Et|=4;try{BS(a,s);var _=vg,C=U0(s.containerInfo),M=_.focusedElem,q=_.selectionRange;if(C!==M&&M&&M.ownerDocument&&F0(M.ownerDocument.documentElement,M)){if(q!==null&&Up(M)){var te=q.start,le=q.end;if(le===void 0&&(le=te),"selectionStart"in M)M.selectionStart=te,M.selectionEnd=Math.min(le,M.value.length);else{var de=M.ownerDocument||document,ne=de&&de.defaultView||window;if(ne.getSelection){var se=ne.getSelection(),Ne=M.textContent.length,We=Math.min(q.start,Ne),Pt=q.end===void 0?We:Math.min(q.end,Ne);!se.extend&&We>Pt&&(C=Pt,Pt=We,We=C);var X=H0(M,We),Y=H0(M,Pt);if(X&&Y&&(se.rangeCount!==1||se.anchorNode!==X.node||se.anchorOffset!==X.offset||se.focusNode!==Y.node||se.focusOffset!==Y.offset)){var ee=de.createRange();ee.setStart(X.node,X.offset),se.removeAllRanges(),We>Pt?(se.addRange(ee),se.extend(Y.node,Y.offset)):(ee.setEnd(Y.node,Y.offset),se.addRange(ee))}}}}for(de=[],se=M;se=se.parentNode;)se.nodeType===1&&de.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<de.length;M++){var he=de[M];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Sd=!!_g,vg=_g=null}finally{Et=m,j.p=h,E.T=l}}s.current=a,Mi=2}}function sw(){if(Mi===2){Mi=0;var s=ua,a=il,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var h=j.p;j.p=2;var m=Et;Et|=4;try{MS(s,a.alternate,a)}finally{Et=m,j.p=h,E.T=l}}Mi=3}}function rw(){if(Mi===4||Mi===3){Mi=0,Vs();var s=ua,a=il,l=Rr,h=GS;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Mi=5:(Mi=0,il=ua=null,aw(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ca=null),Si(l),a=a.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(ln,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=E.T,m=j.p,j.p=2,E.T=null;try{for(var _=s.onRecoverableError,C=0;C<h.length;C++){var M=h[C];_(M.value,{componentStack:M.stack})}}finally{E.T=a,j.p=m}}(Rr&3)!==0&&cd(),Js(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===sg?Dc++:(Dc=0,sg=s):Dc=0,jc(0)}}function aw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,mc(a)))}function cd(){return nw(),sw(),rw(),ow()}function ow(){if(Mi!==5)return!1;var s=ua,a=ig;ig=0;var l=Si(Rr),h=E.T,m=j.p;try{j.p=32>l?32:l,E.T=null,l=ng,ng=null;var _=ua,C=Rr;if(Mi=0,il=ua=null,Rr=0,(Et&6)!==0)throw Error(n(331));var M=Et;if(Et|=4,FS(_.current),zS(_,_.current,C,l),Et=M,jc(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(ln,_)}catch{}return!0}finally{j.p=m,E.T=h,aw(s,a)}}function lw(s,a,l){a=ms(l,a),a=Im(s.stateNode,a,2),s=na(s,a,2),s!==null&&(bt(s,2),Js(s))}function Lt(s,a,l){if(s.tag===3)lw(s,s,l);else for(;a!==null;){if(a.tag===3){lw(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ca===null||!ca.has(h))){s=ms(l,s),l=cS(2),h=na(a,l,2),h!==null&&(uS(l,h,a,s),bt(h,2),Js(h));break}}a=a.return}}function og(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new $L;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)||(Qm=!0,m.add(l),s=GL.bind(null,s,a,l),a.then(s,s))}function GL(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,Ut===s&&(dt&l)===l&&(ui===4||ui===3&&(dt&62914560)===dt&&300>Mt()-nd?(Et&2)===0&&nl(s,0):eg|=l,tl===dt&&(tl=0)),Js(s)}function cw(s,a){a===0&&(a=Pe()),s=Wa(s,a),s!==null&&(bt(s,a),Js(s))}function qL(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),cw(s,l)}function KL(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(n(314))}h!==null&&h.delete(a),cw(s,l)}function VL(s,a){return Gt(s,a)}var ud=null,rl=null,lg=!1,hd=!1,cg=!1,da=0;function Js(s){s!==rl&&s.next===null&&(rl===null?ud=rl=s:rl=rl.next=s),hd=!0,lg||(lg=!0,XL())}function jc(s,a){if(!cg&&hd){cg=!0;do for(var l=!1,h=ud;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var _=0;else{var C=h.suspendedLanes,M=h.pingedLanes;_=(1<<31-Dt(42|s)+1)-1,_&=m&~(C&~M),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(l=!0,fw(h,_))}else _=dt,_=G(h,h===Ut?_:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(_&3)===0||ce(h,_)||(l=!0,fw(h,_));h=h.next}while(l);cg=!1}}function YL(){uw()}function uw(){hd=lg=!1;var s=0;da!==0&&aM()&&(s=da);for(var a=Mt(),l=null,h=ud;h!==null;){var m=h.next,_=hw(h,a);_===0?(h.next=null,l===null?ud=m:l.next=m,m===null&&(rl=l)):(l=h,(s!==0||(_&3)!==0)&&(hd=!0)),h=m}Mi!==0&&Mi!==5||jc(s),da!==0&&(da=0)}function hw(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var C=31-Dt(_),M=1<<C,q=m[C];q===-1?((M&l)===0||(M&h)!==0)&&(m[C]=_e(M,a)):q<=a&&(s.expiredLanes|=M),_&=~M}if(a=Ut,l=dt,l=G(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(Nt===2||Nt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Wn(h),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||ce(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(h!==null&&Wn(h),Si(l)){case 2:case 8:l=_i;break;case 32:l=An;break;case 268435456:l=Gn;break;default:l=An}return h=dw.bind(null,s),l=Gt(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&Wn(h),s.callbackPriority=2,s.callbackNode=null,2}function dw(s,a){if(Mi!==0&&Mi!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(cd()&&s.callbackNode!==l)return null;var h=dt;return h=G(s,s===Ut?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(KS(s,h,a),hw(s,Mt()),s.callbackNode!=null&&s.callbackNode===l?dw.bind(null,s):null)}function fw(s,a){if(cd())return null;KS(s,a,!0)}function XL(){lM(function(){(Et&6)!==0?Gt(Pi,YL):uw()})}function ug(){if(da===0){var s=Wo;s===0&&(s=Xi,Xi<<=1,(Xi&261888)===0&&(Xi=256)),da=s}return da}function pw(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Yr(""+s)}function mw(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 ZL(s,a,l,h,m){if(a==="submit"&&l&&l.stateNode===m){var _=pw((m[ye]||null).action),C=h.submitter;C&&(a=(a=C[ye]||null)?pw(a.formAction):C.getAttribute("formAction"),a!==null&&(_=a,C=null));var M=new xh("action","action",null,h,m);s.push({event:M,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(da!==0){var q=C?mw(m,C):new FormData(m);Nm(l,{pending:!0,data:q,method:m.method,action:_},null,q)}}else typeof _=="function"&&(M.preventDefault(),q=C?mw(m,C):new FormData(m),Nm(l,{pending:!0,data:q,method:m.method,action:_},_,q))},currentTarget:m}]})}}for(var hg=0;hg<Kp.length;hg++){var dg=Kp[hg],JL=dg.toLowerCase(),QL=dg[0].toUpperCase()+dg.slice(1);Os(JL,"on"+QL)}Os(q0,"onAnimationEnd"),Os(K0,"onAnimationIteration"),Os(V0,"onAnimationStart"),Os("dblclick","onDoubleClick"),Os("focusin","onFocus"),Os("focusout","onBlur"),Os(mL,"onTransitionRun"),Os(gL,"onTransitionStart"),Os(_L,"onTransitionCancel"),Os(Y0,"onTransitionEnd"),me("onMouseEnter",["mouseout","mouseover"]),me("onMouseLeave",["mouseout","mouseover"]),me("onPointerEnter",["pointerout","pointerover"]),me("onPointerLeave",["pointerout","pointerover"]),ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ic="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(" "),eM=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ic));function gw(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 _=void 0;if(a)for(var C=h.length-1;0<=C;C--){var M=h[C],q=M.instance,te=M.currentTarget;if(M=M.listener,q!==_&&m.isPropagationStopped())break e;_=M,m.currentTarget=te;try{_(m)}catch(le){Eh(le)}m.currentTarget=null,_=q}else for(C=0;C<h.length;C++){if(M=h[C],q=M.instance,te=M.currentTarget,M=M.listener,q!==_&&m.isPropagationStopped())break e;_=M,m.currentTarget=te;try{_(m)}catch(le){Eh(le)}m.currentTarget=null,_=q}}}}function ct(s,a){var l=a[Qt];l===void 0&&(l=a[Qt]=new Set);var h=s+"__bubble";l.has(h)||(_w(a,s,2,!1),l.add(h))}function fg(s,a,l){var h=0;a&&(h|=4),_w(l,s,h,a)}var dd="_reactListening"+Math.random().toString(36).slice(2);function pg(s){if(!s[dd]){s[dd]=!0,At.forEach(function(l){l!=="selectionchange"&&(eM.has(l)||fg(l,!1,s),fg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[dd]||(a[dd]=!0,fg("selectionchange",!1,a))}}function _w(s,a,l,h){switch(qw(a)){case 2:var m=AM;break;case 8:m=RM;break;default:m=Rg}l=m.bind(null,a,l,s),m=void 0,!Dp||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 mg(s,a,l,h,m){var _=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 M=h.stateNode.containerInfo;if(M===m)break;if(C===4)for(C=h.return;C!==null;){var q=C.tag;if((q===3||q===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;M!==null;){if(C=F(M),C===null)return;if(q=C.tag,q===5||q===6||q===26||q===27){h=_=C;continue e}M=M.parentNode}}h=h.return}yh(function(){var te=_,le=Je(l),de=[];e:{var ne=X0.get(s);if(ne!==void 0){var se=xh,Ne=s;switch(s){case"keypress":if(Sh(l)===0)break e;case"keydown":case"keyup":se=KN;break;case"focusin":Ne="focus",se=Pp;break;case"focusout":Ne="blur",se=Pp;break;case"beforeblur":case"afterblur":se=Pp;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":se=k0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=jN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=XN;break;case q0:case K0:case V0:se=PN;break;case Y0:se=JN;break;case"scroll":case"scrollend":se=ON;break;case"wheel":se=eL;break;case"copy":case"cut":case"paste":se=$N;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=T0;break;case"toggle":case"beforetoggle":se=iL}var We=(a&4)!==0,Pt=!We&&(s==="scroll"||s==="scrollend"),X=We?ne!==null?ne+"Capture":null:ne;We=[];for(var Y=te,ee;Y!==null;){var he=Y;if(ee=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ee===null||X===null||(he=sc(Y,X),he!=null&&We.push(Bc(Y,he,ee))),Pt)break;Y=Y.return}0<We.length&&(ne=new se(ne,Ne,null,l,le),de.push({event:ne,listeners:We}))}}if((a&7)===0){e:{if(ne=s==="mouseover"||s==="pointerover",se=s==="mouseout"||s==="pointerout",ne&&l!==Oe&&(Ne=l.relatedTarget||l.fromElement)&&(F(Ne)||Ne[vt]))break e;if((se||ne)&&(ne=le.window===le?le:(ne=le.ownerDocument)?ne.defaultView||ne.parentWindow:window,se?(Ne=l.relatedTarget||l.toElement,se=te,Ne=Ne?F(Ne):null,Ne!==null&&(Pt=o(Ne),We=Ne.tag,Ne!==Pt||We!==5&&We!==27&&We!==6)&&(Ne=null)):(se=null,Ne=te),se!==Ne)){if(We=k0,he="onMouseLeave",X="onMouseEnter",Y="mouse",(s==="pointerout"||s==="pointerover")&&(We=T0,he="onPointerLeave",X="onPointerEnter",Y="pointer"),Pt=se==null?ne:Ce(se),ee=Ne==null?ne:Ce(Ne),ne=new We(he,Y+"leave",se,l,le),ne.target=Pt,ne.relatedTarget=ee,he=null,F(le)===te&&(We=new We(X,Y+"enter",Ne,l,le),We.target=ee,We.relatedTarget=Pt,he=We),Pt=he,se&&Ne)t:{for(We=tM,X=se,Y=Ne,ee=0,he=X;he;he=We(he))ee++;he=0;for(var ze=Y;ze;ze=We(ze))he++;for(;0<ee-he;)X=We(X),ee--;for(;0<he-ee;)Y=We(Y),he--;for(;ee--;){if(X===Y||Y!==null&&X===Y.alternate){We=X;break t}X=We(X),Y=We(Y)}We=null}else We=null;se!==null&&vw(de,ne,se,We,!1),Ne!==null&&Pt!==null&&vw(de,Pt,Ne,We,!0)}}e:{if(ne=te?Ce(te):window,se=ne.nodeName&&ne.nodeName.toLowerCase(),se==="select"||se==="input"&&ne.type==="file")var xt=j0;else if(O0(ne))if(I0)xt=dL;else{xt=uL;var De=cL}else se=ne.nodeName,!se||se.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Vr(te.elementType)&&(xt=j0):xt=hL;if(xt&&(xt=xt(s,te))){D0(de,xt,l,le);break e}De&&De(s,ne,te),s==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&Oo(ne,"number",ne.value)}switch(De=te?Ce(te):window,s){case"focusin":(O0(De)||De.contentEditable==="true")&&(Io=De,Wp=te,dc=null);break;case"focusout":dc=Wp=Io=null;break;case"mousedown":Gp=!0;break;case"contextmenu":case"mouseup":case"dragend":Gp=!1,W0(de,l,le);break;case"selectionchange":if(pL)break;case"keydown":case"keyup":W0(de,l,le)}var tt;if($p)e:{switch(s){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else jo?L0(s,l)&&(ft="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(ft="onCompositionStart");ft&&(A0&&l.locale!=="ko"&&(jo||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&jo&&(tt=x0()):(Xr=le,jp="value"in Xr?Xr.value:Xr.textContent,jo=!0)),De=fd(te,ft),0<De.length&&(ft=new E0(ft,s,null,l,le),de.push({event:ft,listeners:De}),tt?ft.data=tt:(tt=M0(l),tt!==null&&(ft.data=tt)))),(tt=sL?rL(s,l):aL(s,l))&&(ft=fd(te,"onBeforeInput"),0<ft.length&&(De=new E0("onBeforeInput","beforeinput",null,l,le),de.push({event:De,listeners:ft}),De.data=tt)),ZL(de,s,te,l,le)}gw(de,a)})}function Bc(s,a,l){return{instance:s,listener:a,currentTarget:l}}function fd(s,a){for(var l=a+"Capture",h=[];s!==null;){var m=s,_=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||_===null||(m=sc(s,l),m!=null&&h.unshift(Bc(s,m,_)),m=sc(s,a),m!=null&&h.push(Bc(s,m,_))),s.tag===3)return h;s=s.return}return[]}function tM(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function vw(s,a,l,h,m){for(var _=a._reactName,C=[];l!==null&&l!==h;){var M=l,q=M.alternate,te=M.stateNode;if(M=M.tag,q!==null&&q===h)break;M!==5&&M!==26&&M!==27||te===null||(q=te,m?(te=sc(l,_),te!=null&&C.unshift(Bc(l,te,q))):m||(te=sc(l,_),te!=null&&C.push(Bc(l,te,q)))),l=l.return}C.length!==0&&s.push({event:a,listeners:C})}var iM=/\r\n?/g,nM=/\u0000|\uFFFD/g;function yw(s){return(typeof s=="string"?s:""+s).replace(iM,`
|
|
9
|
+
`).replace(nM,"")}function bw(s,a){return a=yw(a),yw(s)===a}function Bt(s,a,l,h,m,_){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Ge(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Ge(s,""+h);break;case"className":Vn(s,"class",h);break;case"tabIndex":Vn(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Vn(s,l,h);break;case"style":Rt(s,h,_);break;case"data":if(a!=="object"){Vn(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=Yr(""+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 _=="function"&&(l==="formAction"?(a!=="input"&&Bt(s,a,"name",m.name,m,null),Bt(s,a,"formEncType",m.formEncType,m,null),Bt(s,a,"formMethod",m.formMethod,m,null),Bt(s,a,"formTarget",m.formTarget,m,null)):(Bt(s,a,"encType",m.encType,m,null),Bt(s,a,"method",m.method,m,null),Bt(s,a,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=Yr(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=we);break;case"onScroll":h!=null&&ct("scroll",s);break;case"onScrollEnd":h!=null&&ct("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(n(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(n(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=Yr(""+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":ct("beforetoggle",s),ct("toggle",s),hn(s,"popover",h);break;case"xlinkActuate":Rn(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Rn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Rn(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Rn(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Rn(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Rn(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Rn(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Rn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Rn(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":hn(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=pr.get(l)||l,hn(s,l,h))}}function gg(s,a,l,h,m,_){switch(l){case"style":Rt(s,h,_);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(n(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=l}}break;case"children":typeof h=="string"?Ge(s,h):(typeof h=="number"||typeof h=="bigint")&&Ge(s,""+h);break;case"onScroll":h!=null&&ct("scroll",s);break;case"onScrollEnd":h!=null&&ct("scrollend",s);break;case"onClick":h!=null&&(s.onclick=we);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ei.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),a=l.slice(2,m?l.length-7:void 0),_=s[ye]||null,_=_!=null?_[l]:null,typeof _=="function"&&s.removeEventListener(a,_,m),typeof h=="function")){typeof _!="function"&&_!==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,""):hn(s,l,h)}}}function tn(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",s),ct("load",s);var h=!1,m=!1,_;for(_ in l)if(l.hasOwnProperty(_)){var C=l[_];if(C!=null)switch(_){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:Bt(s,a,_,C,l,null)}}m&&Bt(s,a,"srcSet",l.srcSet,l,null),h&&Bt(s,a,"src",l.src,l,null);return;case"input":ct("invalid",s);var M=_=C=m=null,q=null,te=null;for(h in l)if(l.hasOwnProperty(h)){var le=l[h];if(le!=null)switch(h){case"name":m=le;break;case"type":C=le;break;case"checked":q=le;break;case"defaultChecked":te=le;break;case"value":_=le;break;case"defaultValue":M=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(n(137,a));break;default:Bt(s,a,h,le,l,null)}}$a(s,_,M,q,te,C,m,!1);return;case"select":ct("invalid",s),h=C=_=null;for(m in l)if(l.hasOwnProperty(m)&&(M=l[m],M!=null))switch(m){case"value":_=M;break;case"defaultValue":C=M;break;case"multiple":h=M;default:Bt(s,a,m,M,l,null)}a=_,l=C,s.multiple=!!h,a!=null?Zi(s,!!h,a,!1):l!=null&&Zi(s,!!h,l,!0);return;case"textarea":ct("invalid",s),_=m=h=null;for(C in l)if(l.hasOwnProperty(C)&&(M=l[C],M!=null))switch(C){case"value":h=M;break;case"defaultValue":m=M;break;case"children":_=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(n(91));break;default:Bt(s,a,C,M,l,null)}Do(s,h,m,_);return;case"option":for(q in l)l.hasOwnProperty(q)&&(h=l[q],h!=null)&&(q==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":Bt(s,a,q,h,l,null));return;case"dialog":ct("beforetoggle",s),ct("toggle",s),ct("cancel",s),ct("close",s);break;case"iframe":case"object":ct("load",s);break;case"video":case"audio":for(h=0;h<Ic.length;h++)ct(Ic[h],s);break;case"image":ct("error",s),ct("load",s);break;case"details":ct("toggle",s);break;case"embed":case"source":case"link":ct("error",s),ct("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(te in l)if(l.hasOwnProperty(te)&&(h=l[te],h!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:Bt(s,a,te,h,l,null)}return;default:if(Vr(a)){for(le in l)l.hasOwnProperty(le)&&(h=l[le],h!==void 0&&gg(s,a,le,h,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(h=l[M],h!=null&&Bt(s,a,M,h,l,null))}function sM(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,_=null,C=null,M=null,q=null,te=null,le=null;for(se in l){var de=l[se];if(l.hasOwnProperty(se)&&de!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":q=de;default:h.hasOwnProperty(se)||Bt(s,a,se,null,h,de)}}for(var ne in h){var se=h[ne];if(de=l[ne],h.hasOwnProperty(ne)&&(se!=null||de!=null))switch(ne){case"type":_=se;break;case"name":m=se;break;case"checked":te=se;break;case"defaultChecked":le=se;break;case"value":C=se;break;case"defaultValue":M=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(n(137,a));break;default:se!==de&&Bt(s,a,ne,se,h,de)}}tc(s,C,M,q,te,le,_,m);return;case"select":se=C=M=ne=null;for(_ in l)if(q=l[_],l.hasOwnProperty(_)&&q!=null)switch(_){case"value":break;case"multiple":se=q;default:h.hasOwnProperty(_)||Bt(s,a,_,null,h,q)}for(m in h)if(_=h[m],q=l[m],h.hasOwnProperty(m)&&(_!=null||q!=null))switch(m){case"value":ne=_;break;case"defaultValue":M=_;break;case"multiple":C=_;default:_!==q&&Bt(s,a,m,_,h,q)}a=M,l=C,h=se,ne!=null?Zi(s,!!l,ne,!1):!!h!=!!l&&(a!=null?Zi(s,!!l,a,!0):Zi(s,!!l,l?[]:"",!1));return;case"textarea":se=ne=null;for(M in l)if(m=l[M],l.hasOwnProperty(M)&&m!=null&&!h.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Bt(s,a,M,null,h,m)}for(C in h)if(m=h[C],_=l[C],h.hasOwnProperty(C)&&(m!=null||_!=null))switch(C){case"value":ne=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==_&&Bt(s,a,C,m,h,_)}_h(s,ne,se);return;case"option":for(var Ne in l)ne=l[Ne],l.hasOwnProperty(Ne)&&ne!=null&&!h.hasOwnProperty(Ne)&&(Ne==="selected"?s.selected=!1:Bt(s,a,Ne,null,h,ne));for(q in h)ne=h[q],se=l[q],h.hasOwnProperty(q)&&ne!==se&&(ne!=null||se!=null)&&(q==="selected"?s.selected=ne&&typeof ne!="function"&&typeof ne!="symbol":Bt(s,a,q,ne,h,se));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var We in l)ne=l[We],l.hasOwnProperty(We)&&ne!=null&&!h.hasOwnProperty(We)&&Bt(s,a,We,null,h,ne);for(te in h)if(ne=h[te],se=l[te],h.hasOwnProperty(te)&&ne!==se&&(ne!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(n(137,a));break;default:Bt(s,a,te,ne,h,se)}return;default:if(Vr(a)){for(var Pt in l)ne=l[Pt],l.hasOwnProperty(Pt)&&ne!==void 0&&!h.hasOwnProperty(Pt)&&gg(s,a,Pt,void 0,h,ne);for(le in h)ne=h[le],se=l[le],!h.hasOwnProperty(le)||ne===se||ne===void 0&&se===void 0||gg(s,a,le,ne,h,se);return}}for(var X in l)ne=l[X],l.hasOwnProperty(X)&&ne!=null&&!h.hasOwnProperty(X)&&Bt(s,a,X,null,h,ne);for(de in h)ne=h[de],se=l[de],!h.hasOwnProperty(de)||ne===se||ne==null&&se==null||Bt(s,a,de,ne,h,se)}function Sw(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rM(){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],_=m.transferSize,C=m.initiatorType,M=m.duration;if(_&&M&&Sw(C)){for(C=0,M=m.responseEnd,h+=1;h<l.length;h++){var q=l[h],te=q.startTime;if(te>M)break;var le=q.transferSize,de=q.initiatorType;le&&Sw(de)&&(q=q.responseEnd,C+=le*(q<M?1:(M-te)/(q-te)))}if(--h,a+=8*(_+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 _g=null,vg=null;function pd(s){return s.nodeType===9?s:s.ownerDocument}function ww(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 xw(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 yg(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 bg=null;function aM(){var s=window.event;return s&&s.type==="popstate"?s===bg?!1:(bg=s,!0):(bg=null,!1)}var Cw=typeof setTimeout=="function"?setTimeout:void 0,oM=typeof clearTimeout=="function"?clearTimeout:void 0,kw=typeof Promise=="function"?Promise:void 0,lM=typeof queueMicrotask=="function"?queueMicrotask:typeof kw<"u"?function(s){return kw.resolve(null).then(s).catch(cM)}:Cw;function cM(s){setTimeout(function(){throw s})}function fa(s){return s==="head"}function Ew(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),cl(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")Pc(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Pc(l);for(var _=l.firstChild;_;){var C=_.nextSibling,M=_.nodeName;_[un]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&_.rel.toLowerCase()==="stylesheet"||l.removeChild(_),_=C}}else l==="body"&&Pc(s.ownerDocument.body);l=m}while(l);cl(a)}function Tw(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 Sg(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":Sg(l),Me(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function uM(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(_=s.getAttribute("rel"),_==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(_!==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(_=s.getAttribute("src"),(_!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&_&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var _=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===_)return s}else return s;if(s=bs(s.nextSibling),s===null)break}return null}function hM(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=bs(s.nextSibling),s===null))return null;return s}function Aw(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=bs(s.nextSibling),s===null))return null;return s}function wg(s){return s.data==="$?"||s.data==="$~"}function xg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function dM(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 bs(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 Cg=null;function Rw(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return bs(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function Nw(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 Lw(s,a,l){switch(a=pd(l),s){case"html":if(s=a.documentElement,!s)throw Error(n(452));return s;case"head":if(s=a.head,!s)throw Error(n(453));return s;case"body":if(s=a.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function Pc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Me(s)}var Ss=new Map,Mw=new Set;function md(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Nr=j.d;j.d={f:fM,r:pM,D:mM,C:gM,L:_M,m:vM,X:bM,S:yM,M:SM};function fM(){var s=Nr.f(),a=ad();return s||a}function pM(s){var a=ae(s);a!==null&&a.tag===5&&a.type==="form"?Y1(a):Nr.r(s)}var al=typeof document>"u"?null:document;function Ow(s,a,l){var h=al;if(h&&typeof a=="string"&&a){var m=Nn(a);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),Mw.has(m)||(Mw.add(m),s={rel:s,crossOrigin:l,href:a},h.querySelector(m)===null&&(a=h.createElement("link"),tn(a,"link",s),Qe(a),h.head.appendChild(a)))}}function mM(s){Nr.D(s),Ow("dns-prefetch",s,null)}function gM(s,a){Nr.C(s,a),Ow("preconnect",s,a)}function _M(s,a,l){Nr.L(s,a,l);var h=al;if(h&&s&&a){var m='link[rel="preload"][as="'+Nn(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Nn(l.imageSizes)+'"]')):m+='[href="'+Nn(s)+'"]';var _=m;switch(a){case"style":_=ol(s);break;case"script":_=ll(s)}Ss.has(_)||(s=v({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Ss.set(_,s),h.querySelector(m)!==null||a==="style"&&h.querySelector(zc(_))||a==="script"&&h.querySelector($c(_))||(a=h.createElement("link"),tn(a,"link",s),Qe(a),h.head.appendChild(a)))}}function vM(s,a){Nr.m(s,a);var l=al;if(l&&s){var h=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Nn(h)+'"][href="'+Nn(s)+'"]',_=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=ll(s)}if(!Ss.has(_)&&(s=v({rel:"modulepreload",href:s},a),Ss.set(_,s),l.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector($c(_)))return}h=l.createElement("link"),tn(h,"link",s),Qe(h),l.head.appendChild(h)}}}function yM(s,a,l){Nr.S(s,a,l);var h=al;if(h&&s){var m=Ze(h).hoistableStyles,_=ol(s);a=a||"default";var C=m.get(_);if(!C){var M={loading:0,preload:null};if(C=h.querySelector(zc(_)))M.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Ss.get(_))&&kg(s,l);var q=C=h.createElement("link");Qe(q),tn(q,"link",s),q._p=new Promise(function(te,le){q.onload=te,q.onerror=le}),q.addEventListener("load",function(){M.loading|=1}),q.addEventListener("error",function(){M.loading|=2}),M.loading|=4,gd(C,a,h)}C={type:"stylesheet",instance:C,count:1,state:M},m.set(_,C)}}}function bM(s,a){Nr.X(s,a);var l=al;if(l&&s){var h=Ze(l).hoistableScripts,m=ll(s),_=h.get(m);_||(_=l.querySelector($c(m)),_||(s=v({src:s,async:!0},a),(a=Ss.get(m))&&Eg(s,a),_=l.createElement("script"),Qe(_),tn(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},h.set(m,_))}}function SM(s,a){Nr.M(s,a);var l=al;if(l&&s){var h=Ze(l).hoistableScripts,m=ll(s),_=h.get(m);_||(_=l.querySelector($c(m)),_||(s=v({src:s,async:!0,type:"module"},a),(a=Ss.get(m))&&Eg(s,a),_=l.createElement("script"),Qe(_),tn(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},h.set(m,_))}}function Dw(s,a,l,h){var m=(m=ve.current)?md(m):null;if(!m)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=ol(l.href),l=Ze(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=ol(l.href);var _=Ze(m).hoistableStyles,C=_.get(s);if(C||(m=m.ownerDocument||m,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(s,C),(_=m.querySelector(zc(s)))&&!_._p&&(C.instance=_,C.state.loading=5),Ss.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},Ss.set(s,l),_||wM(m,s,l,C.state))),a&&h===null)throw Error(n(528,""));return C}if(a&&h!==null)throw Error(n(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ll(l),l=Ze(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(n(444,s))}}function ol(s){return'href="'+Nn(s)+'"'}function zc(s){return'link[rel="stylesheet"]['+s+"]"}function jw(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function wM(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}),tn(a,"link",l),Qe(a),s.head.appendChild(a))}function ll(s){return'[src="'+Nn(s)+'"]'}function $c(s){return"script[async]"+s}function Iw(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(h)return a.instance=h,Qe(h),h;var m=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Qe(h),tn(h,"style",m),gd(h,l.precedence,s),a.instance=h;case"stylesheet":m=ol(l.href);var _=s.querySelector(zc(m));if(_)return a.state.loading|=4,a.instance=_,Qe(_),_;h=jw(l),(m=Ss.get(m))&&kg(h,m),_=(s.ownerDocument||s).createElement("link"),Qe(_);var C=_;return C._p=new Promise(function(M,q){C.onload=M,C.onerror=q}),tn(_,"link",h),a.state.loading|=4,gd(_,l.precedence,s),a.instance=_;case"script":return _=ll(l.src),(m=s.querySelector($c(_)))?(a.instance=m,Qe(m),m):(h=l,(m=Ss.get(_))&&(h=v({},l),Eg(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),Qe(m),tn(m,"link",h),s.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(n(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,gd(h,l.precedence,s));return a.instance}function gd(s,a,l){for(var h=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,_=m,C=0;C<h.length;C++){var M=h[C];if(M.dataset.precedence===a)_=M;else if(_!==m)break}_?_.parentNode.insertBefore(s,_.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function kg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Eg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var _d=null;function Bw(s,a,l){if(_d===null){var h=new Map,m=_d=new Map;m.set(l,h)}else m=_d,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 _=l[m];if(!(_[un]||_[He]||s==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var C=_.getAttribute(a)||"";C=s+C;var M=h.get(C);M?M.push(_):h.set(C,[_])}}return h}function Pw(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function xM(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 zw(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function CM(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=ol(h.href),_=a.querySelector(zc(m));if(_){a=_._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=vd.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=_,Qe(_);return}_=a.ownerDocument||a,h=jw(h),(m=Ss.get(m))&&kg(h,m),_=_.createElement("link"),Qe(_);var C=_;C._p=new Promise(function(M,q){C.onload=M,C.onerror=q}),tn(_,"link",h),l.instance=_}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=vd.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var Tg=0;function kM(s,a){return s.stylesheets&&s.count===0&&bd(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&bd(s,s.stylesheets),s.unsuspend){var _=s.unsuspend;s.unsuspend=null,_()}},6e4+a);0<s.imgBytes&&Tg===0&&(Tg=62500*rM());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&bd(s,s.stylesheets),s.unsuspend)){var _=s.unsuspend;s.unsuspend=null,_()}},(s.imgBytes>Tg?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function vd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var yd=null;function bd(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,yd=new Map,a.forEach(EM,s),yd=null,vd.call(s))}function EM(s,a){if(!(a.state.loading&4)){var l=yd.get(s);if(l)var h=l.get(null);else{l=new Map,yd.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<m.length;_++){var C=m[_];(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"),_=l.get(C)||h,_===h&&l.set(null,m),l.set(C,m),this.count++,h=vd.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),_?_.parentNode.insertBefore(m,_.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),a.state.loading|=4}}var Hc={$$typeof:I,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function TM(s,a,l,h,m,_,C,M,q){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=Tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tt(0),this.hiddenUpdates=Tt(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=_,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function $w(s,a,l,h,m,_,C,M,q,te,le,de){return s=new TM(s,a,l,C,q,te,le,de,M),a=1,_===!0&&(a|=24),_=Zn(3,null,null,a),s.current=_,_.stateNode=s,a=am(),a.refCount++,s.pooledCache=a,a.refCount++,_.memoizedState={element:h,isDehydrated:l,cache:a},um(_),s}function Hw(s){return s?(s=zo,s):zo}function Fw(s,a,l,h,m,_){m=Hw(m),h.context===null?h.context=m:h.pendingContext=m,h=ia(a),h.payload={element:l},_=_===void 0?null:_,_!==null&&(h.callback=_),l=na(s,h,a),l!==null&&(In(l,s,a),yc(l,s,a))}function Uw(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Ag(s,a){Uw(s,a),(s=s.alternate)&&Uw(s,a)}function Ww(s){if(s.tag===13||s.tag===31){var a=Wa(s,67108864);a!==null&&In(a,s,67108864),Ag(s,67108864)}}function Gw(s){if(s.tag===13||s.tag===31){var a=is();a=st(a);var l=Wa(s,a);l!==null&&In(l,s,a),Ag(s,a)}}var Sd=!0;function AM(s,a,l,h){var m=E.T;E.T=null;var _=j.p;try{j.p=2,Rg(s,a,l,h)}finally{j.p=_,E.T=m}}function RM(s,a,l,h){var m=E.T;E.T=null;var _=j.p;try{j.p=8,Rg(s,a,l,h)}finally{j.p=_,E.T=m}}function Rg(s,a,l,h){if(Sd){var m=Ng(h);if(m===null)mg(s,a,h,wd,l),Kw(s,h);else if(LM(m,s,a,l,h))h.stopPropagation();else if(Kw(s,h),a&4&&-1<NM.indexOf(s)){for(;m!==null;){var _=ae(m);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var C=jt(_.pendingLanes);if(C!==0){var M=_;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var q=1<<31-Dt(C);M.entanglements[1]|=q,C&=~q}Js(_),(Et&6)===0&&(sd=Mt()+500,jc(0))}}break;case 31:case 13:M=Wa(_,2),M!==null&&In(M,_,2),ad(),Ag(_,2)}if(_=Ng(h),_===null&&mg(s,a,h,wd,l),_===m)break;m=_}m!==null&&h.stopPropagation()}else mg(s,a,h,null,l)}}function Ng(s){return s=Je(s),Lg(s)}var wd=null;function Lg(s){if(wd=null,s=F(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 wd=s,null}function qw(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(us()){case Pi:return 2;case _i:return 8;case An:case gn:return 32;case Gn:return 268435456;default:return 32}default:return 32}}var Mg=!1,pa=null,ma=null,ga=null,Fc=new Map,Uc=new Map,_a=[],NM="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 Kw(s,a){switch(s){case"focusin":case"focusout":pa=null;break;case"dragenter":case"dragleave":ma=null;break;case"mouseover":case"mouseout":ga=null;break;case"pointerover":case"pointerout":Fc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Uc.delete(a.pointerId)}}function Wc(s,a,l,h,m,_){return s===null||s.nativeEvent!==_?(s={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:_,targetContainers:[m]},a!==null&&(a=ae(a),a!==null&&Ww(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function LM(s,a,l,h,m){switch(a){case"focusin":return pa=Wc(pa,s,a,l,h,m),!0;case"dragenter":return ma=Wc(ma,s,a,l,h,m),!0;case"mouseover":return ga=Wc(ga,s,a,l,h,m),!0;case"pointerover":var _=m.pointerId;return Fc.set(_,Wc(Fc.get(_)||null,s,a,l,h,m)),!0;case"gotpointercapture":return _=m.pointerId,Uc.set(_,Wc(Uc.get(_)||null,s,a,l,h,m)),!0}return!1}function Vw(s){var a=F(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,ut(s.priority,function(){Gw(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,ut(s.priority,function(){Gw(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 xd(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=Ng(s.nativeEvent);if(l===null){l=s.nativeEvent;var h=new l.constructor(l.type,l);Oe=h,l.target.dispatchEvent(h),Oe=null}else return a=ae(l),a!==null&&Ww(a),s.blockedOn=l,!1;a.shift()}return!0}function Yw(s,a,l){xd(s)&&l.delete(a)}function MM(){Mg=!1,pa!==null&&xd(pa)&&(pa=null),ma!==null&&xd(ma)&&(ma=null),ga!==null&&xd(ga)&&(ga=null),Fc.forEach(Yw),Uc.forEach(Yw)}function Cd(s,a){s.blockedOn===a&&(s.blockedOn=null,Mg||(Mg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,MM)))}var kd=null;function Xw(s){kd!==s&&(kd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kd===s&&(kd=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(Lg(h||l)===null)continue;break}var _=ae(l);_!==null&&(s.splice(a,3),a-=3,Nm(_,{pending:!0,data:m,method:l.method,action:h},h,m))}}))}function cl(s){function a(q){return Cd(q,s)}pa!==null&&Cd(pa,s),ma!==null&&Cd(ma,s),ga!==null&&Cd(ga,s),Fc.forEach(a),Uc.forEach(a);for(var l=0;l<_a.length;l++){var h=_a[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<_a.length&&(l=_a[0],l.blockedOn===null);)Vw(l),l.blockedOn===null&&_a.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(h=0;h<l.length;h+=3){var m=l[h],_=l[h+1],C=m[ye]||null;if(typeof _=="function")C||Xw(l);else if(C){var M=null;if(_&&_.hasAttribute("formAction")){if(m=_,C=_[ye]||null)M=C.formAction;else if(Lg(m)!==null)continue}else M=C.action;typeof M=="function"?l[h+1]=M:(l.splice(h,3),h-=3),Xw(l)}}}function Zw(){function s(_){_.canIntercept&&_.info==="react-transition"&&_.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 _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.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 Og(s){this._internalRoot=s}Ed.prototype.render=Og.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(n(409));var l=a.current,h=is();Fw(l,h,s,a,null,null)},Ed.prototype.unmount=Og.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Fw(s.current,2,null,s,null,null),ad(),a[vt]=null}};function Ed(s){this._internalRoot=s}Ed.prototype.unstable_scheduleHydration=function(s){if(s){var a=ue();s={blockedOn:null,target:s,priority:a};for(var l=0;l<_a.length&&a!==0&&a<_a[l].priority;l++);_a.splice(l,0,s),l===0&&Vw(s)}};var Jw=t.version;if(Jw!=="19.2.7")throw Error(n(527,Jw,"19.2.7"));j.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=f(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var OM={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Td=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Td.isDisabled&&Td.supportsFiber)try{ln=Td.inject(OM),qt=Td}catch{}}return qc.createRoot=function(s,a){if(!r(s))throw Error(n(299));var l=!1,h="",m=rS,_=aS,C=oS;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&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=$w(s,1,!1,null,null,l,h,null,m,_,C,Zw),s[vt]=a.current,pg(s),new Og(a)},qc.hydrateRoot=function(s,a,l){if(!r(s))throw Error(n(299));var h=!1,m="",_=rS,C=aS,M=oS,q=null;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(_=l.onUncaughtError),l.onCaughtError!==void 0&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError),l.formState!==void 0&&(q=l.formState)),a=$w(s,1,!0,a,l??null,h,m,q,_,C,M,Zw),a.context=Hw(null),l=a.current,h=is(),h=st(h),m=ia(h),m.callback=null,na(l,m,h),l=h,a.current.lanes=l,bt(a,l),Js(a),s[vt]=a.current,pg(s),new Ed(a)},qc.version="19.2.7",qc}var cx;function b3(){if(cx)return Bg.exports;cx=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(),Bg.exports=y3(),Bg.exports}var S3=b3();var ux="popstate";function hx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function w3(e={}){function t(n,r){let o=r.state?.masked,{pathname:c,search:d,hash:p}=o||n.location;return uv("",{pathname:c,search:d,hash:p},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function i(n,r){return typeof r=="string"?r:zu(r)}return C3(t,i,null,e)}function si(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function x3(){return Math.random().toString(36).substring(2,10)}function dx(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 uv(e,t,i=null,n,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ql(t):t,state:i,key:t&&t.key||n||x3(),mask:r}}function zu({pathname:e="/",search:t="",hash:i=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function ql(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substring(i),e=e.substring(0,i));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function C3(e,t,i,n={}){let{window:r=document.defaultView,v5Compat:o=!1}=n,c=r.history,d="POP",p=null,f=g();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function g(){return(c.state||{idx:null}).idx}function v(){d="POP";let k=g(),R=k==null?null:k-f;f=k,p&&p({action:d,location:x.location,delta:R})}function y(k,R){d="PUSH";let O=hx(k)?k:uv(x.location,k,R);f=g()+1;let I=dx(O,f),A=x.createHref(O.mask||O);try{c.pushState(I,"",A)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;r.location.assign(A)}o&&p&&p({action:d,location:x.location,delta:1})}function S(k,R){d="REPLACE";let O=hx(k)?k:uv(x.location,k,R);f=g();let I=dx(O,f),A=x.createHref(O.mask||O);c.replaceState(I,"",A),o&&p&&p({action:d,location:x.location,delta:0})}function w(k){return k3(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(ux,v),p=k,()=>{r.removeEventListener(ux,v),p=null}},createHref(k){return t(r,k)},createURL:w,encodeLocation(k){let R=w(k);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:y,replace:S,go(k){return c.go(k)}};return x}function k3(e,t,i=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),si(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:zu(t);return r=r.replace(/ $/,"%20"),!i&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function oE(e,t,i="/"){return E3(e,t,i,!1)}function E3(e,t,i,n,r){let o=typeof t=="string"?ql(t):t,c=Fr(o.pathname||"/",i);if(c==null)return null;let d=T3(e),p=null,f=z3(c);for(let g=0;p==null&&g<d.length;++g)p=B3(d[g],f,n);return p}function T3(e){let t=lE(e);return A3(t),t}function lE(e,t=[],i=[],n="",r=!1){let o=(c,d,p=r,f)=>{let g={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(n)&&p)return;si(g.relativePath.startsWith(n),`Absolute route path "${g.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(n.length)}let v=$s([n,g.relativePath]),y=i.concat(g);c.children&&c.children.length>0&&(si(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),lE(c.children,t,y,v,p)),!(c.path==null&&!c.index)&&t.push({path:v,score:j3(v,c.index),routesMeta:y})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))o(c,d);else for(let p of cE(c.path))o(c,d,!0,p)}),t}function cE(e){let t=e.split("/");if(t.length===0)return[];let[i,...n]=t,r=i.endsWith("?"),o=i.replace(/\?$/,"");if(n.length===0)return r?[o,""]:[o];let c=cE(n.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 A3(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:I3(t.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}var R3=/^:[\w-]+$/,N3=3,L3=2,M3=1,O3=10,D3=-2,fx=e=>e==="*";function j3(e,t){let i=e.split("/"),n=i.length;return i.some(fx)&&(n+=D3),t&&(n+=L3),i.filter(r=>!fx(r)).reduce((r,o)=>r+(R3.test(o)?N3:o===""?M3:O3),n)}function I3(e,t){return e.length===t.length&&e.slice(0,-1).every((n,r)=>n===t[r])?e[e.length-1]-t[t.length-1]:0}function B3(e,t,i=!1){let{routesMeta:n}=e,r={},o="/",c=[];for(let d=0;d<n.length;++d){let p=n[d],f=d===n.length-1,g=o==="/"?t:t.slice(o.length)||"/",v=Rf({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},g),y=p.route;if(!v&&f&&i&&!n[n.length-1].route.index&&(v=Rf({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!v)return null;Object.assign(r,v.params),c.push({params:r,pathname:$s([o,v.pathname]),pathnameBase:U3($s([o,v.pathnameBase])),route:y}),v.pathnameBase!=="/"&&(o=$s([o,v.pathnameBase]))}return c}function Rf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,n]=P3(e.path,e.caseSensitive,e.end),r=t.match(i);if(!r)return null;let o=r[0],c=o.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:n.reduce((f,{paramName:g,isOptional:v},y)=>{if(g==="*"){let w=d[y]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[y];return v&&!S?f[g]=void 0:f[g]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:c,pattern:e}}function P3(e,t=!1,i=!0){Fs(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 n=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,p,f,g)=>{if(n.push({paramName:d,isOptional:p!=null}),p){let v=g.charAt(f+c.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),n]}function z3(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fs(!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 Fr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,n=e.charAt(i);return n&&n!=="/"?null:e.slice(i)||"/"}var $3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function H3(e,t="/"){let{pathname:i,search:n="",hash:r=""}=typeof e=="string"?ql(e):e,o;return i?(i=uE(i),i.startsWith("/")?o=px(i.substring(1),"/"):o=px(i,t)):o=t,{pathname:o,search:W3(n),hash:G3(r)}}function px(e,t){let i=Nf(t).split("/");return e.split("/").forEach(r=>{r===".."?i.length>1&&i.pop():r!=="."&&i.push(r)}),i.length>1?i.join("/"):"/"}function Hg(e,t,i,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function F3(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function hb(e){let t=F3(e);return t.map((i,n)=>n===t.length-1?i.pathname:i.pathnameBase)}function cp(e,t,i,n=!1){let r;typeof e=="string"?r=ql(e):(r={...e},si(!r.pathname||!r.pathname.includes("?"),Hg("?","pathname","search",r)),si(!r.pathname||!r.pathname.includes("#"),Hg("#","pathname","hash",r)),si(!r.search||!r.search.includes("#"),Hg("#","search","hash",r)));let o=e===""||r.pathname==="",c=o?"/":r.pathname,d;if(c==null)d=i;else{let v=t.length-1;if(!n&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),v-=1;r.pathname=y.join("/")}d=v>=0?t[v]:"/"}let p=H3(r,d),f=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(f||g)&&(p.pathname+="/"),p}var uE=e=>e.replace(/\/\/+/g,"/"),$s=e=>uE(e.join("/")),Nf=e=>e.replace(/\/+$/,""),U3=e=>Nf(e).replace(/^\/*/,"/"),W3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,G3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,q3=class{constructor(e,t,i,n=!1){this.status=e,this.statusText=t||"",this.internal=n,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function K3(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function V3(e){let t=e.map(i=>i.route.path).filter(Boolean);return $s(t)||"/"}var hE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function dE(e,t){let i=e;if(typeof i!="string"||!$3.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let n=i,r=!1;if(hE)try{let o=new URL(window.location.href),c=i.startsWith("//")?new URL(o.protocol+i):new URL(i),d=Fr(c.pathname,t);c.origin===o.origin&&d!=null?i=d+c.search+c.hash:r=!0}catch{Fs(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:r,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fE=["POST","PUT","PATCH","DELETE"];new Set(fE);var Y3=["GET",...fE];new Set(Y3);var Kl=b.createContext(null);Kl.displayName="DataRouter";var up=b.createContext(null);up.displayName="DataRouterState";var pE=b.createContext(!1);function X3(){return b.useContext(pE)}var mE=b.createContext({isTransitioning:!1});mE.displayName="ViewTransition";var Z3=b.createContext(new Map);Z3.displayName="Fetchers";var J3=b.createContext(null);J3.displayName="Await";var cs=b.createContext(null);cs.displayName="Navigation";var ah=b.createContext(null);ah.displayName="Location";var ur=b.createContext({outlet:null,matches:[],isDataRoute:!1});ur.displayName="Route";var db=b.createContext(null);db.displayName="RouteError";var gE="REACT_ROUTER_ERROR",Q3="REDIRECT",e6="ROUTE_ERROR_RESPONSE";function t6(e){if(e.startsWith(`${gE}:${Q3}:{`))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 i6(e){if(e.startsWith(`${gE}:${e6}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new q3(t.status,t.statusText,t.data)}catch{}}function n6(e,{relative:t}={}){si(Vl(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:n}=b.useContext(cs),{hash:r,pathname:o,search:c}=lh(e,{relative:t}),d=o;return i!=="/"&&(d=o==="/"?i:$s([i,o])),n.createHref({pathname:d,search:c,hash:r})}function Vl(){return b.useContext(ah)!=null}function Ws(){return si(Vl(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(ah).location}var _E="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function vE(e){b.useContext(cs).static||b.useLayoutEffect(e)}function oh(){let{isDataRoute:e}=b.useContext(ur);return e?g6():s6()}function s6(){si(Vl(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Kl),{basename:t,navigator:i}=b.useContext(cs),{matches:n}=b.useContext(ur),{pathname:r}=Ws(),o=JSON.stringify(hb(n)),c=b.useRef(!1);return vE(()=>{c.current=!0}),b.useCallback((p,f={})=>{if(Fs(c.current,_E),!c.current)return;if(typeof p=="number"){i.go(p);return}let g=cp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:$s([t,g.pathname])),(f.replace?i.replace:i.push)(g,f.state,f)},[t,i,o,r,e])}b.createContext(null);function lh(e,{relative:t}={}){let{matches:i}=b.useContext(ur),{pathname:n}=Ws(),r=JSON.stringify(hb(i));return b.useMemo(()=>cp(e,JSON.parse(r),n,t==="path"),[e,r,n,t])}function r6(e,t){return yE(e,t)}function yE(e,t,i){si(Vl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=b.useContext(cs),{matches:r}=b.useContext(ur),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||"";SE(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 g=Ws(),v;if(t){let k=typeof t=="string"?ql(t):t;si(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.`),v=k}else v=g;let y=v.pathname||"/",S=y;if(p!=="/"){let k=p.replace(/^\//,"").split("/");S="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=i&&i.state.matches.length?i.state.matches.map(k=>Object.assign(k,{route:i.manifest[k.route.id]||k.route})):oE(e,{pathname:S});Fs(f||w!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Fs(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 "${v.pathname}${v.search}${v.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=u6(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:$s([p,n.encodeLocation?n.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:$s([p,n.encodeLocation?n.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),r,i);return t&&x?b.createElement(ah.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...v},navigationType:"POP"}},x):x}function a6(){let e=m6(),t=K3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),i?b.createElement("pre",{style:r},i):null,c)}var o6=b.createElement(a6,null),bE=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=i6(e.digest);i&&(e=i)}let t=e!==void 0?b.createElement(ur.Provider,{value:this.props.routeContext},b.createElement(db.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(l6,{error:e},t):t}};bE.contextType=pE;var Fg=new WeakMap;function l6({children:e,error:t}){let{basename:i}=b.useContext(cs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=t6(t.digest);if(n){let r=Fg.get(t);if(r)throw r;let o=dE(n.location,i);if(hE&&!Fg.get(t))if(o.isExternal||n.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:n.replace}));throw Fg.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function c6({routeContext:e,match:t,children:i}){let n=b.useContext(Kl);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(ur.Provider,{value:e},i)}function u6(e,t=[],i){let n=i?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let r=e,o=n?.errors;if(o!=null){let g=r.findIndex(v=>v.route.id&&o?.[v.route.id]!==void 0);si(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,g+1))}let c=!1,d=-1;if(i&&n){c=n.renderFallback;for(let g=0;g<r.length;g++){let v=r[g];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(d=g),v.route.id){let{loaderData:y,errors:S}=n,w=v.route.loader&&!y.hasOwnProperty(v.route.id)&&(!S||S[v.route.id]===void 0);if(v.route.lazy||w){i.isStatic&&(c=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let p=i?.onError,f=n&&p?(g,v)=>{p(g,{location:n.location,params:n.matches?.[0]?.params??{},pattern:V3(n.matches),errorInfo:v})}:void 0;return r.reduceRight((g,v,y)=>{let S,w=!1,x=null,k=null;n&&(S=o&&v.route.id?o[v.route.id]:void 0,x=v.route.errorElement||o6,c&&(d<0&&y===0?(SE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):d===y&&(w=!0,k=v.route.hydrateFallbackElement||null)));let R=t.concat(r.slice(0,y+1)),O=()=>{let I;return S?I=x:w?I=k:v.route.Component?I=b.createElement(v.route.Component,null):v.route.element?I=v.route.element:I=g,b.createElement(c6,{match:v,routeContext:{outlet:g,matches:R,isDataRoute:n!=null},children:I})};return n&&(v.route.ErrorBoundary||v.route.errorElement||y===0)?b.createElement(bE,{location:n.location,revalidation:n.revalidation,component:x,error:S,children:O(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:f}):O()},null)}function fb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function h6(e){let t=b.useContext(Kl);return si(t,fb(e)),t}function d6(e){let t=b.useContext(up);return si(t,fb(e)),t}function f6(e){let t=b.useContext(ur);return si(t,fb(e)),t}function pb(e){let t=f6(e),i=t.matches[t.matches.length-1];return si(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function p6(){return pb("useRouteId")}function m6(){let e=b.useContext(db),t=d6("useRouteError"),i=pb("useRouteError");return e!==void 0?e:t.errors?.[i]}function g6(){let{router:e}=h6("useNavigate"),t=pb("useNavigate"),i=b.useRef(!1);return vE(()=>{i.current=!0}),b.useCallback(async(r,o={})=>{Fs(i.current,_E),i.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var mx={};function SE(e,t,i){!t&&!mx[e]&&(mx[e]=!0,Fs(!1,i))}b.memo(_6);function _6({routes:e,manifest:t,future:i,state:n,isStatic:r,onError:o}){return yE(e,void 0,{manifest:t,state:n,isStatic:r,onError:o})}function gx({to:e,replace:t,state:i,relative:n}){si(Vl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=b.useContext(cs);Fs(!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}=b.useContext(ur),{pathname:c}=Ws(),d=oh(),p=cp(e,hb(o),c,n==="path"),f=JSON.stringify(p);return b.useEffect(()=>{d(JSON.parse(f),{replace:t,state:i,relative:n})},[d,f,n,t,i]),null}function vl(e){si(!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 v6({basename:e="/",children:t=null,location:i,navigationType:n="POP",navigator:r,static:o=!1,useTransitions:c}){si(!Vl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),p=b.useMemo(()=>({basename:d,navigator:r,static:o,useTransitions:c,future:{}}),[d,r,o,c]);typeof i=="string"&&(i=ql(i));let{pathname:f="/",search:g="",hash:v="",state:y=null,key:S="default",mask:w}=i,x=b.useMemo(()=>{let k=Fr(f,d);return k==null?null:{location:{pathname:k,search:g,hash:v,state:y,key:S,mask:w},navigationType:n}},[d,f,g,v,y,S,n,w]);return Fs(x!=null,`<Router basename="${d}"> is not able to match the URL "${f}${g}${v}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:b.createElement(cs.Provider,{value:p},b.createElement(ah.Provider,{children:t,value:x}))}function y6({children:e,location:t}){return r6(hv(e),t)}function hv(e,t=[]){let i=[];return b.Children.forEach(e,(n,r)=>{if(!b.isValidElement(n))return;let o=[...t,r];if(n.type===b.Fragment){i.push.apply(i,hv(n.props.children,o));return}si(n.type===vl,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),si(!n.props.index||!n.props.children,"An index route cannot have child routes.");let c={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(c.children=hv(n.props.children,o)),i.push(c)}),i}var rf="get",af="application/x-www-form-urlencoded";function hp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function b6(e){return hp(e)&&e.tagName.toLowerCase()==="button"}function S6(e){return hp(e)&&e.tagName.toLowerCase()==="form"}function w6(e){return hp(e)&&e.tagName.toLowerCase()==="input"}function x6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function C6(e,t){return e.button===0&&(!t||t==="_self")&&!x6(e)}var Ad=null;function k6(){if(Ad===null)try{new FormData(document.createElement("form"),0),Ad=!1}catch{Ad=!0}return Ad}var E6=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ug(e){return e!=null&&!E6.has(e)?(Fs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${af}"`),null):e}function T6(e,t){let i,n,r,o,c;if(S6(e)){let d=e.getAttribute("action");n=d?Fr(d,t):null,i=e.getAttribute("method")||rf,r=Ug(e.getAttribute("enctype"))||af,o=new FormData(e)}else if(b6(e)||w6(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(n=p?Fr(p,t):null,i=e.getAttribute("formmethod")||d.getAttribute("method")||rf,r=Ug(e.getAttribute("formenctype"))||Ug(d.getAttribute("enctype"))||af,o=new FormData(d,e),!k6()){let{name:f,type:g,value:v}=e;if(g==="image"){let y=f?`${f}.`:"";o.append(`${y}x`,"0"),o.append(`${y}y`,"0")}else f&&o.append(f,v)}}else{if(hp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=rf,n=null,r=af,c=e}return o&&r==="text/plain"&&(c=o,o=void 0),{action:n,method:i.toLowerCase(),encType:r,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function mb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wE(e,t,i,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${n}`:r.pathname=`${r.pathname}.${n}`:r.pathname==="/"?r.pathname=`_root.${n}`:t&&Fr(r.pathname,t)==="/"?r.pathname=`${Nf(t)}/_root.${n}`:r.pathname=`${Nf(r.pathname)}.${n}`,r}async function A6(e,t){if(e.id in t)return t[e.id];try{let i=await import(e.module);return t[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function R6(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 N6(e,t,i){let n=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let c=await A6(o,i);return c.links?c.links():[]}return[]}));return D6(n.flat(1).filter(R6).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function _x(e,t,i,n,r,o){let c=(p,f)=>i[f]?p.route.id!==i[f].route.id:!0,d=(p,f)=>i[f].pathname!==p.pathname||i[f].route.path?.endsWith("*")&&i[f].params["*"]!==p.params["*"];return o==="assets"?t.filter((p,f)=>c(p,f)||d(p,f)):o==="data"?t.filter((p,f)=>{let g=n.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(c(p,f)||d(p,f))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function L6(e,t,{includeHydrateFallback:i}={}){return M6(e.map(n=>{let r=t.routes[n.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),i&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function M6(e){return[...new Set(e)]}function O6(e){let t={},i=Object.keys(e).sort();for(let n of i)t[n]=e[n];return t}function D6(e,t){let i=new Set;return new Set(t),e.reduce((n,r)=>{let o=JSON.stringify(O6(r));return i.has(o)||(i.add(o),n.push({key:o,link:r})),n},[])}function gb(){let e=b.useContext(Kl);return mb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function j6(){let e=b.useContext(up);return mb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var _b=b.createContext(void 0);_b.displayName="FrameworkContext";function vb(){let e=b.useContext(_b);return mb(e,"You must render this element inside a <HydratedRouter> element"),e}function I6(e,t){let i=b.useContext(_b),[n,r]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:f,onMouseLeave:g,onTouchStart:v}=t,y=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=R=>{R.forEach(O=>{c(O.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return y.current&&k.observe(y.current),()=>{k.disconnect()}}},[e]),b.useEffect(()=>{if(n){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[n]);let S=()=>{r(!0)},w=()=>{r(!1),c(!1)};return i?e!=="intent"?[o,y,{}]:[o,y,{onFocus:Kc(d,S),onBlur:Kc(p,w),onMouseEnter:Kc(f,S),onMouseLeave:Kc(g,w),onTouchStart:Kc(v,S)}]:[!1,y,{}]}function Kc(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function B6({page:e,...t}){let i=X3(),{router:n}=gb(),r=b.useMemo(()=>oE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?i?b.createElement(z6,{page:e,matches:r,...t}):b.createElement($6,{page:e,matches:r,...t}):null}function P6(e){let{manifest:t,routeModules:i}=vb(),[n,r]=b.useState([]);return b.useEffect(()=>{let o=!1;return N6(e,t,i).then(c=>{o||r(c)}),()=>{o=!0}},[e,t,i]),n}function z6({page:e,matches:t,...i}){let n=Ws(),{future:r}=vb(),{basename:o}=gb(),c=b.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let d=wE(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?p=!0:f.push(g.route.id);return p&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[o,r.v8_trailingSlashAwareDataRequests,e,n,t]);return b.createElement(b.Fragment,null,c.map(d=>b.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...i})))}function $6({page:e,matches:t,...i}){let n=Ws(),{future:r,manifest:o,routeModules:c}=vb(),{basename:d}=gb(),{loaderData:p,matches:f}=j6(),g=b.useMemo(()=>_x(e,t,f,o,n,"data"),[e,t,f,o,n]),v=b.useMemo(()=>_x(e,t,f,o,n,"assets"),[e,t,f,o,n]),y=b.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let x=new Set,k=!1;if(t.forEach(O=>{let I=o.routes[O.route.id];!I||!I.hasLoader||(!g.some(A=>A.route.id===O.route.id)&&O.route.id in p&&c[O.route.id]?.shouldRevalidate||I.hasClientLoader?k=!0:x.add(O.route.id))}),x.size===0)return[];let R=wE(e,d,r.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&R.searchParams.set("_routes",t.filter(O=>x.has(O.route.id)).map(O=>O.route.id).join(",")),[R.pathname+R.search]},[d,r.v8_trailingSlashAwareDataRequests,p,n,o,g,t,e,c]),S=b.useMemo(()=>L6(v,o),[v,o]),w=P6(v);return b.createElement(b.Fragment,null,y.map(x=>b.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...i})),S.map(x=>b.createElement("link",{key:x,rel:"modulepreload",href:x,...i})),w.map(({key:x,link:k})=>b.createElement("link",{key:x,nonce:i.nonce,...k,crossOrigin:k.crossOrigin??i.crossOrigin})))}function H6(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var F6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{F6&&(window.__reactRouterVersion="7.17.0")}catch{}function U6({basename:e,children:t,useTransitions:i,window:n}){let r=b.useRef();r.current==null&&(r.current=w3({window:n,v5Compat:!0}));let o=r.current,[c,d]=b.useState({action:o.action,location:o.location}),p=b.useCallback(f=>{i===!1?d(f):b.startTransition(()=>d(f))},[i]);return b.useLayoutEffect(()=>o.listen(p),[o,p]),b.createElement(v6,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:i})}var xE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$u=b.forwardRef(function({onClick:t,discover:i="render",prefetch:n="none",relative:r,reloadDocument:o,replace:c,mask:d,state:p,target:f,to:g,preventScrollReset:v,viewTransition:y,defaultShouldRevalidate:S,...w},x){let{basename:k,navigator:R,useTransitions:O}=b.useContext(cs),I=typeof g=="string"&&xE.test(g),A=dE(g,k);g=A.to;let $=n6(g,{relative:r}),L=Ws(),H=null;if(d){let T=cp(d,[],L.mask?L.mask.pathname:"/",!0);k!=="/"&&(T.pathname=T.pathname==="/"?k:$s([k,T.pathname])),H=R.createHref(T)}let[U,oe,fe]=I6(n,w),K=K6(g,{replace:c,mask:d,state:p,target:f,preventScrollReset:v,relative:r,viewTransition:y,defaultShouldRevalidate:S,useTransitions:O});function z(T){t&&t(T),T.defaultPrevented||K(T)}let N=!(A.isExternal||o),D=b.createElement("a",{...w,...fe,href:(N?H:void 0)||A.absoluteURL||$,onClick:N?z:t,ref:H6(x,oe),target:f,"data-discover":!I&&i==="render"?"true":void 0});return U&&!I?b.createElement(b.Fragment,null,D,b.createElement(B6,{page:$})):D});$u.displayName="Link";var W6=b.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:n="",end:r=!1,style:o,to:c,viewTransition:d,children:p,...f},g){let v=lh(c,{relative:f.relative}),y=Ws(),S=b.useContext(up),{navigator:w,basename:x}=b.useContext(cs),k=S!=null&&J6(v)&&d===!0,R=w.encodeLocation?w.encodeLocation(v).pathname:v.pathname,O=y.pathname,I=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(O=O.toLowerCase(),I=I?I.toLowerCase():null,R=R.toLowerCase()),I&&x&&(I=Fr(I,x)||I);const A=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let $=O===R||!r&&O.startsWith(R)&&O.charAt(A)==="/",L=I!=null&&(I===R||!r&&I.startsWith(R)&&I.charAt(R.length)==="/"),H={isActive:$,isPending:L,isTransitioning:k},U=$?t:void 0,oe;typeof n=="function"?oe=n(H):oe=[n,$?"active":null,L?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let fe=typeof o=="function"?o(H):o;return b.createElement($u,{...f,"aria-current":U,className:oe,ref:g,style:fe,to:c,viewTransition:d},typeof p=="function"?p(H):p)});W6.displayName="NavLink";var G6=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:n,replace:r,state:o,method:c=rf,action:d,onSubmit:p,relative:f,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:y,...S},w)=>{let{useTransitions:x}=b.useContext(cs),k=X6(),R=Z6(d,{relative:f}),O=c.toLowerCase()==="get"?"get":"post",I=typeof d=="string"&&xE.test(d),A=$=>{if(p&&p($),$.defaultPrevented)return;$.preventDefault();let L=$.nativeEvent.submitter,H=L?.getAttribute("formmethod")||c,U=()=>k(L||$.currentTarget,{fetcherKey:t,method:H,navigate:i,replace:r,state:o,relative:f,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:y});x&&i!==!1?b.startTransition(()=>U()):U()};return b.createElement("form",{ref:w,method:O,action:R,onSubmit:n?p:A,...S,"data-discover":!I&&e==="render"?"true":void 0})});G6.displayName="Form";function q6(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CE(e){let t=b.useContext(Kl);return si(t,q6(e)),t}function K6(e,{target:t,replace:i,mask:n,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p,useTransitions:f}={}){let g=oh(),v=Ws(),y=lh(e,{relative:c});return b.useCallback(S=>{if(C6(S,t)){S.preventDefault();let w=i!==void 0?i:zu(v)===zu(y),x=()=>g(e,{replace:w,mask:n,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p});f?b.startTransition(()=>x()):x()}},[v,g,y,i,n,r,t,e,o,c,d,p,f])}var V6=0,Y6=()=>`__${String(++V6)}__`;function X6(){let{router:e}=CE("useSubmit"),{basename:t}=b.useContext(cs),i=p6(),n=e.fetch,r=e.navigate;return b.useCallback(async(o,c={})=>{let{action:d,method:p,encType:f,formData:g,body:v}=T6(o,t);if(c.navigate===!1){let y=c.fetcherKey||Y6();await n(y,i,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:v,formMethod:c.method||p,formEncType:c.encType||f,flushSync:c.flushSync})}else await r(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:v,formMethod:c.method||p,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:i,flushSync:c.flushSync,viewTransition:c.viewTransition})},[n,r,t,i])}function Z6(e,{relative:t}={}){let{basename:i}=b.useContext(cs),n=b.useContext(ur);si(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),o={...lh(e||".",{relative:t})},c=Ws();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),p=d.getAll("index");if(p.some(g=>g==="")){d.delete("index"),p.filter(v=>v).forEach(v=>d.append("index",v));let g=d.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(o.pathname=o.pathname==="/"?i:$s([i,o.pathname])),zu(o)}function J6(e,{relative:t}={}){let i=b.useContext(mE);si(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=CE("useViewTransitionState"),r=lh(e,{relative:t});if(!i.isTransitioning)return!1;let o=Fr(i.currentLocation.pathname,n)||i.currentLocation.pathname,c=Fr(i.nextLocation.pathname,n)||i.nextLocation.pathname;return Rf(r.pathname,c)!=null||Rf(r.pathname,o)!=null}var Pa=aE();const Q6=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class gt extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function e4(e){const t=await fetch("/api/v1/theaters",{signal:e});await mn(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new gt(t.status,"Invalid Theater response");return{theaters:i.theaters.map(n=>RE(n,t.status))}}async function t4(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/api/v1/status${i}`,{signal:t});return await mn(n),u4(await n.json(),n.status)}async function i4(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const i=t.size>0?`?${t}`:"",n=await fetch(`/api/v1/updates/release-notes${i}`,{signal:e.signal});return await mn(n),d4(await n.json(),n.status)}async function n4(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await mn(t),h4(await t.json(),t.status)}async function kE(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await mn(i);const n=await i.json();return RE(n,i.status)}async function s4(e,t){const i=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await mn(i),_4(await i.json(),i.status)}async function EE(e,t){const i=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await mn(i);const n=await i.json();if(typeof n.folderGrantId!="string")throw new gt(i.status,"Invalid folder grant response");return n.folderGrantId}async function r4(e,t,i){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t}),signal:i});return await mn(n),await n.json()}async function a4(e,t,i,n){const r=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t,name:i}),signal:n});return await mn(r),await r.json()}async function o4(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await mn(i)}async function Hn(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/api/v1/operations${i}`,{signal:t});await mn(n);const r=await n.json();if(!Array.isArray(r.operations))throw new gt(n.status,"Invalid operations response");return r.operations.map(o=>AE(o,n.status))}async function oo(e,t){const n=await fetch("/api/v1/operations/groups",{signal:t});await mn(n);const r=await n.json();if(!Array.isArray(r.groups))throw new gt(n.status,"Invalid groups response");return r.groups.map(o=>yb(o,n.status))}async function l4(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await mn(i);const n=await i.json();return yb(n.group,i.status)}async function Wg(e,t,i){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await mn(n);const r=await n.json();return yb(r.group,n.status)}async function c4(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await mn(i)}async function TE(e,t,i){return of(e,{title:t},i)}async function of(e,t,i){const n=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await mn(n);const r=await n.json();return AE(r.operation,n.status)}function AE(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||Hu(i)||Hu(i.payload))throw new gt(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,accent:typeof i.accent=="string"?i.accent:null,groupId:i.groupId===null?null:typeof i.groupId=="string"?i.groupId:void 0,ts:i.ts}}function yb(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.name!="string"||typeof i.color!="string"||typeof i.order!="number"||typeof i.createdAt!="number")throw new gt(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function RE(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string"||typeof i.createdAt!="string"||typeof i.lastOpenedAt!="string"||typeof i.hasWiki!="boolean"||typeof i.activeAdmiralCount!="number"||Hu(i))throw new gt(t,"Invalid Theater response");return i}function u4(e,t){const i=e;if(!i||typeof i.workspaces!="number"||typeof i.version!="string"||i.channel!=="stable"&&i.channel!=="local"&&i.channel!=="unknown"||typeof i.updateAvailable!="boolean"||typeof i.port!="number"||i.portMode!=="dynamic"&&i.portMode!=="static"||i.requestedPort!==null&&typeof i.requestedPort!="number"||typeof i.effectivePort!="number"||typeof i.portHonored!="boolean"||i.wikiServerStatus!=="available"&&i.wikiServerStatus!=="unavailable"&&i.wikiServerStatus!=="unknown")throw new gt(t,"Invalid status response");return{workspaces:i.workspaces,version:i.version,channel:i.channel,updateAvailable:i.updateAvailable,latestVersion:typeof i.latestVersion=="string"?i.latestVersion:void 0,port:i.port,portMode:i.portMode,requestedPort:i.requestedPort,effectivePort:i.effectivePort,portHonored:i.portHonored,wikiServerStatus:i.wikiServerStatus}}function h4(e,t){const i=e;if(!i||i.status!=="accepted")throw new gt(t,"Invalid update response");return{status:"accepted"}}function d4(e,t){const i=e;if(!i||!Array.isArray(i.notes)||i.sourceRef!=="main"||typeof i.fetchedAt!="number"||typeof i.stale!="boolean"||"url"in i||"token"in i||"path"in i)throw new gt(t,"Invalid release notes response");return{notes:i.notes.map(n=>f4(n,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function f4(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections)||typeof i.localizationFallback!="boolean")throw new gt(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(n=>p4(n,t)),localizationFallback:i.localizationFallback}}function p4(e,t){const i=e;if(!i||i.heading!=="Added"&&i.heading!=="Changed"&&i.heading!=="Fixed"&&i.heading!=="Removed"&&i.heading!=="Breaking Changes"||!Array.isArray(i.items))throw new gt(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(n=>m4(n,t))}}function m4(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(n=>typeof n=="string")||typeof i.text!="string"||"product"in i&&!g4(i.product))throw new gt(t,"Invalid release notes response");return"product"in i?{packageTags:i.packageTags,text:i.text,product:i.product}:{packageTags:i.packageTags,text:i.text}}function g4(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function _4(e,t){const i=e;if(!i||typeof i.path!="string"||i.parentPath!==null&&typeof i.parentPath!="string"||!Array.isArray(i.roots)||!Array.isArray(i.entries)||Hu(i))throw new gt(t,"Invalid folder list response");return{path:i.path,parentPath:i.parentPath??null,roots:i.roots.filter(n=>typeof n=="string"),entries:i.entries.map(n=>v4(n,t)),truncated:i.truncated===!0?!0:void 0}}function v4(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||Hu(i))throw new gt(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function Hu(e){if(!e||typeof e!="object")return!1;const t=e;return Q6.some(i=>i in t)}async function mn(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const i=await e.json();typeof i.error=="string"?t=i.error:typeof i.message=="string"&&(t=i.message)}catch{}throw new gt(e.status,t)}function vx(e,t){return e!==null&&e===t?e:null}function y4(e,t){return e&&t}function b4(e,t){return e?!1:t}const S4="__unassigned__";function w4(e){const t=new Map(e.theaters.map(n=>[n.id,n])),i=[];for(const n of e.operations)n.theaterId&&i.push(k4(n,t.get(n.theaterId)));return i}function x4(e,t){const i=NE(t);return i.length===0?e:e.filter(n=>{const r=E4(n);return i.every(o=>r.includes(o))})}function C4(e){const t=[],i=new Map;for(const n of e){const r=n.theaterId??S4,o=i.get(r);if(o!==void 0){const c=t[o];c&&(t[o]={...c,entries:[...c.entries,n]});continue}i.set(r,t.length),t.push({theaterId:n.theaterId,theaterLabel:n.theaterLabel,entries:[n]})}return t}function NE(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function k4(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function E4(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const T4=200,A4=.5,R4="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",N4=["monospace","serif","sans-serif"],mu=new Map;function L4(e,t={}){const i=dp(e);if(!i)return!1;const n=i.toLocaleLowerCase(),r=mu.get(n);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=N4.some(p=>{const f=yx(c,`${LE(i)}, ${p}`),g=yx(c,p);return Math.abs(f-g)>A4});return M4(n,d,t.maxEntries??T4),d}function LE(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Lf(e,t){const i=dp(e);return i?`${LE(i)}, ${t}`:t}function dp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function yx(e,t){return e.font=`28px ${t}`,e.measureText(R4).width}function M4(e,t,i){if(mu.size>=Math.max(1,i)){const n=mu.keys().next().value;n&&mu.delete(n)}mu.set(e,t)}const Nl={min:12,max:18,step:1,defaultValue:14},Nu={source:"builtin",id:"manrope",size:Nl.defaultValue},Mf=[{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 O4(e){if(!e||typeof e!="object")return Nu;const t=e,i=D4(t.size);if(t.source==="builtin"&&I4(t.id))return{source:"builtin",id:t.id,size:i};if(t.source==="system"&&typeof t.familyName=="string"){const n=dp(t.familyName);if(n)return{source:"system",familyName:n,size:i}}return Nu}function D4(e){return typeof e!="number"||!Number.isInteger(e)||e<Nl.min||e>Nl.max?Nl.defaultValue:e}function ME(e){return e.source==="system"?Lf(e.familyName,Mf[0].family):j4(e.id).family}function j4(e){return Mf.find(t=>t.id===e)??Mf[0]}function I4(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const dv="fleet-console.activeTheaterId",OE="fleet-console.commissioningSeen",DE="fleet-console.whatsNewSeenVersion",jE="fleet-console.notificationPreferences",IE=1,B4="instrument",Rd={globalMute:!1,dnd:!1,mutedTheaterIds:{}},fv=new Set;let bx=0,pv=null,Fe={connection:"connecting",connectionError:null,activeTheme:B4,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:dO(),codexReader:null,codexReaderExpanded:!1};function Fu(){return Fe}function BE(e){return fv.add(e),()=>{fv.delete(e)}}function ot(e){Fe={...Fe,...e},lO()}function P4(e){Fe.operationsViewActive!==e&&ot({operationsViewActive:e})}function Of(e){U4(e),ot({activeTheme:e})}function mv(e){G4(e)}function z4(e){ot({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...GE({...Fe,version:e.version})})}function $4(){ot({releaseNotesLoading:!0,releaseNotesError:null})}function H4(e){const t={...Fe,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Fe.selectedReleaseNoteKey&&KE(e.notes,Fe.selectedReleaseNoteKey)?Fe.selectedReleaseNoteKey:qE(e.notes)};ot({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...GE(t)})}function F4(e){ot({releaseNotesLoading:!1,releaseNotesError:e})}function U4(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function W4(){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 G4(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",ME(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function q4(e){const t=WE(e,Fe.activeTheaterId);ot({theaters:e,activeTheaterId:t})}function K4(e){q4(e.theaters)}function os(e){ot({operations:e,operationsHydrated:!0})}function V4(e){const t=new Set(e.map(n=>n.id)),i=Fe.operations.filter(n=>!t.has(n.id));ot({operations:[...e,...i],operationsHydrated:!0})}function Y4(e){const t=Fe.operations.findIndex(n=>n.id===e.id);if(t===-1)return;const i=[...Fe.operations];i[t]=e,ot({operations:i})}function lo(e){ot({groups:e})}function X4(e){fp(e),ot({activeTheaterId:e})}function $n(e){Fe.activeOperationId!==e&&ot({activeOperationId:e})}function Z4(e,t){if(t==="idle"){PE(e);return}Fe.operationStatus[e]!==t&&ot({operationStatus:{...Fe.operationStatus,[e]:t}})}function PE(e){if(!(e in Fe.operationStatus))return;const t={...Fe.operationStatus};delete t[e],ot({operationStatus:t})}function J4(e){if(!e.operationId)return;const t=Fe.operations.find(c=>c.id===e.operationId);if(!t)return;const i=t.theaterId??null,n=Fe.theaters.find(c=>c.id===i)?.label??i??"Unknown",r=t.title,o=uO(e.kind);bx+=1,ot({operationNotifications:{...Fe.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:i,theaterLabel:n,operationLabel:r,lastRaisedSeq:bx}}})}function zE(){ot({addingTheater:!0,theaterError:null})}function $E(e){const t=[e,...Fe.theaters.filter(i=>i.id!==e.id)];fp(e.id),ot({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function Q4(){ot({addingTheater:!1,theaterError:null})}function gv(e){ot({addingTheater:!1,theaterError:e})}function Uu(e){const t=Fe.operations.find(i=>i.id===e);t&&(fp(t.theaterId),ot({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:UE(Fe.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function Gg(){Fe.pendingOperationFocus!==null&&ot({pendingOperationFocus:null})}function eO(e,t,i){if(e.length===0)return null;const n=t?e.indexOf(t):-1,r=n===-1?i>0?0:e.length-1:(n+i+e.length)%e.length;return e[r]??null}function bb(e,t){if(t.length===0)return[...e].sort(_v);const i=new Map(t.map((n,r)=>[n,r]));return[...e].sort((n,r)=>{const o=i.get(n.id),c=i.get(r.id);return o!==void 0&&c!==void 0?o-c:o!==void 0?-1:c!==void 0?1:_v(n,r)})}function HE(e,t,i,n=[]){const r=bb(e,i),o=new Set(n),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 _v(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function qg(){ot({operationSearchOpen:!1})}function FE(){ot({operationSearchOpen:!Fe.operationSearchOpen})}function tO(){Fe.releaseNotes.length===0||Fe.whatsNewOpen||ot({whatsNewOpen:!0,selectedReleaseNoteKey:Fe.selectedReleaseNoteKey??qE(Fe.releaseNotes)})}function Nd(){Fe.whatsNewOpen&&(Fe.automaticWhatsNewVersion&&gO(Fe.automaticWhatsNewVersion),ot({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function Sx(e){KE(Fe.releaseNotes,e)&&ot({selectedReleaseNoteKey:e})}function Vc(){pO(!0),Fe.onboardingOpen&&ot({onboardingOpen:!1})}function zr(e){ot({codexReader:e,codexReaderExpanded:!1})}function lf(){Fe.codexReader!==null&&ot({codexReaderExpanded:!0})}function iO(){ot({codexReaderExpanded:!1})}function Kg(){ot({codexReader:null,codexReaderExpanded:!1})}function wx(){if(Fe.bootstrapped)return;const e=Fe.theaters.length===0&&!fO();ot({bootstrapped:!0,onboardingOpen:e?!0:Fe.onboardingOpen})}function xx(e){const t=Fe.theaters.filter(c=>c.id!==e),i=WE(t,Fe.activeTheaterId===e?null:Fe.activeTheaterId),n=cO(Fe.operationNotifications,e),r=new Set(Fe.operations.filter(c=>c.theaterId===e).map(c=>c.id)),o=Fe.activeOperationId&&r.has(Fe.activeOperationId)?null:Fe.activeOperationId;fp(i),ot({theaters:t,activeTheaterId:i,activeOperationId:o,operationNotifications:n})}function nO(e){const t=UE(Fe.operationNotifications,e);t!==Fe.operationNotifications&&ot({operationNotifications:t})}function sO(e){const t={...Fe.notificationPreferences,globalMute:e};wb(t),ot({notificationPreferences:t})}function rO(e){const t={...Fe.notificationPreferences,dnd:e};wb(t),ot({notificationPreferences:t})}function aO(e){const t={...Fe.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...Fe.notificationPreferences,mutedTheaterIds:t};wb(i),ot({notificationPreferences:i})}function oO(e){return w4(e)}function lO(){for(const e of fv)e()}function UE(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function cO(e,t){let i=!1;const n={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){i=!0;continue}n[r]=o}return i?n:e}function WE(e,t){const i=new Set(e.map(r=>r.id)),n=hO();return n&&i.has(n)?n:t&&i.has(t)?t:e[0]?.id??null}function uO(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function GE(e){const t=e.releaseNotes.findIndex(n=>n.version!=="Unreleased"),i=t>=0?e.releaseNotes[t]:void 0;return!i||!e.version||i.version!==e.version||mO()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:Sb(i.version,t)}}function qE(e){return e[0]?Sb(e[0].version,0):null}function KE(e,t){return e.some((i,n)=>Sb(i.version,n)===t)}function Sb(e,t){return`${e}:${t}`}function hO(){if(typeof window>"u")return null;try{return window.localStorage.getItem(dv)}catch{return null}}function fp(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(dv,e):window.localStorage.removeItem(dv)}catch{}}function dO(){if(typeof window>"u")return Rd;try{const e=window.localStorage.getItem(jE);if(!e)return Rd;const t=JSON.parse(e);return _O(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Rd}catch{return Rd}}function fO(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(OE)==="1"}catch{return!1}}function pO(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(OE,"1")}catch{}}function mO(){if(pv!==null)return pv;if(typeof window>"u")return null;try{return window.localStorage.getItem(DE)}catch{return null}}function gO(e){if(pv=e,!(typeof window>"u"))try{window.localStorage.setItem(DE,e)}catch{}}function wb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jE,JSON.stringify({version:IE,preferences:e}))}catch{}}function _O(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==IE||!t.preferences||typeof t.preferences!="object")return!1;const i=t.preferences;return typeof i.globalMute=="boolean"&&typeof i.dnd=="boolean"&&!!i.mutedTheaterIds&&typeof i.mutedTheaterIds=="object"}function Gs(){return b.useSyncExternalStore(BE,Fu,Fu)}const vO=[{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"}]}],gu="data-keyboard-shortcuts-open",yO='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function VE(){return document.body.getAttribute(gu)==="true"}function bO(){return!VE()}function SO({onClose:e}){const t=b.useRef(null);b.useEffect(()=>{const n=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(gu);return document.body.setAttribute(gu,"true"),r&&(r.inert=!0),n?.focus(),()=>{o===null?document.body.removeAttribute(gu):document.body.setAttribute(gu,o),r&&(r.inert=!1)}},[e]);const i=n=>{if(n.key==="Escape"){n.preventDefault(),e();return}if(n.key!=="Tab")return;const r=[...t.current?.querySelectorAll(yO)??[]];if(r.length===0){n.preventDefault(),t.current?.focus();return}const o=r[0],c=r[r.length-1],d=document.activeElement;(d===t.current||!t.current?.contains(d)||(n.shiftKey?d===o:d===c))&&(n.preventDefault(),(n.shiftKey?c:o)?.focus())};return Pa.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:i,onMouseDown:n=>n.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:"✕"})]}),vO.map(n=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:n.title}),u.jsx("dl",{children:n.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})]},`${n.title}:${r.description}`))})]},n.title))]})}),document.body)}const wO=1400,xO="https://github.com/sbluemin/fleet-harness",CO="https://github.com/sbluemin/fleet-harness/stargazers",kO="https://api.github.com/repos/sbluemin/fleet-harness",xb="fleet-console.github-stars",EO=360*60*1e3,Cx='[role="menuitem"]:not([disabled])';function TO(){const e=Gs();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(RO,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(NO,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function AO({className:e="brand-foot-home"}){return u.jsxs($u,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(HO,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function RO({latestVersion:e,updateAvailable:t}){const i=b.useRef(null),n=b.useRef(null),r=b.useRef(null),[o,c]=b.useState(!1),d=oh();YE(i,n,r,o,c);const p=f=>{c(!1),d(f),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:n,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(kx,{}),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(kx,{}),u.jsx("span",{children:"Settings"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/carrier-settings"),children:[u.jsx(FO,{}),u.jsx("span",{children:"Carriers"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(LO,{latestVersion:e})]}):null]}):null]})}function NO({releaseDisabled:e,version:t}){const i=b.useRef(null),n=b.useRef(null),r=b.useRef(null),[o,c]=b.useState(!1),[d,p]=b.useState(!1);return YE(i,n,r,o,c),u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:n,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(UO,{})}),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),tO()},children:[u.jsx(WO,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),p(!0)},children:[u.jsx(GO,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(MO,{menuItem:!0,version:t})]}):null,d?u.jsx(SO,{onClose:()=>{p(!1),n.current?.focus()}}):null]})}function YE(e,t,i,n,r){b.useEffect(()=>{if(!n)return;const o=window.requestAnimationFrame(()=>{i.current?.querySelector(Cx)?.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=[...i.current?.querySelectorAll(Cx)??[]];if(f.length===0)return;p.preventDefault();const g=f.findIndex(y=>y===document.activeElement),v=p.key==="Home"||p.key==="ArrowDown"&&g===f.length-1?0:p.key==="End"||p.key==="ArrowUp"&&g<=0?f.length-1:p.key==="ArrowDown"?g+1:g-1;f[v]?.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)}},[i,n,e,r,t])}function LO({latestVersion:e}){const[t,i]=b.useState("idle"),[n,r]=b.useState(null),o=b.useRef(null),c=OO(t,n,e);b.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const d=async()=>{if(!c.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),i("applying"),r(null);try{if((await n4()).status!=="accepted"){i("error"),r("invalid_response");return}i("accepted"),o.current=window.setTimeout(()=>{o.current=null,i("completed")},wO)}catch(p){const f=p instanceof gt?p.message:"network_error";r(f),i(jO(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 MO({menuItem:e=!1,version:t}){const i=IO(),n=i.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:xO,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(qO,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:CO,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":n?`GitHub stars ${i.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(KO,{}),n?u.jsx("span",{className:"brand-foot-github-stars-count",children:$O(i.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function OO(e,t,i){const n=i?`Latest version ${i}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?DO(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:n,tone:"warn",disabled:!1}}function DO(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 jO(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function IO(){const[e,t]=b.useState(()=>{const i=BO();return i===null?{count:null,status:"idle"}:{count:i,status:"ready"}});return b.useEffect(()=>{if(PO())return;let i=!1;return t(n=>n.status==="ready"?n:{...n,status:"loading"}),fetch(kO,{headers:{Accept:"application/vnd.github+json"}}).then(n=>n.ok?n.json():Promise.reject(new Error(`status ${n.status}`))).then(n=>{if(i)return;const r=typeof n.stargazers_count=="number"?n.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}zO(r),t({count:r,status:"ready"})}).catch(()=>{i||t(n=>({count:n.count,status:n.count===null?"error":"ready"}))}),()=>{i=!0}},[]),e}function BO(){try{const e=window.localStorage.getItem(xb);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function PO(){try{const e=window.localStorage.getItem(xb);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<EO}catch{return!1}}function zO(e){try{window.localStorage.setItem(xb,JSON.stringify({count:e,at:Date.now()}))}catch{}}function $O(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function HO(){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 FO(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),u.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function kx(){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 UO(){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 WO(){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 GO(){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 qO(){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 KO(){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 VO=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class Hs extends Error{status;constructor(t,i){super(i),this.status=t}}async function YO(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await mp(i),ZE(await i.json(),i.status)}async function XE(e,t,i){t!==null&&JE(t);const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:i});return await mp(n),ZE(await n.json(),n.status)}async function XO(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await mp(i),JO(await i.json(),i.status)}async function ZO(e,t,i){t!==null&&JE(t);const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:i});return await mp(n),QO(await n.json(),n.status)}function ZE(e,t=200){Wu(e,t);const i=e;if(i.kind!=="root"&&i.kind!=="worktree"&&i.kind!=="directory"||!QE(i.label))throw new Hs(t,"Invalid path context response");if(i.relPath!==null&&(typeof i.relPath!="string"||!pp(i.relPath)))throw new Hs(t,"Invalid path context response");if(i.kind==="root"!=(i.relPath===null))throw new Hs(t,"Invalid path context response");return{kind:i.kind,relPath:i.relPath,label:i.label}}function JO(e,t=200){Wu(e,t);const i=e;if(typeof i.isGitRepo!="boolean"||!Array.isArray(i.worktrees))throw new Hs(t,"Invalid worktrees response");return{isGitRepo:i.isGitRepo,worktrees:i.worktrees.map(n=>{Wu(n,t);const r=n;if(typeof r.relPath!="string"||!pp(r.relPath)||r.branch!==null&&typeof r.branch!="string"||typeof r.isCurrent!="boolean")throw new Hs(t,"Invalid worktrees response");return{relPath:r.relPath,branch:r.branch,isCurrent:r.isCurrent}})}}function QO(e,t=200){Wu(e,t);const i=e;if(!Array.isArray(i.directories))throw new Hs(t,"Invalid directories response");return i.directories.map(n=>{Wu(n,t);const r=n;if(typeof r.relPath!="string"||!pp(r.relPath)||!QE(r.label))throw new Hs(t,"Invalid directories response");return{relPath:r.relPath,label:r.label}})}function JE(e){if(!pp(e))throw new Hs(400,"Invalid relative path")}function pp(e){return e.length>0&&e.length<=4096&&!e.includes("\0")&&!e.includes("\\")&&!e.startsWith("/")&&!/^[A-Za-z]:/.test(e)&&!e.split("/").some(t=>t===""||t==="."||t==="..")}function QE(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function Wu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Hs(t,"Invalid path context response");for(const i of Object.keys(e))if(VO.has(i.toLowerCase()))throw new Hs(t,"Unsafe path context response")}async function mp(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new Hs(e.status,t)}function eD({theaterId:e,parentPath:t,selectedRelPath:i,isDisabled:n,loadDirectories:r,onSelect:o}){const[c,d]=b.useState(null),[p,f]=b.useState(null);return b.useEffect(()=>{const g=new AbortController;return d(null),f(null),r(t,g.signal).then(d).catch(v=>{g.signal.aborted||f(v instanceof Error?v.message:"Unable to load directories")}),()=>g.abort()},[e,t,r]),p?b.createElement("div",{className:"rail-context-tree-status"},p):c?b.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},c.map(g=>b.createElement(e5,{key:g.relPath,directory:g,theaterId:e,depth:0,selectedRelPath:i,isDisabled:n,loadDirectories:r,onSelect:o}))):b.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function e5({directory:e,theaterId:t,depth:i,selectedRelPath:n,isDisabled:r,loadDirectories:o,onSelect:c}){const[d,p]=b.useState(!1),[f,g]=b.useState(null),[v,y]=b.useState(!1),S=b.useCallback(()=>{if(d){p(!1);return}if(p(!0),f)return;const k=new AbortController;y(!0),o(e.relPath,k.signal).then(g).catch(()=>g([])).finally(()=>y(!1))},[f,e.relPath,d,o]),w=b.createElement("div",{className:`rail-context-tree-row${i>0?" is-nested":""}`,style:{paddingLeft:`${i*16}px`}},b.createElement("button",{className:`rail-context-expand${d?" is-expanded":""}`,type:"button",disabled:r,"aria-label":`${d?"Collapse":"Expand"} ${e.label}`,onClick:S},"▸"),b.createElement("button",{className:`rail-context-select${n===e.relPath?" is-selected":""}`,type:"button",disabled:r,onClick:()=>c(e.relPath)},b.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),b.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),b.createElement("span",{className:"rail-context-row-label"},e.label))),x=d&&f?.map(k=>b.createElement(e5,{key:k.relPath,directory:k,theaterId:t,depth:i+1,selectedRelPath:n,isDisabled:r,loadDirectories:o,onSelect:c}));return b.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":d},w,d&&v?b.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,x)}const t5=b.forwardRef(function({className:t,theaterId:i,theaterLabel:n,context:r,isMutating:o,onSelect:c,onClose:d},p){const[f,g]=b.useState(null);b.useEffect(()=>{const S=new AbortController;return XO(i,S.signal).then(g).catch(()=>g({isGitRepo:!1,worktrees:[]})),()=>S.abort()},[i]),b.useEffect(()=>{const S=w=>{w.key==="Escape"&&d()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[d]);const v=b.useCallback((S,w)=>ZO(i,S,w),[i]),y=b.useCallback(S=>{o||c(S)},[o,c]);return u.jsxs("div",{ref:p,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[u.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),u.jsxs("button",{className:`rail-context-row${r.relPath===null?" is-selected":""}`,type:"button",disabled:o,onClick:()=>y(null),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),u.jsx("span",{className:"rail-context-row-label",children:n}),u.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),u.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[u.jsx("h3",{children:"DIRECTORIES"}),u.jsx(eD,{theaterId:i,parentPath:null,selectedRelPath:r.relPath,isDisabled:o,loadDirectories:v,onSelect:y},`${i}:${r.relPath??"root"}`)]}),f?.isGitRepo?u.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[u.jsx("h3",{children:"WORKTREES"}),f.worktrees.map(S=>u.jsxs("button",{className:`rail-context-row${r.relPath===S.relPath?" is-selected":""}`,type:"button",title:S.relPath,disabled:o,onClick:()=>y(S.relPath),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),u.jsx("span",{className:"rail-context-row-label",children:S.relPath.split("/").at(-1)}),S.branch?u.jsx("span",{className:"rail-context-row-secondary",children:S.branch}):null]},S.relPath))]}):null,u.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),vv="fleet-console.rail.activePanelId",i5="fleet-console.rail.chromeExpanded",yv=new Set,go=new Map,bv=new Map,Ll=new Map,Lu=new Map;let Df=null,_u=0,yt={activeRailPanelId:cD(),railChromeExpanded:uD(),rightRailWidth:44,panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function tD(e,t,i){return!e||t===null||i}function ch(e){return yv.add(e),()=>{yv.delete(e)}}function uh(){return yt}function iD(e){const t=yt.activeRailPanelId===e?null:e;Fn({...yt,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),c5(t)}function nD(){yt.activeRailPanelId!==null&&(Fn({...yt,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),c5(null))}function sD(e){yt.railChromeExpanded!==e&&(Fn({...yt,railChromeExpanded:e,isPathContextDeckOpen:!1}),hD(e))}function n5(){sD(!yt.railChromeExpanded)}function Ex(e){const t=Number.isFinite(e)?Math.max(0,e):0;yt.rightRailWidth!==t&&Fn({...yt,rightRailWidth:t})}function rD(e,t){if(e!==yt.activeRailPanelId)return;const i=t===null||!Number.isFinite(t)?0:t,n=Math.max(0,Math.round(i)),r=typeof window<"u"?Math.min(n,Math.max(0,window.innerWidth-548)):n;r!==yt.panelExtraWidth&&Fn({...yt,panelExtraWidth:r})}function s5(e){Df?.abort(),Df=null,_u+=1;const t=e?go.get(e):void 0;Fn({...yt,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&u5(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function aD(e,t){yt.pathContextTheaterId!==e&&s5(e),Df?.abort();const i=new AbortController;Df=i;const n=++_u,r=Lu.get(e)??0;go.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),yt.pathContextTheaterId===e&&Fn({...yt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(bv.get(e)??Promise.resolve()),i.signal.aborted||n!==_u)return;const o=await t(i.signal);if(i.signal.aborted||n!==_u||r!==(Lu.get(e)??0))return;const c={context:o,isHydrated:!0,isLoading:!1,error:null};go.set(e,c),yt.pathContextTheaterId===e&&Fn({...yt,pathContext:o,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(o){if(i.signal.aborted||n!==_u||r!==(Lu.get(e)??0))return;const c=o instanceof Error?o.message:"Unable to load path context";go.set(e,{context:null,isHydrated:!1,isLoading:!1,error:c}),yt.pathContextTheaterId===e&&Fn({...yt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:c})}}async function r5(e,t){if(yt.pathContextTheaterId!==e)return null;Lu.set(e,(Lu.get(e)??0)+1),fD(e);const n=(bv.get(e)??Promise.resolve()).then(()=>dD(e,t));return bv.set(e,n.then(()=>{})),n}function cf(e){e!==yt.isPathContextDeckOpen&&Fn({...yt,isPathContextDeckOpen:e})}function a5(){return b.useSyncExternalStore(ch,uh).activeRailPanelId}function o5(){return b.useSyncExternalStore(ch,uh).railChromeExpanded}function oD(){return b.useSyncExternalStore(ch,uh).rightRailWidth}function lD(){return b.useSyncExternalStore(ch,uh).panelExtraWidth}function l5(){return b.useSyncExternalStore(ch,uh)}function cD(){try{return localStorage.getItem(vv)}catch{return null}}function uD(){try{return localStorage.getItem(i5)!=="0"}catch{return!0}}function c5(e){try{e===null?localStorage.removeItem(vv):localStorage.setItem(vv,e)}catch{}}function hD(e){try{localStorage.setItem(i5,e?"1":"0")}catch{}}async function dD(e,t){try{const i=await t(new AbortController().signal),n={context:i,isHydrated:!0,isLoading:!1,error:null};return go.set(e,n),yt.pathContextTheaterId===e&&Fn({...yt,pathContext:i,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),i}catch(i){const n=i instanceof Error?i.message:"Unable to save path context",r=go.get(e);return go.set(e,{context:r?.context??null,isHydrated:r?.isHydrated??!1,isLoading:!1,error:n}),yt.pathContextTheaterId===e&&Fn({...yt,pathContextError:n}),null}finally{pD(e)}}function u5(e){return(Ll.get(e)??0)>0}function fD(e){Ll.set(e,(Ll.get(e)??0)+1),yt.pathContextTheaterId===e&&Fn({...yt,pathContextMutationInProgress:!0,pathContextError:null})}function pD(e){const t=(Ll.get(e)??1)-1;t>0?Ll.set(e,t):Ll.delete(e),yt.pathContextTheaterId===e&&Fn({...yt,pathContextMutationInProgress:u5(e)})}function Fn(e){yt=e;for(const t of yv)t()}function h5(e){const{sizeRange:t}=e,[i,n]=b.useState(""),[r,o]=b.useState(e.size),c=b.useRef(Promise.resolve()),d=b.useId(),p=b.useMemo(()=>mD(e),[e]),f=b.useMemo(()=>gD(p,i),[p,i]),g=b.useMemo(()=>f.map((L,H)=>({row:L,index:H})),[f]),[v,y]=b.useState(()=>_D(p,e.selected)),S=p.find(L=>jf(L.selection,e.selected))??null,w=g[Math.min(v,Math.max(0,g.length-1))]?.row??null,x=`${d}-built-ins`,k=`${d}-installed`;b.useEffect(()=>{o(e.size)},[e.size]),b.useEffect(()=>{v>=g.length&&y(Math.max(0,g.length-1))},[v,g.length]);const R=b.useCallback(L=>{const H=Ax(L,t);o(H),c.current=c.current.catch(()=>{}).then(()=>e.onSizeCommit(H))},[e.onSizeCommit,t]),O=b.useCallback(L=>{f.length&&y(H=>(H+L+f.length)%f.length)},[f.length]),I=b.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),A=b.useCallback((L,H)=>{y(L),e.onSelectionChange(H)},[e]),$=L=>{L.key==="ArrowDown"?(L.preventDefault(),O(1)):L.key==="ArrowUp"?(L.preventDefault(),O(-1)):L.key==="Home"?(L.preventDefault(),y(0)):L.key==="End"?(L.preventDefault(),y(Math.max(0,f.length-1))):(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),I())};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:i,disabled:e.disabled,placeholder:"Search installed fonts",onChange:L=>{n(L.currentTarget.value),y(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?d5(d,v):void 0,"aria-busy":e.loading||void 0,onKeyDown:$,children:[u.jsx(Tx,{groupId:x,label:"Built-in",rows:g.filter(({row:L})=>L.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:A}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(Tx,{groupId:k,label:"Installed on this machine",rows:g.filter(({row:L})=>L.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:A}),!e.loading&&!g.length?u.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),u.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[u.jsxs("div",{className:"fc-font-browser__preview-head",children:[u.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),u.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),u.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),u.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>R(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:()=>R(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:L=>o(Ax(Number(L.currentTarget.value),t)),onPointerUp:L=>R(Number(L.currentTarget.value)),onKeyUp:L=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(L.key)&&R(Number(L.currentTarget.value))}})]})]})})}function Tx({groupId:e,label:t,rows:i,activeRow:n,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}),i.map(({row:p,index:f})=>u.jsxs("button",{id:d5(o,f),type:"button",className:`fc-font-browser__row${jf(p.selection,n?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":jf(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 mD(e){const t=new Set,i=e.builtIns.flatMap(o=>{const c=[o.id,o.label,...o.aliases??[]].map(Mu);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}])}),n=e.installedFonts.map(o=>({id:`system-${Mu(o.family)}`,label:o.family,family:o.family,previewFamily:Lf(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!L4(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!n.some(o=>o.family===r)&&n.unshift({id:`system-${Mu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:Lf(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...i,...n]}function gD(e,t){const i=Mu(t);return i?e.filter(n=>Mu(`${n.label} ${n.description??""}`).includes(i)):e}function Mu(e){return e.trim().toLocaleLowerCase()}function d5(e,t){return`${e}-option-${t}`}function _D(e,t){const i=e.findIndex(n=>jf(n.selection,t));return i>=0?i:0}function jf(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function Ax(e,t){if(!Number.isFinite(e))return t.defaultValue;const i=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,i))}const vD="/api/v1/settings/fonts/system";class xl extends Error{status;constructor(t,i=null){super(t),this.name="SystemFontsFetchError",this.status=i}}function yD(e){if(!p5(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new xl("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(bD)}}async function f5(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new xl("System font fetching is unavailable in this environment.");let i;try{i=await t(vD,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new xl("System fonts could not be loaded.")}if(!i.ok)throw new xl("System fonts could not be loaded.",i.status);let n;try{n=await i.json()}catch{throw new xl("System font response is not valid JSON.",i.status)}return yD(n)}function bD(e){if(!p5(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new xl("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function SD(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function p5(e,t){return SD(e)&&Object.keys(e).length===t.length&&t.every(i=>Object.hasOwn(e,i))}const Rx=250,wD=5e3,Nx=1,xD=1013,CD=4e3,kD=4001;function ED(e){const t=new AbortController,i=new TextEncoder;let n=Rx,r=null,o=null,c=null,d=!1;const p=()=>{o?.dispose(),o=null},f=(y,S)=>{c={cols:y,rows:S},r?.readyState===Nx&&r.send(JSON.stringify({type:"resize",cols:y,rows:S}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:y}=await AD(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await v(TD(y,e.location,e.wsPath),e),n=Rx}catch(y){if(t.signal.aborted)return;e.onStatus?.("connecting",y instanceof Error?y.message:String(y))}await ND(n,t.signal),n=Math.min(n*2,wD)}},v=async(y,S)=>{await new Promise((w,x)=>{const k=(S.webSocketFactory??RD)(y);r=k,k.binaryType="arraybuffer",k.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(R=>{k.readyState===Nx&&k.send(i.encode(R))}),c&&f(c.cols,c.rows)},k.onmessage=R=>{R.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(R.data))},k.onerror=()=>{x(new Error("Terminal WebSocket error"))},k.onclose=R=>{p(),r===k&&(r=null);const O=R?.code;O===CD?(t.abort(),S.onStatus?.("closed","terminal_replaced")):O===kD?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):O===xD&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{d||(d=!0,g())},resize:f,dispose:()=>{t.abort(),p(),e.onStatus?.("closed"),r?.close(),r=null}}}function TD(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function AD(e,t,i){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:i});if(!n.ok)throw new Error(`Terminal ticket request failed: ${n.status}`);const r=await n.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 RD(e){return new WebSocket(e)}async function ND(e,t){await new Promise(i=>{const n=()=>{clearTimeout(r),t.removeEventListener("abort",n),i()},r=setTimeout(n,e);t.addEventListener("abort",n)})}var LD=2,MD=1,OD=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,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.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=n-d,g=r-p-t;return{cols:Math.max(LD,Math.floor(g/e.css.cell.width)),rows:Math.max(MD,Math.floor(f/e.css.cell.height))}}};var Vg=[[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]],DD=[[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]],Oi;function jD(e,t){let i=0,n=t.length-1,r;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(r=i+n>>1,e>t[r][1])i=r+1;else if(e<t[r][0])n=r-1;else return!0;return!1}var ID=class{constructor(){if(this.version="6",!Oi){Oi=new Uint8Array(65536),Oi.fill(1),Oi[0]=0,Oi.fill(0,1,32),Oi.fill(0,127,160),Oi.fill(2,4352,4448),Oi[9001]=2,Oi[9002]=2,Oi.fill(2,11904,42192),Oi[12351]=1,Oi.fill(2,44032,55204),Oi.fill(2,63744,64256),Oi.fill(2,65040,65050),Oi.fill(2,65072,65136),Oi.fill(2,65280,65377),Oi.fill(2,65504,65511);for(let t=0;t<Vg.length;++t)Oi.fill(0,Vg[t][0],Vg[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Oi[t]:jD(t,DD)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,i){let n=this.wcwidth(t),r=n===0&&i!==0;if(r){let o=Bf.extractWidth(i);o===0?r=!1:o>n&&(n=o)}return Bf.createPropertyValue(0,n,r)}},BD=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Lx.isErrorNoTelemetry(t)?new Lx(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(i=>{i(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)}},PD=new BD;function Yg(e){zD(e)||PD.onUnexpectedError(e)}var Sv="Canceled";function zD(e){return e instanceof $D?!0:e instanceof Error&&e.name===Sv&&e.message===Sv}var $D=class extends Error{constructor(){super(Sv),this.name=this.message}},Lx=class wv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof wv)return t;let i=new wv;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function HD(e,t){let i=this,n=!1,r;return function(){return n||(n=!0,t||(r=e.apply(i,arguments))),r}}var FD;(e=>{function t(o){return o<0}e.isLessThan=t;function i(o){return o<=0}e.isLessThanOrEqual=i;function n(o){return o>0}e.isGreaterThan=n;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(FD||={});var m5;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function c(A){return A||i}e.from=c;function*d(A){for(let $=A.length-1;$>=0;$--)yield A[$]}e.reverse=d;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,$){let L=0;for(let H of A)if($(H,L++))return!0;return!1}e.some=g;function v(A,$){for(let L of A)if($(L))return L}e.find=v;function*y(A,$){for(let L of A)$(L)&&(yield L)}e.filter=y;function*S(A,$){let L=0;for(let H of A)yield $(H,L++)}e.map=S;function*w(A,$){let L=0;for(let H of A)yield*$(H,L++)}e.flatMap=w;function*x(...A){for(let $ of A)yield*$}e.concat=x;function k(A,$,L){let H=L;for(let U of A)H=$(H,U);return H}e.reduce=k;function*R(A,$,L=A.length){for($<0&&($+=A.length),L<0?L+=A.length:L>A.length&&(L=A.length);$<L;$++)yield A[$]}e.slice=R;function O(A,$=Number.POSITIVE_INFINITY){let L=[];if($===0)return[L,A];let H=A[Symbol.iterator]();for(let U=0;U<$;U++){let oe=H.next();if(oe.done)return[L,e.empty()];L.push(oe.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=O;async function I(A){let $=[];for await(let L of A)$.push(L);return Promise.resolve($)}e.asyncToArray=I})(m5||={});function g5(e){if(m5.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 UD(...e){return _5(()=>g5(e))}function _5(e){return{dispose:HD(()=>{e()})}}var v5=class y5{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{g5(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?y5.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)}};v5.DISABLE_DISPOSED_WARNING=!1;var Cb=v5,If=class{constructor(){this._store=new Cb,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)}};If.None=Object.freeze({dispose(){}});var WD=globalThis.performance&&typeof globalThis.performance.now=="function",GD=class b5{static create(t){return new b5(t)}constructor(t){this._now=WD&&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}},qD;(e=>{e.None=()=>If.None;function t(z,N){return v(z,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function i(z){return(N,D=null,T)=>{let E=!1,j;return j=z(P=>{if(!E)return j?j.dispose():E=!0,N.call(D,P)},null,T),E&&j.dispose(),j}}e.once=i;function n(z,N,D){return f((T,E=null,j)=>z(P=>T.call(E,N(P)),null,j),D)}e.map=n;function r(z,N,D){return f((T,E=null,j)=>z(P=>{N(P),T.call(E,P)},null,j),D)}e.forEach=r;function o(z,N,D){return f((T,E=null,j)=>z(P=>N(P)&&T.call(E,P),null,j),D)}e.filter=o;function c(z){return z}e.signal=c;function d(...z){return(N,D=null,T)=>{let E=UD(...z.map(j=>j(P=>N.call(D,P))));return g(E,T)}}e.any=d;function p(z,N,D,T){let E=D;return n(z,j=>(E=N(E,j),E),T)}e.reduce=p;function f(z,N){let D,T={onWillAddFirstListener(){D=z(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new Ca(T);return N?.add(E),E.event}function g(z,N){return N instanceof Array?N.push(z):N&&N.add(z),z}function v(z,N,D=100,T=!1,E=!1,j,P){let V,Q,B,Z=0,W,re={leakWarningThreshold:j,onWillAddFirstListener(){V=z(ve=>{Z++,Q=N(Q,ve),T&&!B&&(ie.fire(Q),Q=void 0),W=()=>{let xe=Q;Q=void 0,B=void 0,(!T||Z>1)&&ie.fire(xe),Z=0},typeof D=="number"?(clearTimeout(B),B=setTimeout(W,D)):B===void 0&&(B=0,queueMicrotask(W))})},onWillRemoveListener(){E&&Z>0&&W?.()},onDidRemoveLastListener(){W=void 0,V.dispose()}},ie=new Ca(re);return P?.add(ie),ie.event}e.debounce=v;function y(z,N=0,D){return e.debounce(z,(T,E)=>T?(T.push(E),T):[E],N,void 0,!0,void 0,D)}e.accumulate=y;function S(z,N=(T,E)=>T===E,D){let T=!0,E;return o(z,j=>{let P=T||!N(j,E);return T=!1,E=j,P},D)}e.latch=S;function w(z,N,D){return[e.filter(z,N,D),e.filter(z,T=>!N(T),D)]}e.split=w;function x(z,N=!1,D=[],T){let E=D.slice(),j=z(Q=>{E?E.push(Q):V.fire(Q)});T&&T.add(j);let P=()=>{E?.forEach(Q=>V.fire(Q)),E=null},V=new Ca({onWillAddFirstListener(){j||(j=z(Q=>V.fire(Q)),T&&T.add(j))},onDidAddFirstListener(){E&&(N?setTimeout(P):P())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(V),V.event}e.buffer=x;function k(z,N){return(D,T,E)=>{let j=N(new O);return z(function(P){let V=j.evaluate(P);V!==R&&D.call(T,V)},void 0,E)}}e.chain=k;let R=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:R),this}reduce(N,D){let T=D;return this.steps.push(E=>(T=N(T,E),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(E=>{let j=D||!N(E,T);return D=!1,T=E,j?E:R}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===R)break;return N}}function I(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.on(N,T),j=()=>z.removeListener(N,T),P=new Ca({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromNodeEventEmitter=I;function A(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.addEventListener(N,T),j=()=>z.removeEventListener(N,T),P=new Ca({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromDOMEventEmitter=A;function $(z){return new Promise(N=>i(z)(N))}e.toPromise=$;function L(z){let N=new Ca;return z.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=L;function H(z,N){return z(D=>N.fire(D))}e.forward=H;function U(z,N,D){return N(D),z(T=>N(T))}e.runAndSubscribe=U;class oe{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Ca(T),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function fe(z,N){return new oe(z,N).emitter.event}e.fromObservable=fe;function K(z){return(N,D,T)=>{let E=0,j=!1,P={beginUpdate(){E++},endUpdate(){E--,E===0&&(z.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};z.addObserver(P),z.reportChanges();let V={dispose(){z.removeObserver(P)}};return T instanceof Cb?T.add(V):Array.isArray(T)&&T.push(V),V}}e.fromObservableLight=K})(qD||={});var xv=class Cv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Cv._idPool++}`,Cv.all.add(this)}start(t){this._stopWatch=new GD,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};xv.all=new Set,xv._idPool=0;var KD=xv,VD=-1,S5=class w5{constructor(t,i,n=(w5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)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=n*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new ZD(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,i=0;for(let[n,r]of this._stacks)(!t||i<r)&&(t=[n,r],i=r);return t}};S5._idPool=1;var YD=S5,XD=class x5{constructor(t){this.value=t}static create(){let t=new Error;return new x5(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
+
`).slice(2).join(`
|
|
17
|
+
`))}},ZD=class extends Error{constructor(t,i){super(t),this.name="ListenerLeakError",this.stack=i}},JD=class extends Error{constructor(t,i){super(t),this.name="ListenerRefusalError",this.stack=i}},QD=0,Xg=class{constructor(t){this.value=t,this.id=QD++}},ej=2,tj,Ca=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new YD(t?.onListenerError??Yg,this._options?.leakWarningThreshold??VD):void 0,this._perfMon=this._options?._profName?new KD(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,i,n)=>{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 JD(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Yg)(f),If.None}if(this._disposed)return If.None;i&&(t=t.bind(i));let r=new Xg(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=XD.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Xg?(this._deliveryQueue??=new ij,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=_5(()=>{o?.(),this._removeListener(r)});return n instanceof Cb?n.add(c):Array.isArray(n)&&n.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 i=this._listeners,n=i.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ej<=i.length){let o=0;for(let c=0;c<i.length;c++)i[c]?i[o++]=i[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=o}}_deliver(t,i){if(!t)return;let n=this._options?.onListenerError||Yg;if(!n){t.value(i);return}try{t.value(i)}catch(r){n(r)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Xg)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ij=class{constructor(){this.i=-1,this.end=0}enqueue(t,i,n){this.i=0,this.end=n,this.current=t,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bf=class uf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ca,this.onChange=this._onChange.event;let t=new ID;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,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?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 i=0,n=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 i+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:i+=this.wcwidth(f)}let d=this.charProperties(c,n),p=uf.extractWidth(d);uf.extractShouldJoin(d)&&(p-=uf.extractWidth(n)),i+=p,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},Zg=[[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]],nj=[[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]],Jg=[[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]],sj=[[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]],Lr;function Mx(e,t){let i=0,n=t.length-1,r;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(r=i+n>>1,e>t[r][1])i=r+1;else if(e<t[r][0])n=r-1;else return!0;return!1}var rj=class{constructor(){if(this.version="11",!Lr){Lr=new Uint8Array(65536),Lr.fill(1),Lr[0]=0,Lr.fill(0,1,32),Lr.fill(0,127,160);for(let t=0;t<Zg.length;++t)Lr.fill(0,Zg[t][0],Zg[t][1]+1);for(let t=0;t<Jg.length;++t)Lr.fill(2,Jg[t][0],Jg[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Lr[t]:Mx(t,nj)?0:Mx(t,sj)?2:1}charProperties(t,i){let n=this.wcwidth(t),r=n===0&&i!==0;if(r){let o=Bf.extractWidth(i);o===0?r=!1:o>n&&(n=o)}return Bf.createPropertyValue(0,n,r)}},aj=class{activate(t){t.unicode.register(new rj)}dispose(){}};var oj=(e,t,i,n)=>{for(var r=t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},lj=(e,t)=>(i,n)=>t(i,n,e),cj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ox.isErrorNoTelemetry(e)?new Ox(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)}},uj=new cj;function Qg(e){hj(e)||uj.onUnexpectedError(e)}var kv="Canceled";function hj(e){return e instanceof dj?!0:e instanceof Error&&e.name===kv&&e.message===kv}var dj=class extends Error{constructor(){super(kv),this.name=this.message}},Ox=class Ev extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ev)return t;let i=new Ev;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},fj;(e=>{function t(o){return o<0}e.isLessThan=t;function i(o){return o<=0}e.isLessThanOrEqual=i;function n(o){return o>0}e.isGreaterThan=n;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(fj||={});function pj(e,t){let i=this,n=!1,r;return function(){return n||(n=!0,t||(r=e.apply(i,arguments))),r}}var C5;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function c(A){return A||i}e.from=c;function*d(A){for(let $=A.length-1;$>=0;$--)yield A[$]}e.reverse=d;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,$){let L=0;for(let H of A)if($(H,L++))return!0;return!1}e.some=g;function v(A,$){for(let L of A)if($(L))return L}e.find=v;function*y(A,$){for(let L of A)$(L)&&(yield L)}e.filter=y;function*S(A,$){let L=0;for(let H of A)yield $(H,L++)}e.map=S;function*w(A,$){let L=0;for(let H of A)yield*$(H,L++)}e.flatMap=w;function*x(...A){for(let $ of A)yield*$}e.concat=x;function k(A,$,L){let H=L;for(let U of A)H=$(H,U);return H}e.reduce=k;function*R(A,$,L=A.length){for($<0&&($+=A.length),L<0?L+=A.length:L>A.length&&(L=A.length);$<L;$++)yield A[$]}e.slice=R;function O(A,$=Number.POSITIVE_INFINITY){let L=[];if($===0)return[L,A];let H=A[Symbol.iterator]();for(let U=0;U<$;U++){let oe=H.next();if(oe.done)return[L,e.empty()];L.push(oe.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=O;async function I(A){let $=[];for await(let L of A)$.push(L);return Promise.resolve($)}e.asyncToArray=I})(C5||={});function k5(e){if(C5.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 E5(...e){return pn(()=>k5(e))}function pn(e){return{dispose:pj(()=>{e()})}}var T5=class A5{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{k5(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?A5.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)}};T5.DISABLE_DISPOSED_WARNING=!1;var Ml=T5,Us=class{constructor(){this._store=new Ml,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)}};Us.None=Object.freeze({dispose(){}});var Yc=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,gp=kb?"node":navigator.userAgent,mj=kb?"node":navigator.platform,gj=gp.includes("Firefox"),_j=gp.includes("Edge"),R5=/^((?!chrome|android).)*safari/i.test(gp);function vj(){if(!R5)return 0;let e=gp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}mj.indexOf("Linux")>=0;var yj="",Fi=0,Ui=0,Wi=0,pi=0,Cs={css:"#00000000",rgba:0},xn;(e=>{function t(r,o,c,d){return d!==void 0?`#${no(r)}${no(o)}${no(c)}${no(d)}`:`#${no(r)}${no(o)}${no(c)}`}e.toCss=t;function i(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=i;function n(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=n})(xn||={});var vu;(e=>{function t(p,f){if(pi=(f.rgba&255)/255,pi===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,v=f.rgba>>16&255,y=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;Fi=S+Math.round((g-S)*pi),Ui=w+Math.round((v-w)*pi),Wi=x+Math.round((y-x)*pi);let k=xn.toCss(Fi,Ui,Wi),R=xn.toRgba(Fi,Ui,Wi);return{css:k,rgba:R}}e.blend=t;function i(p){return(p.rgba&255)===255}e.isOpaque=i;function n(p,f,g){let v=_o.ensureContrastRatio(p.rgba,f.rgba,g);if(v)return xn.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=n;function r(p){let f=(p.rgba|255)>>>0;return[Fi,Ui,Wi]=_o.toChannels(f),{css:xn.toCss(Fi,Ui,Wi),rgba:f}}e.opaque=r;function o(p,f){return pi=Math.round(f*255),[Fi,Ui,Wi]=_o.toChannels(p.rgba),{css:xn.toCss(Fi,Ui,Wi,pi),rgba:xn.toRgba(Fi,Ui,Wi,pi)}}e.opacity=o;function c(p,f){return pi=p.rgba&255,o(p,pi*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(vu||={});var bj;(e=>{let t,i;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",i=t.createLinearGradient(0,0,1,1))}catch{}function n(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Fi=parseInt(r.slice(1,2).repeat(2),16),Ui=parseInt(r.slice(2,3).repeat(2),16),Wi=parseInt(r.slice(3,4).repeat(2),16),xn.toColor(Fi,Ui,Wi);case 5:return Fi=parseInt(r.slice(1,2).repeat(2),16),Ui=parseInt(r.slice(2,3).repeat(2),16),Wi=parseInt(r.slice(3,4).repeat(2),16),pi=parseInt(r.slice(4,5).repeat(2),16),xn.toColor(Fi,Ui,Wi,pi);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 Fi=parseInt(o[1]),Ui=parseInt(o[2]),Wi=parseInt(o[3]),pi=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),xn.toColor(Fi,Ui,Wi,pi);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fi,Ui,Wi,pi]=t.getImageData(0,0,1,1).data,pi!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:xn.toRgba(Fi,Ui,Wi,pi),css:r}}e.toColor=n})(bj||={});var yn;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,r,o){let c=n/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+v*.0722}e.relativeLuminance2=i})(yn||={});var _o;(e=>{function t(c,d){if(pi=(d&255)/255,pi===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,v=c>>24&255,y=c>>16&255,S=c>>8&255;return Fi=v+Math.round((p-v)*pi),Ui=y+Math.round((f-y)*pi),Wi=S+Math.round((g-S)*pi),xn.toRgba(Fi,Ui,Wi)}e.blend=t;function i(c,d,p){let f=yn.relativeLuminance(c>>8),g=yn.relativeLuminance(d>>8);if(Mr(f,g)<p){if(g<f){let S=n(c,d,p),w=Mr(f,yn.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),k=Mr(f,yn.relativeLuminance(x>>8));return w>k?S:x}return S}let v=r(c,d,p),y=Mr(f,yn.relativeLuminance(v>>8));if(y<p){let S=n(c,d,p),w=Mr(f,yn.relativeLuminance(S>>8));return y>w?v:S}return v}}e.ensureContrastRatio=i;function n(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,y=d>>24&255,S=d>>16&255,w=d>>8&255,x=Mr(yn.relativeLuminance2(y,S,w),yn.relativeLuminance2(f,g,v));for(;x<p&&(y>0||S>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Mr(yn.relativeLuminance2(y,S,w),yn.relativeLuminance2(f,g,v));return(y<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=n;function r(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,y=d>>24&255,S=d>>16&255,w=d>>8&255,x=Mr(yn.relativeLuminance2(y,S,w),yn.relativeLuminance2(f,g,v));for(;x<p&&(y<255||S<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Mr(yn.relativeLuminance2(y,S,w),yn.relativeLuminance2(f,g,v));return(y<<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})(_o||={});function no(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ai(e){if(!e)throw new Error("value must not be falsy");return e}function Eb(e){return 57508<=e&&e<=57558}function Sj(e){return 57520<=e&&e<=57527}function wj(e){return 57344<=e&&e<=63743}function xj(e){return 9472<=e&&e<=9631}function Cj(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 kj(e,t,i,n){return t===1&&i>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!Cj(e)&&!Eb(e)&&!wj(e)}function N5(e){return Eb(e)||xj(e)}function Ej(){return{css:{canvas:Ld(),cell:Ld()},device:{canvas:Ld(),cell:Ld(),char:{width:0,height:0,left:0,top:0}}}}function Ld(){return{width:0,height:0}}function Tj(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var nn=0,$i=0,Qs=!1,Or=!1,Md=!1,Bn,e_=0,Aj=class{constructor(e,t,i,n,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=n,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,n){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,$i=0,nn=0,Or=!1,Qs=!1,Md=!1,Bn=this._themeService.colors,e_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));e_=t*n%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",r=>{r.backgroundColorRGB&&($i=r.backgroundColorRGB.rgba>>8&16777215,Or=!0),r.foregroundColorRGB&&(nn=r.foregroundColorRGB.rgba>>8&16777215,Qs=!0)}),Md=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Md){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:$i=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:$i=(this.result.fg&16777215)<<8|255;break;default:$i=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:$i=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:$i=(this.result.bg&16777215)<<8|255;break}$i=_o.blend($i,(this._coreBrowserService.isFocused?Bn.selectionBackgroundOpaque:Bn.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else $i=(this._coreBrowserService.isFocused?Bn.selectionBackgroundOpaque:Bn.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Or=!0,Bn.selectionForeground&&(nn=Bn.selectionForeground.rgba>>8&16777215,Qs=!0),N5(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)nn=(this._coreBrowserService.isFocused?Bn.selectionBackgroundOpaque:Bn.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:nn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:nn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:nn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:nn=(this.result.fg&16777215)<<8|255;break;default:nn=this._themeService.colors.foreground.rgba}nn=_o.blend(nn,(this._coreBrowserService.isFocused?Bn.selectionBackgroundOpaque:Bn.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Qs=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",r=>{r.backgroundColorRGB&&($i=r.backgroundColorRGB.rgba>>8&16777215,Or=!0),r.foregroundColorRGB&&(nn=r.foregroundColorRGB.rgba>>8&16777215,Qs=!0)}),Or&&(Md?$i=e.bg&-16777216&-134217729|$i|50331648:$i=e.bg&-16777216|$i|50331648),Qs&&(nn=e.fg&-16777216&-67108865|nn|50331648),this.result.fg&67108864&&(Or&&!Qs&&((this.result.bg&50331648)===0?nn=this.result.fg&-134217728|Bn.background.rgba>>8&16777215&16777215|50331648:nn=this.result.fg&-134217728|this.result.bg&67108863,Qs=!0),!Or&&Qs&&((this.result.fg&50331648)===0?$i=this.result.bg&-67108864|Bn.foreground.rgba>>8&16777215&16777215|50331648:$i=this.result.bg&-67108864|this.result.fg&67108863,Or=!0)),Bn=void 0,this.result.bg=Or?$i:this.result.bg,this.result.fg=Qs?nn:this.result.fg,this.result.ext&=536870911,this.result.ext|=e_<<29&3758096384}},Rj=.5,L5=gj||_j?"bottom":"ideographic",Nj={"▀":[{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}]},Lj={"░":[[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]]},Mj={"─":{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`}},Gu={"":{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}};Gu[""]=Gu[""];Gu[""]=Gu[""];function Oj(e,t,i,n,r,o,c,d){let p=Nj[t];if(p)return Dj(e,p,i,n,r,o),!0;let f=Lj[t];if(f)return jj(e,f,i,n,r,o),!0;let g=Mj[t];if(g)return Ij(e,g,i,n,r,o,d),!0;let v=Gu[t];return v?(Bj(e,v,i,n,r,o,c,d),!0):!1}function Dj(e,t,i,n,r,o){for(let c=0;c<t.length;c++){let d=t[c],p=r/8,f=o/8;e.fillRect(i+d.x*p,n+d.y*f,d.w*p,d.h*f)}}var Dx=new Map;function jj(e,t,i,n,r,o){let c=Dx.get(t);c||(c=new Map,Dx.set(t,c));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let p=c.get(d);if(!p){let f=t[0].length,g=t.length,v=e.canvas.ownerDocument.createElement("canvas");v.width=f,v.height=g;let y=Ai(v.getContext("2d")),S=new ImageData(f,g),w,x,k,R;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),R=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,k,R]=d.substring(5,d.length-1).split(",").map(O=>parseFloat(O));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let O=0;O<g;O++)for(let I=0;I<f;I++)S.data[(O*f+I)*4]=w,S.data[(O*f+I)*4+1]=x,S.data[(O*f+I)*4+2]=k,S.data[(O*f+I)*4+3]=t[O][I]*(R*255);y.putImageData(S,0,0),p=Ai(e.createPattern(v,null)),c.set(d,p)}e.fillStyle=p,e.fillRect(i,n,r,o)}function Ij(e,t,i,n,r,o,c){e.strokeStyle=e.fillStyle;for(let[d,p]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let f;if(typeof p=="function"){let g=.15/o*r;f=p(.15,g)}else f=p;for(let g of f.split(" ")){let v=g[0],y=M5[v];if(!y){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||y(e,O5(S,r,o,i,n,!0,c))}e.stroke(),e.closePath()}}function Bj(e,t,i,n,r,o,c,d){let p=new Path2D;p.rect(i,n,r,o),e.clip(p),e.beginPath();let f=c/12;e.lineWidth=d*f;for(let g of t.d.split(" ")){let v=g[0],y=M5[v];if(!y){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||y(e,O5(S,r,o,i,n,!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 jx(e,t,i=0){return Math.max(Math.min(e,t),i)}var M5={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 O5(e,t,i,n,r,o,c,d=0,p=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-d*c-p*c,o&&f[g]!==0&&(f[g]=jx(Math.round(f[g]+.5)-.5,t,0)),f[g]+=n+d*c;for(let g=1;g<f.length;g+=2)f[g]*=i,o&&f[g]!==0&&(f[g]=jx(Math.round(f[g]+.5)-.5,i,0)),f[g]+=r;return f}var Ix=class{constructor(){this._data={}}set(t,i,n){this._data[t]||(this._data[t]={}),this._data[t][i]=n}get(t,i){return this._data[t]?this._data[t][i]:void 0}clear(){this._data={}}},Bx=class{constructor(){this._data=new Ix}set(e,t,i,n,r){this._data.get(e,t)||this._data.set(e,t,new Ix),this._data.get(e,t).set(i,n,r)}get(e,t,i,n){return this._data.get(e,t)?.get(i,n)}clear(){this._data.clear()}},D5=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=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),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}},Pj=class extends D5{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let i=performance.now()+t;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},zj=class extends D5{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},$j=!kb&&"requestIdleCallback"in window?zj:Pj,Cl=class j5{constructor(){this.fg=0,this.bg=0,this.extended=new I5}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 j5;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}},I5=class B5{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new B5(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hj=globalThis.performance&&typeof globalThis.performance.now=="function",Fj=class P5{static create(t){return new P5(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}},$r;(e=>{e.None=()=>Us.None;function t(z,N){return v(z,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function i(z){return(N,D=null,T)=>{let E=!1,j;return j=z(P=>{if(!E)return j?j.dispose():E=!0,N.call(D,P)},null,T),E&&j.dispose(),j}}e.once=i;function n(z,N,D){return f((T,E=null,j)=>z(P=>T.call(E,N(P)),null,j),D)}e.map=n;function r(z,N,D){return f((T,E=null,j)=>z(P=>{N(P),T.call(E,P)},null,j),D)}e.forEach=r;function o(z,N,D){return f((T,E=null,j)=>z(P=>N(P)&&T.call(E,P),null,j),D)}e.filter=o;function c(z){return z}e.signal=c;function d(...z){return(N,D=null,T)=>{let E=E5(...z.map(j=>j(P=>N.call(D,P))));return g(E,T)}}e.any=d;function p(z,N,D,T){let E=D;return n(z,j=>(E=N(E,j),E),T)}e.reduce=p;function f(z,N){let D,T={onWillAddFirstListener(){D=z(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new Zt(T);return N?.add(E),E.event}function g(z,N){return N instanceof Array?N.push(z):N&&N.add(z),z}function v(z,N,D=100,T=!1,E=!1,j,P){let V,Q,B,Z=0,W,re={leakWarningThreshold:j,onWillAddFirstListener(){V=z(ve=>{Z++,Q=N(Q,ve),T&&!B&&(ie.fire(Q),Q=void 0),W=()=>{let xe=Q;Q=void 0,B=void 0,(!T||Z>1)&&ie.fire(xe),Z=0},typeof D=="number"?(clearTimeout(B),B=setTimeout(W,D)):B===void 0&&(B=0,queueMicrotask(W))})},onWillRemoveListener(){E&&Z>0&&W?.()},onDidRemoveLastListener(){W=void 0,V.dispose()}},ie=new Zt(re);return P?.add(ie),ie.event}e.debounce=v;function y(z,N=0,D){return e.debounce(z,(T,E)=>T?(T.push(E),T):[E],N,void 0,!0,void 0,D)}e.accumulate=y;function S(z,N=(T,E)=>T===E,D){let T=!0,E;return o(z,j=>{let P=T||!N(j,E);return T=!1,E=j,P},D)}e.latch=S;function w(z,N,D){return[e.filter(z,N,D),e.filter(z,T=>!N(T),D)]}e.split=w;function x(z,N=!1,D=[],T){let E=D.slice(),j=z(Q=>{E?E.push(Q):V.fire(Q)});T&&T.add(j);let P=()=>{E?.forEach(Q=>V.fire(Q)),E=null},V=new Zt({onWillAddFirstListener(){j||(j=z(Q=>V.fire(Q)),T&&T.add(j))},onDidAddFirstListener(){E&&(N?setTimeout(P):P())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(V),V.event}e.buffer=x;function k(z,N){return(D,T,E)=>{let j=N(new O);return z(function(P){let V=j.evaluate(P);V!==R&&D.call(T,V)},void 0,E)}}e.chain=k;let R=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:R),this}reduce(N,D){let T=D;return this.steps.push(E=>(T=N(T,E),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(E=>{let j=D||!N(E,T);return D=!1,T=E,j?E:R}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===R)break;return N}}function I(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.on(N,T),j=()=>z.removeListener(N,T),P=new Zt({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromNodeEventEmitter=I;function A(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.addEventListener(N,T),j=()=>z.removeEventListener(N,T),P=new Zt({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromDOMEventEmitter=A;function $(z){return new Promise(N=>i(z)(N))}e.toPromise=$;function L(z){let N=new Zt;return z.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=L;function H(z,N){return z(D=>N.fire(D))}e.forward=H;function U(z,N,D){return N(D),z(T=>N(T))}e.runAndSubscribe=U;class oe{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Zt(T),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function fe(z,N){return new oe(z,N).emitter.event}e.fromObservable=fe;function K(z){return(N,D,T)=>{let E=0,j=!1,P={beginUpdate(){E++},endUpdate(){E--,E===0&&(z.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};z.addObserver(P),z.reportChanges();let V={dispose(){z.removeObserver(P)}};return T instanceof Ml?T.add(V):Array.isArray(T)&&T.push(V),V}}e.fromObservableLight=K})($r||={});var Tv=class Av{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Av._idPool++}`,Av.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}}};Tv.all=new Set,Tv._idPool=0;var Uj=Tv,Wj=-1,z5=class $5{constructor(t,i,n=($5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)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=n*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new Kj(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,i=0;for(let[n,r]of this._stacks)(!t||i<r)&&(t=[n,r],i=r);return t}};z5._idPool=1;var Gj=z5,qj=class H5{constructor(t){this.value=t}static create(){let t=new Error;return new H5(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
+
`).slice(2).join(`
|
|
23
|
+
`))}},Kj=class extends Error{constructor(t,i){super(t),this.name="ListenerLeakError",this.stack=i}},Vj=class extends Error{constructor(t,i){super(t),this.name="ListenerRefusalError",this.stack=i}},Yj=0,t_=class{constructor(t){this.value=t,this.id=Yj++}},Xj=2,Zj,Zt=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new Gj(t?.onListenerError??Qg,this._options?.leakWarningThreshold??Wj):void 0,this._perfMon=this._options?._profName?new Uj(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,i,n)=>{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 Vj(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Qg)(f),Us.None}if(this._disposed)return Us.None;i&&(t=t.bind(i));let r=new t_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=qj.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof t_?(this._deliveryQueue??=new Jj,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=pn(()=>{o?.(),this._removeListener(r)});return n instanceof Ml?n.add(c):Array.isArray(n)&&n.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 i=this._listeners,n=i.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Xj<=i.length){let o=0;for(let c=0;c<i.length;c++)i[c]?i[o++]=i[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=o}}_deliver(t,i){if(!t)return;let n=this._options?.onListenerError||Qg;if(!n){t.value(i);return}try{t.value(i)}catch(r){n(r)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof t_)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Jj=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Px={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}},Xc=2,Zc,ka=class yl{constructor(t,i,n){this._document=t,this._config=i,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new Bx,this._cacheMapCombined=new Bx,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Cl,this._textureSize=512,this._onAddTextureAtlasCanvas=new Zt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Zt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=F5(t,this._config.deviceCellWidth*4+Xc*2,this._config.deviceCellHeight+Xc*2),this._tmpCtx=Ai(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 $j;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let n=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,n)}})}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(yl.maxAtlasPages&&this._pages.length>=Math.max(4,yl.maxAtlasPages)){let i=this._pages.filter(f=>f.canvas.width*2<=(yl.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),n=-1,r=0;for(let f=0;f<i.length;f++)if(i[f].canvas.width!==r)n=f,r=i[f].canvas.width;else if(f-n===3)break;let o=i.slice(n,n+4),c=o.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),d=this.pages.length-o.length,p=this._mergePages(o,d);p.version++;for(let f=c.length-1;f>=0;f--)this._deletePage(c[f]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new i_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let n=t[0].canvas.width*2,r=new i_(this._document,n,t);for(let[o,c]of t.entries()){let d=o*c.canvas.width%n,p=Math.floor(o/2)*c.canvas.height;r.ctx.drawImage(c.canvas,d,p);for(let g of c.glyphs)g.texturePage=i,g.sizeClipSpace.x=g.size.x/n,g.sizeClipSpace.y=g.size.y/n,g.texturePosition.x+=d,g.texturePosition.y+=p,g.texturePositionClipSpace.x=g.texturePosition.x/n,g.texturePositionClipSpace.y=g.texturePosition.y/n;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 i=t;i<this._pages.length;i++){let n=this._pages[i];for(let r of n.glyphs)r.texturePage--;n.version++}}getRasterizedGlyphCombinedChar(t,i,n,r,o,c){return this._getFromCacheMap(this._cacheMapCombined,t,i,n,r,o,c)}getRasterizedGlyph(t,i,n,r,o,c){return this._getFromCacheMap(this._cacheMap,t,i,n,r,o,c)}_getFromCacheMap(t,i,n,r,o,c,d){return Zc=t.get(i,n,r,o),Zc||(Zc=this._drawToCache(i,n,r,o,c,d),t.set(i,n,r,o,Zc)),Zc}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,n,r){if(this._config.allowTransparency)return Cs;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(i);break;case 50331648:let c=Cl.toColorRGB(i);o=xn.toColor(c[0],c[1],c[2]);break;default:n?o=vu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=vu.opaque(o)),o}_getForegroundColor(t,i,n,r,o,c,d,p,f,g){let v=this._getMinimumContrastColor(t,i,n,r,o,c,d,f,p,g);if(v)return v;let y;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&c<8&&(c+=8),y=this._getColorFromAnsiIndex(c);break;case 50331648:let S=Cl.toColorRGB(c);y=xn.toColor(S[0],S[1],S[2]);break;default:d?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=vu.opaque(y)),p&&(y=vu.multiplyOpacity(y,Rj)),y}_resolveBackgroundRgba(t,i,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,n,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,n,r,o,c,d,p,f,g){if(this._config.minimumContrastRatio===1||g)return;let v=this._getContrastCache(f),y=v.getColor(t,r);if(y!==void 0)return y||void 0;let S=this._resolveBackgroundRgba(i,n,d),w=this._resolveForegroundRgba(o,c,d,p),x=_o.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!x){v.setColor(t,r,null);return}let k=xn.toColor(x>>24&255,x>>16&255,x>>8&255);return v.setColor(t,r,k),k}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,n,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)+Xc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+Xc*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return Px;let g=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),O=this._workAttributeData.getFgColorMode(),I=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(v){let Q=R;R=I,I=Q;let B=O;O=A,A=B}let $=this._getBackgroundColor(A,I,v,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=$.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=g?this._config.fontWeightBold:this._config.fontWeight,H=S?"italic":"";this._tmpCtx.font=`${H} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=L5;let U=d.length===1&&Eb(d.charCodeAt(0)),oe=d.length===1&&Sj(d.charCodeAt(0)),fe=this._getForegroundColor(i,A,I,n,O,R,v,y,g,N5(d.charCodeAt(0)));this._tmpCtx.fillStyle=fe.css;let K=oe?0:Xc*2,z=!1;this._config.customGlyphs!==!1&&(z=Oj(this._tmpCtx,d,K,K,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N=!U,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let Q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=Q%2===1?.5:0;if(this._tmpCtx.lineWidth=Q,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())N=!1,this._tmpCtx.strokeStyle=`rgb(${Cl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{N=!1;let xe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&xe<8&&(xe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(xe).css}this._tmpCtx.beginPath();let Z=K,W=Math.ceil(K+this._config.deviceCharHeight)-B-(o?Q*2:0),re=W+Q,ie=W+Q*2,ve=this._workAttributeData.getUnderlineVariantOffset();for(let xe=0;xe<D;xe++){this._tmpCtx.save();let Te=Z+xe*this._config.deviceCellWidth,Ie=Z+(xe+1)*this._config.deviceCellWidth,_t=Te+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Te,W),this._tmpCtx.lineTo(Ie,W),this._tmpCtx.moveTo(Te,ie),this._tmpCtx.lineTo(Ie,ie);break;case 3:let qe=Q<=1?ie:Math.ceil(K+this._config.deviceCharHeight-Q/2)-B,Re=Q<=1?W:Math.ceil(K+this._config.deviceCharHeight+Q/2)-B,Se=new Path2D;Se.rect(Te,W,this._config.deviceCellWidth,ie-W),this._tmpCtx.clip(Se),this._tmpCtx.moveTo(Te-this._config.deviceCellWidth/2,re),this._tmpCtx.bezierCurveTo(Te-this._config.deviceCellWidth/2,Re,Te,Re,Te,re),this._tmpCtx.bezierCurveTo(Te,qe,_t,qe,_t,re),this._tmpCtx.bezierCurveTo(_t,Re,Ie,Re,Ie,re),this._tmpCtx.bezierCurveTo(Ie,qe,Ie+this._config.deviceCellWidth/2,qe,Ie+this._config.deviceCellWidth/2,re);break;case 4:let Ue=ve===0?0:ve>=Q?Q*2-ve:Q-ve;ve>=Q||Ue===0?(this._tmpCtx.setLineDash([Math.round(Q),Math.round(Q)]),this._tmpCtx.moveTo(Te+Ue,W),this._tmpCtx.lineTo(Ie,W)):(this._tmpCtx.setLineDash([Math.round(Q),Math.round(Q)]),this._tmpCtx.moveTo(Te,W),this._tmpCtx.lineTo(Te+Ue,W),this._tmpCtx.moveTo(Te+Ue+Q,W),this._tmpCtx.lineTo(Ie,W)),ve=Tj(Ie-Te,Q,ve);break;case 5:let Ye=.6,pt=.3,nt=Ie-Te,ge=Math.floor(Ye*nt),Le=Math.floor(pt*nt),Gt=nt-ge-Le;this._tmpCtx.setLineDash([ge,Le,Gt]),this._tmpCtx.moveTo(Te,W),this._tmpCtx.lineTo(Ie,W);break;default:this._tmpCtx.moveTo(Te,W),this._tmpCtx.lineTo(Ie,W);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!z&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let xe=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in xe&&xe.actualBoundingBoxDescent>0){this._tmpCtx.save();let Te=new Path2D;Te.rect(Z,W-Math.ceil(Q/2),this._config.deviceCellWidth*D,ie-W+Math.ceil(Q/2)),this._tmpCtx.clip(Te),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=$.css,this._tmpCtx.strokeText(d,K,K+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let Q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=Q%2===1?.5:0;this._tmpCtx.lineWidth=Q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+B),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*D,K+B),this._tmpCtx.stroke()}if(z||this._tmpCtx.fillText(d,K,K+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let Q=n_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),$,fe,N);if(Q)for(let B=1;B<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=$.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,K,K+this._config.deviceCharHeight-B),Q=n_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),$,fe,N),!!Q);B++);}if(x){let Q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),B=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*D,K+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.stroke()}this._tmpCtx.restore();let T=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),E;if(this._config.allowTransparency?E=Qj(T):E=n_(T,$,fe,N),E)return Px;let j=this._findGlyphBoundingBox(T,this._workBoundingBox,p,oe,z,K),P,V;for(;;){if(this._activePages.length===0){let Q=this._createNewPage();P=Q,V=Q.currentRow,V.height=j.size.y;break}P=this._activePages[this._activePages.length-1],V=P.currentRow;for(let Q of this._activePages)j.size.y<=Q.currentRow.height&&(P=Q,V=Q.currentRow);for(let Q=this._activePages.length-1;Q>=0;Q--)for(let B of this._activePages[Q].fixedRows)B.height<=V.height&&j.size.y<=B.height&&(P=this._activePages[Q],V=B);if(j.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new i_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),P=this._overflowSizePage,V=this._overflowSizePage.currentRow,V.x+j.size.x>=P.canvas.width&&(V.x=0,V.y+=V.height,V.height=0);break}if(V.y+j.size.y>=P.canvas.height||V.height>j.size.y+2){let Q=!1;if(P.currentRow.y+P.currentRow.height+j.size.y>=P.canvas.height){let B;for(let Z of this._activePages)if(Z.currentRow.y+Z.currentRow.height+j.size.y<Z.canvas.height){B=Z;break}if(B)P=B;else if(yl.maxAtlasPages&&this._pages.length>=yl.maxAtlasPages&&V.y+j.size.y<=P.canvas.height&&V.height>=j.size.y&&V.x+j.size.x<=P.canvas.width)Q=!0;else{let Z=this._createNewPage();P=Z,V=Z.currentRow,V.height=j.size.y,Q=!0}}Q||(P.currentRow.height>0&&P.fixedRows.push(P.currentRow),V={x:0,y:P.currentRow.y+P.currentRow.height,height:j.size.y},P.fixedRows.push(V),P.currentRow={x:0,y:V.y+V.height,height:0})}if(V.x+j.size.x<=P.canvas.width)break;V===P.currentRow?(V.x=0,V.y+=V.height,V.height=0):P.fixedRows.splice(P.fixedRows.indexOf(V),1)}return j.texturePage=this._pages.indexOf(P),j.texturePosition.x=V.x,j.texturePosition.y=V.y,j.texturePositionClipSpace.x=V.x/P.canvas.width,j.texturePositionClipSpace.y=V.y/P.canvas.height,j.sizeClipSpace.x/=P.canvas.width,j.sizeClipSpace.y/=P.canvas.height,V.height=Math.max(V.height,j.size.y),V.x+=j.size.x,P.ctx.putImageData(T,j.texturePosition.x-this._workBoundingBox.left,j.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,j.size.x,j.size.y),P.addGlyph(j),P.version++,j}_findGlyphBoundingBox(t,i,n,r,o,c){i.top=0;let d=r?this._config.deviceCellHeight:this._tmpCanvas.height,p=r?this._config.deviceCellWidth:n,f=!1;for(let g=0;g<d;g++){for(let v=0;v<p;v++){let y=g*this._tmpCanvas.width*4+v*4+3;if(t.data[y]!==0){i.top=g,f=!0;break}}if(f)break}i.left=0,f=!1;for(let g=0;g<c+p;g++){for(let v=0;v<d;v++){let y=v*this._tmpCanvas.width*4+g*4+3;if(t.data[y]!==0){i.left=g,f=!0;break}}if(f)break}i.right=p,f=!1;for(let g=c+p-1;g>=c;g--){for(let v=0;v<d;v++){let y=v*this._tmpCanvas.width*4+g*4+3;if(t.data[y]!==0){i.right=g,f=!0;break}}if(f)break}i.bottom=d,f=!1;for(let g=d-1;g>=0;g--){for(let v=0;v<p;v++){let y=g*this._tmpCanvas.width*4+v*4+3;if(t.data[y]!==0){i.bottom=g,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+c+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+c+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},i_=class{constructor(t,i,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let r of n)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=F5(t,i,i),this.ctx=Ai(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 n_(e,t,i,n){let r=t.rgba>>>24,o=t.rgba>>>16&255,c=t.rgba>>>8&255,d=i.rgba>>>24,p=i.rgba>>>16&255,f=i.rgba>>>8&255,g=Math.floor((Math.abs(r-d)+Math.abs(o-p)+Math.abs(c-f))/12),v=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===r&&e.data[y+1]===o&&e.data[y+2]===c||n&&Math.abs(e.data[y]-r)+Math.abs(e.data[y+1]-o)+Math.abs(e.data[y+2]-c)<g?e.data[y+3]=0:v=!1;return v}function Qj(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function F5(e,t,i){let n=e.createElement("canvas");return n.width=t,n.height=i,n}function e8(e,t,i,n,r,o,c,d){let p={foreground:o.foreground,background:o.background,cursor:Cs,cursorAccent:Cs,selectionForeground:Cs,selectionBackgroundTransparent:Cs,selectionBackgroundOpaque:Cs,selectionInactiveBackgroundTransparent:Cs,selectionInactiveBackgroundOpaque:Cs,overviewRulerBorder:Cs,scrollbarSliderBackground:Cs,scrollbarSliderHoverBackground:Cs,scrollbarSliderActiveBackground:Cs,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:i,deviceCharHeight:n,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:p}}function zx(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function t8(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Rs=[];function U5(e,t,i,n,r,o,c,d,p){let f=e8(n,r,o,c,t,i,d,p);for(let y=0;y<Rs.length;y++){let S=Rs[y],w=S.ownedBy.indexOf(e);if(w>=0){if(zx(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Rs.splice(y,1)):S.ownedBy.splice(w,1);break}}for(let y=0;y<Rs.length;y++){let S=Rs[y];if(zx(S.config,f))return S.ownedBy.push(e),S.atlas}let g=e._core,v={atlas:new ka(document,f,g.unicodeService),config:f,ownedBy:[e]};return Rs.push(v),v.atlas}function $x(e){for(let t=0;t<Rs.length;t++){let i=Rs[t].ownedBy.indexOf(e);if(i!==-1){Rs[t].ownedBy.length===1?(Rs[t].atlas.dispose(),Rs.splice(t,1)):Rs[t].ownedBy.splice(i,1);break}}}var Od=600,i8=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=Od){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Od-(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=Od-(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})},Od)},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 Hx(e,t,i){let n=new t.ResizeObserver(r=>{let o=r.find(p=>p.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){n?.disconnect(),n=void 0;return}let c=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&i(c,d)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return pn(()=>n?.disconnect())}function n8(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Fx=class W5 extends Cl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new I5,this.combinedData=""}static fromCharData(t){let i=new W5;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?n8(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},G5=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function q5(e,t,i){let n=Ai(e.createProgram());if(e.attachShader(n,Ai(Ux(e,e.VERTEX_SHADER,t))),e.attachShader(n,Ai(Ux(e,e.FRAGMENT_SHADER,i))),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS))return n;console.error(e.getProgramInfoLog(n)),e.deleteProgram(n)}function Ux(e,t,i){let n=Ai(e.createShader(t));if(e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))return n;console.error(e.getShaderInfoLog(n)),e.deleteShader(n)}function s8(e,t){let i=Math.min(e.length*2,t),n=new Float32Array(i);for(let r=0;r<e.length;r++)n[r]=e[r];return n}var r8=class{constructor(t){this.texture=t,this.version=-1}},a8=`#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 o8(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
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 Ea=11,ul=Ea*Float32Array.BYTES_PER_ELEMENT,l8=2,hi=0,Yt,s_=0,Jc=0,c8=class extends Us{constructor(t,i,n,r){super(),this._terminal=t,this._gl=i,this._dimensions=n,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;ka.maxAtlasPages===void 0&&(ka.maxAtlasPages=Math.min(32,Ai(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ka.maxTextureSize=Ai(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Ai(q5(o,a8,o8(ka.maxAtlasPages))),this._register(pn(()=>o.deleteProgram(this._program))),this._projectionLocation=Ai(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ai(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ai(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(pn(()=>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(pn(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=Ai(o.createBuffer()),this._register(pn(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,ul,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,ul,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,ul,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,ul,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,ul,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,ul,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let g=new Int32Array(ka.maxAtlasPages);for(let v=0;v<ka.maxAtlasPages;v++)g[v]=v;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,G5),this._atlasTextures=[];for(let v=0;v<ka.maxAtlasPages;v++){let y=new r8(Ai(o.createTexture()));this._register(pn(()=>o.deleteTexture(y.texture))),o.activeTexture(o.TEXTURE0+v),o.bindTexture(o.TEXTURE_2D,y.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[v]=y}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,i,n,r,o,c,d,p,f){this._updateCell(this._vertices.attributes,t,i,n,r,o,c,d,p,f)}_updateCell(t,i,n,r,o,c,d,p,f,g){if(hi=(n*this._terminal.cols+i)*Ea,r===0||r===void 0){t.fill(0,hi,hi+Ea-1-l8);return}this._atlas&&(p&&p.length>1?Yt=this._atlas.getRasterizedGlyphCombinedChar(p,o,c,d,!1,this._terminal.element):Yt=this._atlas.getRasterizedGlyph(r,o,c,d,!1,this._terminal.element),s_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&Yt.offset.x>s_?(Jc=Yt.offset.x-s_,t[hi]=-(Yt.offset.x-Jc)+this._dimensions.device.char.left,t[hi+1]=-Yt.offset.y+this._dimensions.device.char.top,t[hi+2]=(Yt.size.x-Jc)/this._dimensions.device.canvas.width,t[hi+3]=Yt.size.y/this._dimensions.device.canvas.height,t[hi+4]=Yt.texturePage,t[hi+5]=Yt.texturePositionClipSpace.x+Jc/this._atlas.pages[Yt.texturePage].canvas.width,t[hi+6]=Yt.texturePositionClipSpace.y,t[hi+7]=Yt.sizeClipSpace.x-Jc/this._atlas.pages[Yt.texturePage].canvas.width,t[hi+8]=Yt.sizeClipSpace.y):(t[hi]=-Yt.offset.x+this._dimensions.device.char.left,t[hi+1]=-Yt.offset.y+this._dimensions.device.char.top,t[hi+2]=Yt.size.x/this._dimensions.device.canvas.width,t[hi+3]=Yt.size.y/this._dimensions.device.canvas.height,t[hi+4]=Yt.texturePage,t[hi+5]=Yt.texturePositionClipSpace.x,t[hi+6]=Yt.texturePositionClipSpace.y,t[hi+7]=Yt.sizeClipSpace.x,t[hi+8]=Yt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&kj(r,f,Yt.size.x,this._dimensions.device.cell.width)&&(t[hi+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,i=t.cols*t.rows*Ea;this._vertices.count!==i?this._vertices.attributes=new Float32Array(i):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==i?this._vertices.attributesBuffers[n]=new Float32Array(i):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=i,n=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[n+9]=o/t.cols,this._vertices.attributes[n+10]=r/t.rows,n+=Ea}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 i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let c=o*this._terminal.cols*Ea,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*Ea);n.set(d,r),r+=d.length}i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,n.subarray(0,r),i.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(i,this._atlas,o);i.drawElementsInstanced(i.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,r/Ea)}setAtlas(t){this._atlas=t;for(let i of this._atlasTextures)i.version=-1}_bindAtlasPageTexture(t,i,n){t.activeTexture(t.TEXTURE0+n),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[n].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,i.pages[n].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[n].version=i.pages[n].version}setDimensions(t){this._dimensions=t}},u8=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,i,n,r=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let o=t.buffers.active.ydisp,c=i[1]-o,d=n[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=i[0],this.endCol=n[0]}isCellSelected(t,i,n){return this.hasSelection?(n-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol):!1}};function h8(){return new u8}var Pf=4,hf=1,df=2,r_=3,d8=2147483648,f8=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=h8()}resize(t,i){let n=t*i*Pf;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(i))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},p8=`#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
|
+
}`,m8=`#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
|
+
}`,Pr=8,a_=Pr*Float32Array.BYTES_PER_ELEMENT,g8=20*Pr,Wx=class{constructor(){this.attributes=new Float32Array(g8),this.count=0}},Dr=0,Gx=0,qx=0,Kx=0,Vx=0,Yx=0,Xx=0,_8=class extends Us{constructor(e,t,i,n){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=n,this._vertices=new Wx,this._verticesCursor=new Wx;let r=this._gl;this._program=Ai(q5(r,p8,m8)),this._register(pn(()=>r.deleteProgram(this._program))),this._projectionLocation=Ai(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(pn(()=>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(pn(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=Ai(r.createBuffer()),this._register(pn(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,a_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,a_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,a_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(n.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,G5),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,n=1,r,o,c,d,p,f,g,v,y,S,w;for(r=0;r<t.rows;r++){for(c=-1,d=0,p=0,f=!1,o=0;o<t.cols;o++)g=(r*t.cols+o)*Pf,v=e.cells[g+hf],y=e.cells[g+df],S=!!(y&67108864),(v!==d||y!==p&&(f||S))&&((d!==0||f&&p!==0)&&(w=n++*Pr,this._updateRectangle(i,w,p,d,c,o,r)),c=o,d=v,p=y,f=S);(d!==0||f&&p!==0)&&(w=n++*Pr,this._updateRectangle(i,w,p,d,c,t.cols,r))}i.count=n}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let n,r=0;(i.style==="bar"||i.style==="outline")&&(n=r++*Pr,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(n=r++*Pr,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(n=r++*Pr,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),n=r++*Pr,this._addRectangleFloat(t.attributes,n,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,n,r,o,c){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Dr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Dr=(i&16777215)<<8;break;default:Dr=this._themeService.colors.foreground.rgba}else switch(n&50331648){case 16777216:case 33554432:Dr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Dr=(n&16777215)<<8;break;default:Dr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=s8(e.attributes,this._terminal.rows*this._terminal.cols*Pr)),Gx=r*this._dimensions.device.cell.width,qx=c*this._dimensions.device.cell.height,Kx=(Dr>>24&255)/255,Vx=(Dr>>16&255)/255,Yx=(Dr>>8&255)/255,Xx=1,this._addRectangle(e.attributes,t,Gx,qx,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Kx,Vx,Yx,Xx)}_addRectangle(e,t,i,n,r,o,c,d,p,f){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/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,i,n,r,o,c){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/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])}},v8=class extends Us{constructor(t,i,n,r,o,c,d,p){super(),this._container=i,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-${n}-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(pn(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ai(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,i,n){}handleSelectionChanged(t,i,n,r=!1){}_setTransparency(t,i){if(i===this._alpha)return;let n=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=U5(t,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,i,n=1){this._ctx.fillRect(t*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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,i,n,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,i,n,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=L5,this._clipCell(n,r,i.getWidth()),this._ctx.fillText(i.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,i,n){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,i,n){let r=i?t.options.fontWeightBold:t.options.fontWeight;return`${n?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},y8=class extends v8{constructor(t,i,n,r,o,c,d){super(n,t,"link",i,!0,o,c,d),this._register(r.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(r.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,i){super.resize(t,i),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&&t8(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 i=t.y1+1;i<t.y2;i++)this._fillBottomLineAtCells(0,i,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},ho=typeof window=="object"?window:globalThis,Rv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Zt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Zt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Rv.INSTANCE=new Rv;var K5=Rv;function b8(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}K5.INSTANCE.onDidChangeZoomLevel;K5.INSTANCE.onDidChangeFullscreen;var Yl=typeof navigator=="object"?navigator.userAgent:"";Yl.indexOf("Firefox")>=0;Yl.indexOf("AppleWebKit")>=0;var S8=Yl.indexOf("Chrome")>=0;!S8&&Yl.indexOf("Safari")>=0;Yl.indexOf("Electron/")>=0;Yl.indexOf("Android")>=0;var o_=!1;if(typeof ho.matchMedia=="function"){let e=ho.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ho.matchMedia("(display-mode: fullscreen)");o_=e.matches,b8(ho,e,({matches:i})=>{o_&&t.matches||(o_=i)})}var kl="en",l_=!1,V5=!1,Dd,ff=kl,Zx=kl,w8,Ir,vo=globalThis,rs;typeof vo.vscode<"u"&&typeof vo.vscode.process<"u"?rs=vo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(rs=process);var x8=typeof rs?.versions?.electron=="string",C8=x8&&rs?.type==="renderer";if(typeof rs=="object"){rs.platform,rs.platform,l_=rs.platform==="linux",l_&&rs.env.SNAP&&rs.env.SNAP_REVISION,rs.env.CI||rs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Dd=kl,ff=kl;let e=rs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Dd=t.userLocale,Zx=t.osLocale,ff=t.resolvedLanguage||kl,w8=t.languagePack?.translationsConfigFile}catch{}V5=!0}else typeof navigator=="object"&&!C8?(Ir=navigator.userAgent,Ir.indexOf("Windows")>=0,Ir.indexOf("Macintosh")>=0,(Ir.indexOf("Macintosh")>=0||Ir.indexOf("iPad")>=0||Ir.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,l_=Ir.indexOf("Linux")>=0,Ir?.indexOf("Mobi")>=0,ff=globalThis._VSCODE_NLS_LANGUAGE||kl,Dd=navigator.language.toLowerCase(),Zx=Dd):console.error("Unable to resolve platform.");var Jx=V5,lr=Ir,ya=ff,k8;(e=>{function t(){return ya}e.value=t;function i(){return ya.length===2?ya==="en":ya.length>=3?ya[0]==="e"&&ya[1]==="n"&&ya[2]==="-":!1}e.isDefaultVariant=i;function n(){return ya==="en"}e.isDefault=n})(k8||={});var E8=typeof vo.postMessage=="function"&&!vo.importScripts;(()=>{if(E8){let e=[];vo.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let o=e[n];if(o.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),o.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),vo.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var T8=!!(lr&&lr.indexOf("Chrome")>=0);lr&&lr.indexOf("Firefox")>=0;!T8&&lr&&lr.indexOf("Safari")>=0;lr&&lr.indexOf("Edg/")>=0;lr&&lr.indexOf("Android")>=0;var hl=typeof navigator=="object"?navigator:{};Jx||document.queryCommandSupported&&document.queryCommandSupported("copy")||hl&&hl.clipboard&&hl.clipboard.writeText,Jx||hl&&hl.clipboard&&hl.clipboard.readText;var Tb=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}},c_=new Tb,Qx=new Tb,eC=new Tb;new Array(230);var A8;(e=>{function t(d){return c_.keyCodeToStr(d)}e.toString=t;function i(d){return c_.strToKeyCode(d)}e.fromString=i;function n(d){return Qx.keyCodeToStr(d)}e.toUserSettingsUS=n;function r(d){return eC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return Qx.strToKeyCode(d)||eC.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 c_.keyCodeToStr(d)}e.toElectronAccelerator=c})(A8||={});var Y5=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),R8;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof N8?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$r.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Y5})})(R8||={});var N8=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?Y5:(this._emitter||(this._emitter=new Zt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},L8;(e=>{async function t(n){let r,o=await Promise.all(n.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function i(n){return new Promise(async(r,o)=>{try{await n(r,o)}catch(c){o(c)}})}e.withAsyncBody=i})(L8||={});var tC=class ks{static fromArray(t){return new ks(i=>{i.emitMany(t)})}static fromPromise(t){return new ks(async i=>{i.emitMany(await t)})}static fromPromises(t){return new ks(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new ks(async i=>{await Promise.all(t.map(async n=>{for await(let r of n)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Zt,queueMicrotask(async()=>{let n={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(n)),this.resolve()}catch(r){this.reject(r)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 $r.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new ks(async n=>{for await(let r of t)n.emitOne(i(r))})}map(t){return ks.map(this,t)}static filter(t,i){return new ks(async n=>{for await(let r of t)i(r)&&n.emitOne(r)})}filter(t){return ks.filter(this,t)}static coalesce(t){return ks.filter(t,i=>!!i)}coalesce(){return ks.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return ks.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())}};tC.EMPTY=tC.fromArray([]);var{getWindow:M8}=(function(){let e=new Map,t={window:ho,disposables:new Ml};e.set(ho.vscodeWindowId,t);let i=new Zt,n=new Zt,r=new Zt;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:n.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Us.None;let d=new Ml,p={window:c,disposables:d.add(new Ml)};return e.set(c.vscodeWindowId,p),d.add(pn(()=>{e.delete(c.vscodeWindowId),n.fire(c)})),d.add(Nv(c,D8.BEFORE_UNLOAD,()=>{r.fire(c)})),i.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:ho},getDocument(c){return M8(c).document}}})(),O8=class{constructor(t,i,n,r){this._node=t,this._type=i,this._handler=n,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 Nv(e,t,i,n){return new O8(e,t,i,n)}var D8={BEFORE_UNLOAD:"beforeunload"},j8=class extends Us{constructor(t,i,n,r,o,c,d,p,f){super(),this._terminal=t,this._characterJoinerService=i,this._charSizeService=n,this._coreBrowserService=r,this._coreService=o,this._decorationService=c,this._optionsService=d,this._themeService=p,this._cursorBlinkStateManager=new Yc,this._charAtlasDisposable=this._register(new Yc),this._observerDisposable=this._register(new Yc),this._model=new f8,this._workCell=new Fx,this._workCell2=new Fx,this._rectangleRenderer=this._register(new Yc),this._glyphRenderer=this._register(new Yc),this._onChangeTextureAtlas=this._register(new Zt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Zt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Zt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Zt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Zt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Aj(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new y8(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=Ej(),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(Nv(this._canvas,"webglcontextlost",v=>{console.log("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(Nv(this._canvas,"webglcontextrestored",v=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,$x(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Hx(this._canvas,this._coreBrowserService.window,(v,y)=>this._setCanvasDevicePixelDimensions(v,y)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=Hx(this._canvas,v,(y,S)=>this._setCanvasDevicePixelDimensions(y,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(pn(()=>{for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),$x(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,i){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let n of this._renderLayers)n.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,i,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,i,n);this._model.selection.update(this._core,t,i,n),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 _8(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new c8(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=U5(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=E5($r.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),$r.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,i){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 n of this._renderLayers)n.handleGridChanged(this._terminal,t,i);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,i),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 i8(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,i){let n=this._core,r=this._workCell,o,c,d,p,f,g,v=0,y=!0,S,w,x,k,R,O,I,A,$;t=iC(t,n.rows-1,0),i=iC(i,n.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,U=H-n.buffer.ydisp,oe=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),fe=-1,K=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let z=!1;for(c=t;c<=i;c++)for(d=c+n.buffer.ydisp,p=n.buffer.lines.get(d),this._model.lineLengths[c]=0,x=H===d,v=0,f=this._characterJoinerService.getJoinedCharacters(d),A=0;A<n.cols;A++){if(o=this._cellColorResolver.result.bg,p.loadCell(A,r),A===0&&(o=this._cellColorResolver.result.bg),g=!1,y=A>=v,S=A,f.length>0&&A===f[0][0]&&y){w=f.shift();let N=this._model.selection.isCellSelected(this._terminal,w[0],d);for(I=w[0]+1;I<w[1];I++)y&&=N===this._model.selection.isCellSelected(this._terminal,I,d);y&&=!x||oe<w[0]||oe>=w[1],y?(g=!0,r=new I8(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):v=w[1]}if(k=r.getChars(),R=r.getCode(),I=(c*n.cols+A)*Pf,this._cellColorResolver.resolve(r,A,d,this.dimensions.device.cell.width),K&&d===H&&(A===oe&&(this._model.cursor={x:oe,y:U,width:r.getWidth(),style:this._coreBrowserService.isFocused?L:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},fe=oe+r.getWidth()-1),A>=oe&&A<=fe&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&n.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)),R!==0&&(this._model.lineLengths[c]=A+1),!(this._model.cells[I]===R&&this._model.cells[I+hf]===this._cellColorResolver.result.bg&&this._model.cells[I+df]===this._cellColorResolver.result.fg&&this._model.cells[I+r_]===this._cellColorResolver.result.ext)&&(z=!0,k.length>1&&(R|=d8),this._model.cells[I]=R,this._model.cells[I+hf]=this._cellColorResolver.result.bg,this._model.cells[I+df]=this._cellColorResolver.result.fg,this._model.cells[I+r_]=this._cellColorResolver.result.ext,O=r.getWidth(),this._glyphRenderer.value.updateCell(A,c,R,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,O,o),g)){for(r=this._workCell,A++;A<=S;A++)$=(c*n.cols+A)*Pf,this._glyphRenderer.value.updateCell(A,c,0,0,0,0,yj,0,0),this._model.cells[$]=0,this._model.cells[$+hf]=this._cellColorResolver.result.bg,this._model.cells[$+df]=this._cellColorResolver.result.fg,this._model.cells[$+r_]=this._cellColorResolver.result.ext;A--}}z&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,i){this._canvas.width===t&&this._canvas.height===i||(this._canvas.width=t,this._canvas.height=i,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})}},I8=class extends Cl{constructor(t,i,n){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=n}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 iC(e,t,i=0){return Math.max(Math.min(e,t),i)}var nC="di$target",sC="di$dependencies",u_=new Map;function hr(e){if(u_.has(e))return u_.get(e);let t=function(i,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");B8(t,i,r)};return t._id=e,u_.set(e,t),t}function B8(e,t,i){t[nC]===t?t[sC].push({id:e,index:i}):(t[sC]=[{id:e,index:i}],t[nC]=t)}hr("BufferService");hr("CoreMouseService");hr("CoreService");hr("CharsetService");hr("InstantiationService");hr("LogService");var P8=hr("OptionsService");hr("OscLinkService");hr("UnicodeService");hr("DecorationService");var z8={trace:0,debug:1,info:2,warn:3,error:4,off:5},$8="xterm.js: ",rC=class extends Us{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=z8[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let i=0;i<t.length;i++)typeof t[i]=="function"&&(t[i]=t[i]())}_log(t,i,n){this._evalLazyOptionalParams(n),t.call(console,(this._optionsService.options.logger?"":$8)+i,...n)}trace(t,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,i)}debug(t,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,i)}info(t,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,i)}warn(t,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,i)}error(t,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,i)}};rC=oj([lj(0,P8)],rC);var H8=class extends Us{constructor(t){if(R5&&vj()<16){let i={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",i))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new Zt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Zt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Zt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Zt),this.onContextLoss=this._onContextLoss.event}activate(t){let i=t._core;if(!t.element){this._register(i.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let n=i.coreService,r=i.optionsService,o=i,c=o._renderService,d=o._characterJoinerService,p=o._charSizeService,f=o._coreBrowserService,g=o._decorationService;o._logService;let v=o._themeService;this._renderer=this._register(new j8(t,d,p,f,n,g,r,v,this._preserveDrawingBuffer)),this._register($r.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register($r.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register($r.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register($r.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(pn(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var X5=Object.defineProperty,F8=Object.getOwnPropertyDescriptor,U8=(e,t)=>{for(var i in t)X5(e,i,{get:t[i],enumerable:!0})},gi=(e,t,i,n)=>{for(var r=n>1?void 0:n?F8(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=(n?c(t,i,r):c(r))||r);return n&&r&&X5(t,i,r),r},Ee=(e,t)=>(i,n)=>t(i,n,e),aC="Terminal input",Lv={get:()=>aC,set:e=>aC=e},oC="Too much output to announce, navigate to rows manually to read",Mv={get:()=>oC,set:e=>oC=e};function W8(e){return e.replace(/\r?\n/g,"\r")}function G8(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function q8(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function K8(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Z5(r,t,i,n)}}function Z5(e,t,i,n){e=W8(e),e=G8(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function J5(e,t,i){let n=i.getBoundingClientRect(),r=e.clientX-n.left-10,o=e.clientY-n.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 lC(e,t,i,n,r){J5(e,t,i),r&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Aa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _p(e,t=0,i=e.length){let n="";for(let r=t;r<i;++r){let o=e[r];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var V8=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[n++]=(this._interim-55296)*1024+o-56320+65536:(t[n++]=this._interim,t[n++]=o),this._interim=0}for(let o=r;o<i;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=i)return this._interim=c,n;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[n++]=(c-55296)*1024+d-56320+65536:(t[n++]=c,t[n++]=d);continue}c!==65279&&(t[n++]=c)}return n}},Y8=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r,o,c,d,p=0,f=0;if(this.interim[0]){let y=!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,R=k-w;for(;f<R;){if(f>=i)return 0;if(x=e[f++],(x&192)!==128){f--,y=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}y||(k===2?S<128?f--:t[n++]=S:k===3?S<2048||S>=55296&&S<=57343||S===65279||(t[n++]=S):S<65536||S>1114111||(t[n++]=S)),this.interim.fill(0)}let g=i-4,v=f;for(;v<i;){for(;v<g&&!((r=e[v])&128)&&!((o=e[v+1])&128)&&!((c=e[v+2])&128)&&!((d=e[v+3])&128);)t[n++]=r,t[n++]=o,t[n++]=c,t[n++]=d,v+=4;if(r=e[v++],r<128)t[n++]=r;else if((r&224)===192){if(v>=i)return this.interim[0]=r,n;if(o=e[v++],(o&192)!==128){v--;continue}if(p=(r&31)<<6|o&63,p<128){v--;continue}t[n++]=p}else if((r&240)===224){if(v>=i)return this.interim[0]=r,n;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=i)return this.interim[0]=r,this.interim[1]=o,n;if(c=e[v++],(c&192)!==128){v--;continue}if(p=(r&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[n++]=p}else if((r&248)===240){if(v>=i)return this.interim[0]=r,n;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=i)return this.interim[0]=r,this.interim[1]=o,n;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=i)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=c,n;if(d=e[v++],(d&192)!==128){v--;continue}if(p=(r&7)<<18|(o&63)<<12|(c&63)<<6|d&63,p<65536||p>1114111)continue;t[n++]=p}}return n}},Q5="",La=" ",hh=class eT{constructor(){this.fg=0,this.bg=0,this.extended=new zf}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 eT;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}},zf=class tT{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new tT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ns=class iT extends hh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zf,this.combinedData=""}static fromCharData(t){let i=new iT;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Aa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cC="di$target",Ov="di$dependencies",h_=new Map;function X8(e){return e[Ov]||[]}function Yi(e){if(h_.has(e))return h_.get(e);let t=function(i,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Z8(t,i,r)};return t._id=e,h_.set(e,t),t}function Z8(e,t,i){t[cC]===t?t[Ov].push({id:e,index:i}):(t[Ov]=[{id:e,index:i}],t[cC]=t)}var En=Yi("BufferService"),nT=Yi("CoreMouseService"),Ao=Yi("CoreService"),J8=Yi("CharsetService"),Ab=Yi("InstantiationService"),sT=Yi("LogService"),Tn=Yi("OptionsService"),rT=Yi("OscLinkService"),Q8=Yi("UnicodeService"),dh=Yi("DecorationService"),Dv=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],r=this._optionsService.rawOptions.linkHandler,o=new Ns,c=i.getTrimmedLength(),d=-1,p=-1,f=!1;for(let g=0;g<c;g++)if(!(p===-1&&!i.hasContent(g))){if(i.loadCell(g,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=g,d=o.extended.urlId;continue}else f=o.extended.urlId!==d;else p!==-1&&(f=!0);if(f||p!==-1&&g===c-1){let v=this._oscLinkService.getLinkData(d)?.uri;if(v){let y={start:{x:p+1,y:e},end:{x:g+(!f&&g===c-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(v);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||n.push({text:v,range:y,activate:(w,x)=>r?r.activate(w,x,y):e7(w,x),hover:(w,x)=>r?.hover?.(w,x,y),leave:(w,x)=>r?.leave?.(w,x,y)})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=g,d=o.extended.urlId):(p=-1,d=-1)}}t(n)}};Dv=gi([Ee(0,En),Ee(1,Tn),Ee(2,rT)],Dv);function e7(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
81
|
+
|
|
82
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var vp=Yi("CharSizeService"),Gr=Yi("CoreBrowserService"),Rb=Yi("MouseService"),qr=Yi("RenderService"),t7=Yi("SelectionService"),aT=Yi("CharacterJoinerService"),Xl=Yi("ThemeService"),oT=Yi("LinkProviderService"),i7=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?uC.isErrorNoTelemetry(e)?new uC(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)}},n7=new i7;function pf(e){s7(e)||n7.onUnexpectedError(e)}var jv="Canceled";function s7(e){return e instanceof r7?!0:e instanceof Error&&e.name===jv&&e.message===jv}var r7=class extends Error{constructor(){super(jv),this.name=this.message}};function a7(e){return new Error(`Illegal argument: ${e}`)}var uC=class Iv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Iv)return t;let i=new Iv;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Bv=class lT extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,lT.prototype)}};function ns(e,t=0){return e[e.length-(1+t)]}var o7;(e=>{function t(o){return o<0}e.isLessThan=t;function i(o){return o<=0}e.isLessThanOrEqual=i;function n(o){return o>0}e.isGreaterThan=n;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(o7||={});function l7(e,t){let i=this,n=!1,r;return function(){return n||(n=!0,t||(r=e.apply(i,arguments))),r}}var cT;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function c(A){return A||i}e.from=c;function*d(A){for(let $=A.length-1;$>=0;$--)yield A[$]}e.reverse=d;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,$){let L=0;for(let H of A)if($(H,L++))return!0;return!1}e.some=g;function v(A,$){for(let L of A)if($(L))return L}e.find=v;function*y(A,$){for(let L of A)$(L)&&(yield L)}e.filter=y;function*S(A,$){let L=0;for(let H of A)yield $(H,L++)}e.map=S;function*w(A,$){let L=0;for(let H of A)yield*$(H,L++)}e.flatMap=w;function*x(...A){for(let $ of A)yield*$}e.concat=x;function k(A,$,L){let H=L;for(let U of A)H=$(H,U);return H}e.reduce=k;function*R(A,$,L=A.length){for($<0&&($+=A.length),L<0?L+=A.length:L>A.length&&(L=A.length);$<L;$++)yield A[$]}e.slice=R;function O(A,$=Number.POSITIVE_INFINITY){let L=[];if($===0)return[L,A];let H=A[Symbol.iterator]();for(let U=0;U<$;U++){let oe=H.next();if(oe.done)return[L,e.empty()];L.push(oe.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=O;async function I(A){let $=[];for await(let L of A)$.push(L);return Promise.resolve($)}e.asyncToArray=I})(cT||={});function Co(e){if(cT.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 c7(...e){return ri(()=>Co(e))}function ri(e){return{dispose:l7(()=>{e()})}}var uT=class hT{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{Co(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?hT.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)}};uT.DISABLE_DISPOSED_WARNING=!1;var Da=uT,at=class{constructor(){this._store=new Da,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)}};at.None=Object.freeze({dispose(){}});var Pl=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}},Hr=typeof window=="object"?window:globalThis,Pv=class zv{constructor(t){this.element=t,this.next=zv.Undefined,this.prev=zv.Undefined}};Pv.Undefined=new Pv(void 0);var oi=Pv,hC=class{constructor(){this._first=oi.Undefined,this._last=oi.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oi.Undefined}clear(){let e=this._first;for(;e!==oi.Undefined;){let t=e.next;e.prev=oi.Undefined,e.next=oi.Undefined,e=t}this._first=oi.Undefined,this._last=oi.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new oi(e);if(this._first===oi.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==oi.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oi.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oi.Undefined&&e.next!==oi.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===oi.Undefined&&e.next===oi.Undefined?(this._first=oi.Undefined,this._last=oi.Undefined):e.next===oi.Undefined?(this._last=this._last.prev,this._last.next=oi.Undefined):e.prev===oi.Undefined&&(this._first=this._first.next,this._first.prev=oi.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oi.Undefined;)yield e.element,e=e.next}},u7=globalThis.performance&&typeof globalThis.performance.now=="function",h7=class dT{static create(t){return new dT(t)}constructor(t){this._now=u7&&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}},rn;(e=>{e.None=()=>at.None;function t(z,N){return v(z,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function i(z){return(N,D=null,T)=>{let E=!1,j;return j=z(P=>{if(!E)return j?j.dispose():E=!0,N.call(D,P)},null,T),E&&j.dispose(),j}}e.once=i;function n(z,N,D){return f((T,E=null,j)=>z(P=>T.call(E,N(P)),null,j),D)}e.map=n;function r(z,N,D){return f((T,E=null,j)=>z(P=>{N(P),T.call(E,P)},null,j),D)}e.forEach=r;function o(z,N,D){return f((T,E=null,j)=>z(P=>N(P)&&T.call(E,P),null,j),D)}e.filter=o;function c(z){return z}e.signal=c;function d(...z){return(N,D=null,T)=>{let E=c7(...z.map(j=>j(P=>N.call(D,P))));return g(E,T)}}e.any=d;function p(z,N,D,T){let E=D;return n(z,j=>(E=N(E,j),E),T)}e.reduce=p;function f(z,N){let D,T={onWillAddFirstListener(){D=z(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new be(T);return N?.add(E),E.event}function g(z,N){return N instanceof Array?N.push(z):N&&N.add(z),z}function v(z,N,D=100,T=!1,E=!1,j,P){let V,Q,B,Z=0,W,re={leakWarningThreshold:j,onWillAddFirstListener(){V=z(ve=>{Z++,Q=N(Q,ve),T&&!B&&(ie.fire(Q),Q=void 0),W=()=>{let xe=Q;Q=void 0,B=void 0,(!T||Z>1)&&ie.fire(xe),Z=0},typeof D=="number"?(clearTimeout(B),B=setTimeout(W,D)):B===void 0&&(B=0,queueMicrotask(W))})},onWillRemoveListener(){E&&Z>0&&W?.()},onDidRemoveLastListener(){W=void 0,V.dispose()}},ie=new be(re);return P?.add(ie),ie.event}e.debounce=v;function y(z,N=0,D){return e.debounce(z,(T,E)=>T?(T.push(E),T):[E],N,void 0,!0,void 0,D)}e.accumulate=y;function S(z,N=(T,E)=>T===E,D){let T=!0,E;return o(z,j=>{let P=T||!N(j,E);return T=!1,E=j,P},D)}e.latch=S;function w(z,N,D){return[e.filter(z,N,D),e.filter(z,T=>!N(T),D)]}e.split=w;function x(z,N=!1,D=[],T){let E=D.slice(),j=z(Q=>{E?E.push(Q):V.fire(Q)});T&&T.add(j);let P=()=>{E?.forEach(Q=>V.fire(Q)),E=null},V=new be({onWillAddFirstListener(){j||(j=z(Q=>V.fire(Q)),T&&T.add(j))},onDidAddFirstListener(){E&&(N?setTimeout(P):P())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(V),V.event}e.buffer=x;function k(z,N){return(D,T,E)=>{let j=N(new O);return z(function(P){let V=j.evaluate(P);V!==R&&D.call(T,V)},void 0,E)}}e.chain=k;let R=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:R),this}reduce(N,D){let T=D;return this.steps.push(E=>(T=N(T,E),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(E=>{let j=D||!N(E,T);return D=!1,T=E,j?E:R}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===R)break;return N}}function I(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.on(N,T),j=()=>z.removeListener(N,T),P=new be({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromNodeEventEmitter=I;function A(z,N,D=T=>T){let T=(...V)=>P.fire(D(...V)),E=()=>z.addEventListener(N,T),j=()=>z.removeEventListener(N,T),P=new be({onWillAddFirstListener:E,onDidRemoveLastListener:j});return P.event}e.fromDOMEventEmitter=A;function $(z){return new Promise(N=>i(z)(N))}e.toPromise=$;function L(z){let N=new be;return z.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=L;function H(z,N){return z(D=>N.fire(D))}e.forward=H;function U(z,N,D){return N(D),z(T=>N(T))}e.runAndSubscribe=U;class oe{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new be(T),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function fe(z,N){return new oe(z,N).emitter.event}e.fromObservable=fe;function K(z){return(N,D,T)=>{let E=0,j=!1,P={beginUpdate(){E++},endUpdate(){E--,E===0&&(z.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};z.addObserver(P),z.reportChanges();let V={dispose(){z.removeObserver(P)}};return T instanceof Da?T.add(V):Array.isArray(T)&&T.push(V),V}}e.fromObservableLight=K})(rn||={});var $v=class Hv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hv._idPool++}`,Hv.all.add(this)}start(t){this._stopWatch=new h7,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}}};$v.all=new Set,$v._idPool=0;var d7=$v,f7=-1,fT=class pT{constructor(t,i,n=(pT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)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=n*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new g7(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,i=0;for(let[n,r]of this._stacks)(!t||i<r)&&(t=[n,r],i=r);return t}};fT._idPool=1;var p7=fT,m7=class mT{constructor(t){this.value=t}static create(){let t=new Error;return new mT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
+
`).slice(2).join(`
|
|
88
|
+
`))}},g7=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},_7=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},v7=0,d_=class{constructor(e){this.value=e,this.id=v7++}},y7=2,b7,be=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new p7(t?.onListenerError??pf,this._options?.leakWarningThreshold??f7):void 0,this._perfMon=this._options?._profName?new d7(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,i,n)=>{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 _7(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||pf)(f),at.None}if(this._disposed)return at.None;i&&(t=t.bind(i));let r=new d_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=m7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof d_?(this._deliveryQueue??=new S7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=ri(()=>{o?.(),this._removeListener(r)});return n instanceof Da?n.add(c):Array.isArray(n)&&n.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 i=this._listeners,n=i.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*y7<=i.length){let o=0;for(let c=0;c<i.length;c++)i[c]?i[o++]=i[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=o}}_deliver(t,i){if(!t)return;let n=this._options?.onListenerError||pf;if(!n){t.value(i);return}try{t.value(i)}catch(r){n(r)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof d_)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},S7=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Fv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Fv.INSTANCE=new Fv;var Nb=Fv;function w7(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Nb.INSTANCE.onDidChangeZoomLevel;function x7(e){return Nb.INSTANCE.getZoomFactor(e)}Nb.INSTANCE.onDidChangeFullscreen;var Zl=typeof navigator=="object"?navigator.userAgent:"",Uv=Zl.indexOf("Firefox")>=0,C7=Zl.indexOf("AppleWebKit")>=0,Lb=Zl.indexOf("Chrome")>=0,k7=!Lb&&Zl.indexOf("Safari")>=0;Zl.indexOf("Electron/")>=0;Zl.indexOf("Android")>=0;var f_=!1;if(typeof Hr.matchMedia=="function"){let e=Hr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Hr.matchMedia("(display-mode: fullscreen)");f_=e.matches,w7(Hr,e,({matches:i})=>{f_&&t.matches||(f_=i)})}var El="en",Wv=!1,Gv=!1,mf=!1,gT=!1,jd,gf=El,dC=El,E7,Br,yo=globalThis,as;typeof yo.vscode<"u"&&typeof yo.vscode.process<"u"?as=yo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(as=process);var T7=typeof as?.versions?.electron=="string",A7=T7&&as?.type==="renderer";if(typeof as=="object"){Wv=as.platform==="win32",Gv=as.platform==="darwin",mf=as.platform==="linux",mf&&as.env.SNAP&&as.env.SNAP_REVISION,as.env.CI||as.env.BUILD_ARTIFACTSTAGINGDIRECTORY,jd=El,gf=El;let e=as.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);jd=t.userLocale,dC=t.osLocale,gf=t.resolvedLanguage||El,E7=t.languagePack?.translationsConfigFile}catch{}gT=!0}else typeof navigator=="object"&&!A7?(Br=navigator.userAgent,Wv=Br.indexOf("Windows")>=0,Gv=Br.indexOf("Macintosh")>=0,(Br.indexOf("Macintosh")>=0||Br.indexOf("iPad")>=0||Br.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,mf=Br.indexOf("Linux")>=0,Br?.indexOf("Mobi")>=0,gf=globalThis._VSCODE_NLS_LANGUAGE||El,jd=navigator.language.toLowerCase(),dC=jd):console.error("Unable to resolve platform.");var _T=Wv,rr=Gv,R7=mf,fC=gT,cr=Br,ba=gf,N7;(e=>{function t(){return ba}e.value=t;function i(){return ba.length===2?ba==="en":ba.length>=3?ba[0]==="e"&&ba[1]==="n"&&ba[2]==="-":!1}e.isDefaultVariant=i;function n(){return ba==="en"}e.isDefault=n})(N7||={});var L7=typeof yo.postMessage=="function"&&!yo.importScripts;(()=>{if(L7){let e=[];yo.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let o=e[n];if(o.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),o.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),yo.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var M7=!!(cr&&cr.indexOf("Chrome")>=0);cr&&cr.indexOf("Firefox")>=0;!M7&&cr&&cr.indexOf("Safari")>=0;cr&&cr.indexOf("Edg/")>=0;cr&&cr.indexOf("Android")>=0;var dl=typeof navigator=="object"?navigator:{};fC||document.queryCommandSupported&&document.queryCommandSupported("copy")||dl&&dl.clipboard&&dl.clipboard.writeText,fC||dl&&dl.clipboard&&dl.clipboard.readText;var Mb=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}},p_=new Mb,pC=new Mb,mC=new Mb,O7=new Array(230),vT;(e=>{function t(d){return p_.keyCodeToStr(d)}e.toString=t;function i(d){return p_.strToKeyCode(d)}e.fromString=i;function n(d){return pC.keyCodeToStr(d)}e.toUserSettingsUS=n;function r(d){return mC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return pC.strToKeyCode(d)||mC.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 p_.keyCodeToStr(d)}e.toElectronAccelerator=c})(vT||={});var D7=class yT{constructor(t,i,n,r,o){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof yT&&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",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${n}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new j7([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},j7=class{constructor(e){if(e.length===0)throw a7("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 I7(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return vT.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Uv)switch(t){case 59:return 85;case 60:if(R7)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(rr)return 57;break}else if(C7&&(rr&&t===93||!rr&&t===92))return 57;return O7[t]||0}var B7=rr?256:2048,P7=512,z7=1024,$7=rr?2048:256,gC=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=I7(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|=B7),this.altKey&&(t|=P7),this.shiftKey&&(t|=z7),this.metaKey&&(t|=$7),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new D7(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},_C=new WeakMap;function H7(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var F7=class{static getSameOriginWindowChain(e){let t=_C.get(e);if(!t){t=[],_C.set(e,t);let i=e,n;do n=H7(i),n?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0,r=this.getSameOriginWindowChain(e);for(let o of r){let c=o.window.deref();if(i+=c?.scrollY??0,n+=c?.scrollX??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();i+=d.top,n+=d.left}return{top:i,left:n}}},Id=class{constructor(t,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=F7.getPositionOfChildWindowRelativeToAncestorWindow(t,i.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},vC=class{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let n=!1;if(Lb){let r=navigator.userAgent.match(/Chrome\/(\d+)/);n=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,c=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")n?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?Uv&&!rr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")k7&&_T?this.deltaX=-(r.wheelDeltaX/120):n?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?Uv&&!rr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},bT=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),U7;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof W7?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:rn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bT})})(U7||={});var W7=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?bT:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ob=class{constructor(t,i){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof i=="number"&&this.setIfNotSet(t,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,i){if(this._isDisposed)throw new Bv("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},i)}setIfNotSet(t,i){if(this._isDisposed)throw new Bv("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},i))}},G7=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Bv("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=ri(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},q7;(e=>{async function t(n){let r,o=await Promise.all(n.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function i(n){return new Promise(async(r,o)=>{try{await n(r,o)}catch(c){o(c)}})}e.withAsyncBody=i})(q7||={});var yC=class Es{static fromArray(t){return new Es(i=>{i.emitMany(t)})}static fromPromise(t){return new Es(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Es(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new Es(async i=>{await Promise.all(t.map(async n=>{for await(let r of n)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new be,queueMicrotask(async()=>{let n={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(n)),this.resolve()}catch(r){this.reject(r)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 rn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Es(async n=>{for await(let r of t)n.emitOne(i(r))})}map(t){return Es.map(this,t)}static filter(t,i){return new Es(async n=>{for await(let r of t)i(r)&&n.emitOne(r)})}filter(t){return Es.filter(this,t)}static coalesce(t){return Es.filter(t,i=>!!i)}coalesce(){return Es.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return Es.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())}};yC.EMPTY=yC.fromArray([]);var{getWindow:sr,getWindowId:K7,onDidRegisterWindow:V7}=(function(){let e=new Map,t={window:Hr,disposables:new Da};e.set(Hr.vscodeWindowId,t);let i=new be,n=new be,r=new be;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:n.event,registerWindow(c){if(e.has(c.vscodeWindowId))return at.None;let d=new Da,p={window:c,disposables:d.add(new Da)};return e.set(c.vscodeWindowId,p),d.add(ri(()=>{e.delete(c.vscodeWindowId),n.fire(c)})),d.add(Ke(c,Hi.BEFORE_UNLOAD,()=>{r.fire(c)})),i.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:Hr},getDocument(c){return sr(c).document}}})(),Y7=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!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 Ke(e,t,i,n){return new Y7(e,t,i,n)}var bC=function(e,t,i,n){return Ke(e,t,i,n)},Db,X7=class extends G7{constructor(e){super(),this.defaultTarget=e&&sr(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},SC=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){pf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,r=o=>{i.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),n.set(o,!0);c.length>0;)c.sort(SC.sort),c.shift().execute();n.set(o,!1)};Db=(o,c,d=0)=>{let p=K7(o),f=new SC(c,d),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(f),i.get(p)||(i.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function Z7(e){let t=e.getBoundingClientRect(),i=sr(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Hi={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"},J7=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=Pn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Pn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Pn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Pn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Pn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Pn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Pn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Pn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Pn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Pn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Pn(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=Pn(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=Pn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Pn(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 Pn(e){return typeof e=="number"?`${e}px`:e}function Ou(e){return new J7(e)}var ST=class{constructor(){this._hooks=new Da,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(ri(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=sr(e)}this._hooks.add(Ke(o,Hi.POINTER_MOVE,c=>{if(c.buttons!==i){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Ke(o,Hi.POINTER_UP,c=>this.stopMonitoring(!0)))}};function Q7(e,t,i){let n=null,r=null;if(typeof i.value=="function"?(n="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",r=i.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;i[n]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,c)}),this[o]}}var ir;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ir||={});var yu=class fn extends at{constructor(){super(),this.dispatched=!1,this.targets=new hC,this.ignoreTargets=new hC,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(rn.runAndSubscribe(V7,({window:t,disposables:i})=>{i.add(Ke(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Ke(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(Ke(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Hr,disposables:this._store}))}static addTarget(t){if(!fn.isTouchDevice())return at.None;fn.INSTANCE||(fn.INSTANCE=new fn);let i=fn.INSTANCE.targets.push(t);return ri(i)}static ignoreTarget(t){if(!fn.isTouchDevice())return at.None;fn.INSTANCE||(fn.INSTANCE=new fn);let i=fn.INSTANCE.ignoreTargets.push(t);return ri(i)}static isTouchDevice(){return"ontouchstart"in Hr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,r=t.targetTouches.length;n<r;n++){let o=t.targetTouches.item(n);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:i,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[i],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(ir.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,i){let n=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,c=i.changedTouches.length;o<c;o++){let d=i.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<fn.HOLD_DELAY&&Math.abs(p.initialPageX-ns(p.rollingPageX))<30&&Math.abs(p.initialPageY-ns(p.rollingPageY))<30){let g=this.newGestureEvent(ir.Tap,p.initialTarget);g.pageX=ns(p.rollingPageX),g.pageY=ns(p.rollingPageY),this.dispatchEvent(g)}else if(f>=fn.HOLD_DELAY&&Math.abs(p.initialPageX-ns(p.rollingPageX))<30&&Math.abs(p.initialPageY-ns(p.rollingPageY))<30){let g=this.newGestureEvent(ir.Contextmenu,p.initialTarget);g.pageX=ns(p.rollingPageX),g.pageY=ns(p.rollingPageY),this.dispatchEvent(g)}else if(r===1){let g=ns(p.rollingPageX),v=ns(p.rollingPageY),y=ns(p.rollingTimestamps)-p.rollingTimestamps[0],S=g-p.rollingPageX[0],w=v-p.rollingPageY[0],x=[...this.targets].filter(k=>p.initialTarget instanceof Node&&k.contains(p.initialTarget));this.inertia(t,x,n,Math.abs(S)/y,S>0?1:-1,g,Math.abs(w)/y,w>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(ir.End,p.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(t){if(t.type===ir.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>fn.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,t.tapCount=n}else(t.type===ir.Change||t.type===ir.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==n;)r++,o=o.parentElement;i.push([r,n])}i.sort((n,r)=>n[0]-r[0]);for(let[n,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,n,r,o,c,d,p,f){this.handle=Db(t,()=>{let g=Date.now(),v=g-n,y=0,S=0,w=!0;r+=fn.SCROLL_FRICTION*v,d+=fn.SCROLL_FRICTION*v,r>0&&(w=!1,y=o*r*v),d>0&&(w=!1,S=p*d*v);let x=this.newGestureEvent(ir.Change);x.translationX=y,x.translationY=S,i.forEach(k=>k.dispatchEvent(x)),w||this.inertia(t,i,g,r,o,c+y,d,p,f+S)})}onTouchMove(t){let i=Date.now();for(let n=0,r=t.changedTouches.length;n<r;n++){let o=t.changedTouches.item(n);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(ir.Change,c.initialTarget);d.translationX=o.pageX-ns(c.rollingPageX),d.translationY=o.pageY-ns(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(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};yu.SCROLL_FRICTION=-.005,yu.HOLD_DELAY=700,yu.CLEAR_TAP_COUNT_TIME=400,gi([Q7],yu,"isTouchDevice",1);var eI=yu,jb=class extends at{onclick(e,t){this._register(Ke(e,Hi.CLICK,i=>t(new Id(sr(e),i))))}onmousedown(e,t){this._register(Ke(e,Hi.MOUSE_DOWN,i=>t(new Id(sr(e),i))))}onmouseover(e,t){this._register(Ke(e,Hi.MOUSE_OVER,i=>t(new Id(sr(e),i))))}onmouseleave(e,t){this._register(Ke(e,Hi.MOUSE_LEAVE,i=>t(new Id(sr(e),i))))}onkeydown(e,t){this._register(Ke(e,Hi.KEY_DOWN,i=>t(new gC(i))))}onkeyup(e,t){this._register(Ke(e,Hi.KEY_UP,i=>t(new gC(i))))}oninput(e,t){this._register(Ke(e,Hi.INPUT,t))}onblur(e,t){this._register(Ke(e,Hi.BLUR,t))}onfocus(e,t){this._register(Ke(e,Hi.FOCUS,t))}onchange(e,t){this._register(Ke(e,Hi.CHANGE,t))}ignoreGesture(e){return eI.ignoreTarget(e)}},wC=11,tI=class extends jb{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=wC+"px",this.domNode.style.height=wC+"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 ST),this._register(bC(this.bgDomNode,Hi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(bC(this.domNode,Hi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new X7),this._pointerdownScheduleRepeatTimer=this._register(new Ob)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,sr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},iI=class qv{constructor(t,i,n,r,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,r=r|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=r,this.rawScrollTop=d,i<0&&(i=0),r+i>n&&(r=n-i),r<0&&(r=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=i,this.scrollWidth=n,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,i){return new qv(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new qv(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,i){let n=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:i,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:n,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:p}}},nI=class extends at{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new iI(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 i=this._state.withScrollDimensions(e,t);this._setState(i,!!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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new CC(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=CC.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},xC=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function m_(e,t){let i=t-e;return function(n){return e+i*aI(n)}}function sI(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}var CC=class Kv{constructor(t,i,n,r){this.from=t,this.to=i,this.duration=r,this.startTime=n,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,i,n){if(Math.abs(t-i)>2.5*n){let r,o;return t<i?(r=t+.75*n,o=i-.75*n):(r=t-.75*n,o=i+.75*n),sI(m_(t,r),m_(o,i),.33)}return m_(t,i)}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 i=(t-this.startTime)/this.duration;if(i<1){let n=this.scrollLeft(i),r=this.scrollTop(i);return new xC(n,r,!1)}return new xC(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,n){return Kv.start(t,i,n)}static start(t,i,n){n=n+10;let r=Date.now()-10;return new Kv(t,i,r,n)}};function rI(e){return Math.pow(e,3)}function aI(e){return 1-rI(1-e)}var oI=class extends at{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Ob)}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":"")))}},lI=140,wT=class extends jb{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 oI(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ST),this._shouldRender=!0,this.domNode=Ou(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(Ke(this.domNode.domNode,Hi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new tI(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=Ou(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ke(this.slider.domNode,Hi.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,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=Z7(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=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-i);if(_T&&c>lI){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let d=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(n.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()}},xT=class Vv{constructor(t,i,n,r,o,c){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),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 Vv(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,n,r,o){let c=Math.max(0,n-t),d=Math.max(0,c-2*i),p=r>0&&r>n;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(n*d/r))),g=(d-f)/(r-n),v=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=Vv._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 i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,n=this._scrollPosition;return i<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},cI=class extends wT{constructor(e,t,i){let n=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new xT(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.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}},uI=class extends wT{constructor(e,t,i){let n=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new xT(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.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}},hI=500,kC=50,dI=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Yv=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,i=0,n=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-n);if(t-=o,i+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(Lb){let i=sr(t.browserEvent),n=x7(i);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,n){let r=null,o=new dI(t,i,n);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,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),i){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(i.deltaX),d=Math.abs(i.deltaY),p=Math.max(Math.min(r,c),1),f=Math.max(Math.min(o,d),1),g=Math.max(r,c),v=Math.max(o,d);g%p===0&&v%f===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Yv.INSTANCE=new Yv;var fI=Yv,pI=class extends jb{constructor(e,t,i){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=gI(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new uI(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new cI(this._scrollable,this._options,n)),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=Ou(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ou(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ou(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 Ob),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Co(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,rr&&(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 vC(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Co(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new vC(i))};this._mouseWheelToDispose.push(Ke(this._listenOnDomNode,Hi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=fI.INSTANCE;t.acceptStandardWheelEvent(e);let i=!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=!rr&&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=kC*r,g=d.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,g)}if(o){let f=kC*o,g=d.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,g)}p=this._scrollable.validateScrollPosition(p),(d.scrollLeft!==p.scrollLeft||d.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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,i=e.scrollLeft>0,n=i?" left":"",r=t?" top":"",o=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${n}`)}}_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(),hI)}},mI=class extends pI{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function gI(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,rr&&(t.className+=" mac"),t}var Xv=class extends at{constructor(e,t,i,n,r,o,c,d){super(),this._bufferService=i,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new nI({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Db(n.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new mI(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(rn.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ri(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ri(()=>this._styleElement.remove())),this._register(rn.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),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};Xv=gi([Ee(2,En),Ee(3,Gr),Ee(4,nT),Ee(5,Xl),Ee(6,Tn),Ee(7,qr)],Xv);var Zv=class extends at{constructor(e,t,i,n,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=n,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(ri(()=>{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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Zv=gi([Ee(1,En),Ee(2,Gr),Ee(3,dh),Ee(4,qr)],Zv);var _I=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},er={full:0,left:0,center:0,right:0},Sa={full:0,left:0,center:0,right:0},Qc={full:0,left:0,center:0,right:0},$f=class extends at{constructor(e,t,i,n,r,o,c,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=r,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new _I,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(ri(()=>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);Sa.full=this._canvas.width,Sa.left=e,Sa.center=t,Sa.right=e,this._refreshDrawHeightConstants(),Qc.full=1,Qc.left=1,Qc.center=1+Sa.left,Qc.right=1+Sa.left+Sa.center}_refreshDrawHeightConstants(){er.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);er.left=t,er.center=t,er.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*er.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*er.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*er.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*er.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(Qc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-er[e.position||"full"]/2),Sa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+er[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}))}};$f=gi([Ee(2,En),Ee(3,dh),Ee(4,qr),Ee(5,Tn),Ee(6,Xl),Ee(7,Gr)],$f);var pe;(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=""))(pe||={});var _f;(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=""))(_f||={});var CT;(e=>e.ST=`${pe.ESC}\\`)(CT||={});var Jv=class{constructor(e,t,i,n,r,o){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,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 i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${pe.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),i=this._renderService.dimensions.css.cell.height,n=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=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"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=n+"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)}}};Jv=gi([Ee(2,En),Ee(3,Tn),Ee(4,Ao),Ee(5,qr)],Jv);var Gi=0,qi=0,Ki=0,mi=0,EC={css:"#00000000",rgba:0},Ri;(e=>{function t(r,o,c,d){return d!==void 0?`#${so(r)}${so(o)}${so(c)}${so(d)}`:`#${so(r)}${so(o)}${so(c)}`}e.toCss=t;function i(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=i;function n(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=n})(Ri||={});var Xt;(e=>{function t(p,f){if(mi=(f.rgba&255)/255,mi===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,v=f.rgba>>16&255,y=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;Gi=S+Math.round((g-S)*mi),qi=w+Math.round((v-w)*mi),Ki=x+Math.round((y-x)*mi);let k=Ri.toCss(Gi,qi,Ki),R=Ri.toRgba(Gi,qi,Ki);return{css:k,rgba:R}}e.blend=t;function i(p){return(p.rgba&255)===255}e.isOpaque=i;function n(p,f,g){let v=vf.ensureContrastRatio(p.rgba,f.rgba,g);if(v)return Ri.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=n;function r(p){let f=(p.rgba|255)>>>0;return[Gi,qi,Ki]=vf.toChannels(f),{css:Ri.toCss(Gi,qi,Ki),rgba:f}}e.opaque=r;function o(p,f){return mi=Math.round(f*255),[Gi,qi,Ki]=vf.toChannels(p.rgba),{css:Ri.toCss(Gi,qi,Ki,mi),rgba:Ri.toRgba(Gi,qi,Ki,mi)}}e.opacity=o;function c(p,f){return mi=p.rgba&255,o(p,mi*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(Xt||={});var li;(e=>{let t,i;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",i=t.createLinearGradient(0,0,1,1))}catch{}function n(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Gi=parseInt(r.slice(1,2).repeat(2),16),qi=parseInt(r.slice(2,3).repeat(2),16),Ki=parseInt(r.slice(3,4).repeat(2),16),Ri.toColor(Gi,qi,Ki);case 5:return Gi=parseInt(r.slice(1,2).repeat(2),16),qi=parseInt(r.slice(2,3).repeat(2),16),Ki=parseInt(r.slice(3,4).repeat(2),16),mi=parseInt(r.slice(4,5).repeat(2),16),Ri.toColor(Gi,qi,Ki,mi);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 Gi=parseInt(o[1]),qi=parseInt(o[2]),Ki=parseInt(o[3]),mi=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ri.toColor(Gi,qi,Ki,mi);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Gi,qi,Ki,mi]=t.getImageData(0,0,1,1).data,mi!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ri.toRgba(Gi,qi,Ki,mi),css:r}}e.toColor=n})(li||={});var bn;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,r,o){let c=n/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+v*.0722}e.relativeLuminance2=i})(bn||={});var vf;(e=>{function t(c,d){if(mi=(d&255)/255,mi===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,v=c>>24&255,y=c>>16&255,S=c>>8&255;return Gi=v+Math.round((p-v)*mi),qi=y+Math.round((f-y)*mi),Ki=S+Math.round((g-S)*mi),Ri.toRgba(Gi,qi,Ki)}e.blend=t;function i(c,d,p){let f=bn.relativeLuminance(c>>8),g=bn.relativeLuminance(d>>8);if(jr(f,g)<p){if(g<f){let S=n(c,d,p),w=jr(f,bn.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),k=jr(f,bn.relativeLuminance(x>>8));return w>k?S:x}return S}let v=r(c,d,p),y=jr(f,bn.relativeLuminance(v>>8));if(y<p){let S=n(c,d,p),w=jr(f,bn.relativeLuminance(S>>8));return y>w?v:S}return v}}e.ensureContrastRatio=i;function n(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,y=d>>24&255,S=d>>16&255,w=d>>8&255,x=jr(bn.relativeLuminance2(y,S,w),bn.relativeLuminance2(f,g,v));for(;x<p&&(y>0||S>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=jr(bn.relativeLuminance2(y,S,w),bn.relativeLuminance2(f,g,v));return(y<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=n;function r(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,y=d>>24&255,S=d>>16&255,w=d>>8&255,x=jr(bn.relativeLuminance2(y,S,w),bn.relativeLuminance2(f,g,v));for(;x<p&&(y<255||S<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=jr(bn.relativeLuminance2(y,S,w),bn.relativeLuminance2(f,g,v));return(y<<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})(vf||={});function so(e){let t=e.toString(16);return t.length<2?"0"+t:t}function jr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var vI=class extends hh{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ns}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 i=[],n=t.translateToString(!0),r=0,o=0,c=0,d=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==p){if(f-r>1){let g=this._getJoinedRanges(n,c,o,t,r);for(let v=0;v<g.length;v++)i.push(g[v])}r=f,c=o,d=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||La.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(n,c,o,t,r);for(let g=0;g<f.length;g++)i.push(f[g])}return i}_getJoinedRanges(e,t,i,n,r){let o=e.substring(t,i),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++)Hf._mergeRanges(c,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,n,r),c}_stringRangesToCellRanges(e,t,i){let n=0,r=!1,o=0,c=e[n];if(c){for(let d=i;d<this._bufferService.cols;d++){let p=t.getWidth(d),f=t.getString(d).length||La.length;if(p!==0){if(!r&&c[0]<=o&&(c[0]=d,r=!0),c[1]<=o){if(c[1]=d,c=e[++n],!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 i=!1;for(let n=0;n<e.length;n++){let r=e[n];if(i){if(t[1]<=r[0])return e[n-1][1]=t[1],e;if(t[1]<=r[1])return e[n-1][1]=Math.max(t[1],r[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=r[0])return e.splice(n,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]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Hf=gi([Ee(0,En)],Hf);function yI(e){return 57508<=e&&e<=57558}function bI(e){return 9472<=e&&e<=9631}function SI(e){return yI(e)||bI(e)}function wI(){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}}var Qv=class{constructor(e,t,i,n,r,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=n,this._coreService=r,this._decorationService=o,this._themeService=c,this._workCell=new Ns,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,n,r,o,c,d,p,f,g){let v=[],y=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();i&&w<o+1&&(w=o+1);let x,k=0,R="",O=0,I=0,A=0,$=0,L=!1,H=0,U=!1,oe=0,fe=0,K=[],z=f!==-1&&g!==-1;for(let N=0;N<w;N++){e.loadCell(N,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let T=!1,E=N>=fe,j=N,P=this._workCell;if(y.length>0&&N===y[0][0]&&E){let Se=y.shift(),Ue=this._isCellInSelection(Se[0],t);for(O=Se[0]+1;O<Se[1];O++)E&&=Ue===this._isCellInSelection(O,t);E&&=!i||o<Se[0]||o>=Se[1],E?(T=!0,P=new vI(this._workCell,e.translateToString(!0,Se[0],Se[1]),Se[1]-Se[0]),j=Se[1]-1,D=P.getWidth()):fe=Se[1]}let V=this._isCellInSelection(N,t),Q=i&&N===o,B=z&&N>=f&&N<=g,Z=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Se=>{Z=!0});let W=P.getChars()||La;if(W===" "&&(P.isUnderline()||P.isOverline())&&(W=" "),oe=D*d-p.get(W,P.isBold(),P.isItalic()),!x)x=this._document.createElement("span");else if(k&&(V&&U||!V&&!U&&P.bg===I)&&(V&&U&&S.selectionForeground||P.fg===A)&&P.extended.ext===$&&B===L&&oe===H&&!Q&&!T&&!Z&&E){P.isInvisible()?R+=La:R+=W,k++;continue}else k&&(x.textContent=R),x=this._document.createElement("span"),k=0,R="";if(I=P.bg,A=P.fg,$=P.extended.ext,L=B,H=oe,U=V,T&&o>=N&&o<=j&&(o=N),!this._coreService.isCursorHidden&&Q&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&K.push("xterm-cursor-blink"),K.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if(P.isBold()&&K.push("xterm-bold"),P.isItalic()&&K.push("xterm-italic"),P.isDim()&&K.push("xterm-dim"),P.isInvisible()?R=La:R=P.getChars()||La,P.isUnderline()&&(K.push(`xterm-underline-${P.extended.underlineStyle}`),R===" "&&(R=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${hh.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let Se=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&Se<8&&(Se+=8),x.style.textDecorationColor=S.ansi[Se].css}P.isOverline()&&(K.push("xterm-overline"),R===" "&&(R=" ")),P.isStrikethrough()&&K.push("xterm-strikethrough"),B&&(x.style.textDecoration="underline");let re=P.getFgColor(),ie=P.getFgColorMode(),ve=P.getBgColor(),xe=P.getBgColorMode(),Te=!!P.isInverse();if(Te){let Se=re;re=ve,ve=Se;let Ue=ie;ie=xe,xe=Ue}let Ie,_t,qe=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Se=>{Se.options.layer!=="top"&&qe||(Se.backgroundColorRGB&&(xe=50331648,ve=Se.backgroundColorRGB.rgba>>8&16777215,Ie=Se.backgroundColorRGB),Se.foregroundColorRGB&&(ie=50331648,re=Se.foregroundColorRGB.rgba>>8&16777215,_t=Se.foregroundColorRGB),qe=Se.options.layer==="top")}),!qe&&V&&(Ie=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ve=Ie.rgba>>8&16777215,xe=50331648,qe=!0,S.selectionForeground&&(ie=50331648,re=S.selectionForeground.rgba>>8&16777215,_t=S.selectionForeground)),qe&&K.push("xterm-decoration-top");let Re;switch(xe){case 16777216:case 33554432:Re=S.ansi[ve],K.push(`xterm-bg-${ve}`);break;case 50331648:Re=Ri.toColor(ve>>16,ve>>8&255,ve&255),this._addStyle(x,`background-color:#${TC((ve>>>0).toString(16),"0",6)}`);break;default:Te?(Re=S.foreground,K.push("xterm-bg-257")):Re=S.background}switch(Ie||P.isDim()&&(Ie=Xt.multiplyOpacity(Re,.5)),ie){case 16777216:case 33554432:P.isBold()&&re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(re+=8),this._applyMinimumContrast(x,Re,S.ansi[re],P,Ie,void 0)||K.push(`xterm-fg-${re}`);break;case 50331648:let Se=Ri.toColor(re>>16&255,re>>8&255,re&255);this._applyMinimumContrast(x,Re,Se,P,Ie,_t)||this._addStyle(x,`color:#${TC(re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Re,S.foreground,P,Ie,_t)||Te&&K.push("xterm-fg-257")}K.length&&(x.className=K.join(" "),K.length=0),!Q&&!T&&!Z&&E?k++:x.textContent=R,oe!==this.defaultSpacing&&(x.style.letterSpacing=`${oe}px`),v.push(x),N=j}return x&&k&&(x.textContent=R),v}_applyMinimumContrast(e,t,i,n,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||SI(n.getCode()))return!1;let c=this._getContrastCache(n),d;if(!r&&!o&&(d=c.getColor(t.rgba,i.rgba)),d===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=Xt.ensureContrastRatio(r||t,o||i,p),c.setColor((r||t).rgba,(o||i).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 i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?e>=i[0]&&t>=i[1]&&e<n[0]&&t<=n[1]:e<i[0]&&t>=i[1]&&e>=n[0]&&t<=n[1]:t>i[1]&&t<n[1]||i[1]===n[1]&&t===i[1]&&e>=i[0]&&e<n[0]||i[1]<n[1]&&t===n[1]&&e<n[0]||i[1]<n[1]&&t===i[1]&&e>=i[0]}};Qv=gi([Ee(1,aT),Ee(2,Tn),Ee(3,Gr),Ee(4,Ao),Ee(5,dh),Ee(6,Xl)],Qv);function TC(e,t,i){for(;e.length<i;)e=t+e;return e}var xI=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.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=[i,n,r,o],this._container.appendChild(i),this._container.appendChild(n),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,i,n){e===this._font&&t===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,i){let n=0;if(!t&&!i&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let c=this._measure(e,0);return c>0&&(this._flat[n]=c),c}let r=e;t&&(r+="B"),i&&(r+="I");let o=this._holey.get(r);if(o===void 0){let c=0;t&&(c|=1),i&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},CI=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,c=i[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=n,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function kI(){return new CI}var g_="xterm-dom-renderer-owner-",ws="xterm-rows",Pd="xterm-fg-",AC="xterm-bg-",eu="xterm-focus",zd="xterm-selection",EI=1,ey=class extends at{constructor(e,t,i,n,r,o,c,d,p,f,g,v,y,S){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=r,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=f,this._bufferService=g,this._coreService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=EI++,this._rowElements=[],this._selectionRenderModel=kI(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ws),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(zd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=wI(),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(Qv,document),this._element.classList.add(g_+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(ri(()=>{this._element.classList.remove(g_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new xI(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ws} 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} .${ws} { 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} .${ws} .xterm-dim { color: ${Xt.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 i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 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} .${ws}.${eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ws}.${eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ws}.${eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ws} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ws} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ws} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ws} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ws} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${zd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${zd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${zd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Pd}${o} { color: ${c.css}; }${this._terminalSelector} .${Pd}${o}.xterm-dim { color: ${Xt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${AC}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Pd}257 { color: ${Xt.opaque(e.background).css}; }${this._terminalSelector} .${Pd}257.xterm-dim { color: ${Xt.multiplyOpacity(Xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${AC}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 i=this._rowElements.length;i<=t;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}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(eu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(eu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(i){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=n===o?e[0]:0,f=o===r?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,p,f));let g=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let v=r===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,v))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,i,n=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(i-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),r.style.height=`${n*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 i=this._bufferService.buffer,n=i.ybase+i.y,r=Math.min(i.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+i.ydisp,g=this._rowElements[p],v=i.lines.get(f);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,f,f===n,c,d,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g_}${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,i,n,r,o){i<0&&(e=0),n<0&&(t=0);let c=this._bufferService.rows-1;i=Math.max(Math.min(i,c),0),n=Math.max(Math.min(n,c),0),r=Math.min(r,this._bufferService.cols);let d=this._bufferService.buffer,p=d.ybase+d.y,f=Math.min(d.x,r-1),g=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=i;S<=n;++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,v,y,f,g,this.dimensions.css.cell.width,this._widthCache,o?S===i?e:0:-1,o?(S===n?t:r)-1:-1))}}};ey=gi([Ee(7,Ab),Ee(8,vp),Ee(9,Tn),Ee(10,En),Ee(11,Ao),Ee(12,Gr),Ee(13,Xl)],ey);var ty=class extends at{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new AI(this._optionsService))}catch{this._measureStrategy=this._register(new TI(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())}};ty=gi([Ee(2,Tn)],ty);var kT=class extends at{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)}},TI=class extends kT{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},AI=class extends kT{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}},RI=class extends at{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new NI(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(rn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ke(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}},NI=class extends at{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pl),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ri(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ke(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)}},LI=class extends at{constructor(){super(),this.linkProviders=[],this._register(ri(()=>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 Ib(e,t,i){let n=i.getBoundingClientRect(),r=e.getComputedStyle(i),o=parseInt(r.getPropertyValue("padding-left")),c=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-n.left-o,t.clientY-n.top-c]}function MI(e,t,i,n,r,o,c,d,p){if(!o)return;let f=Ib(e,t,i);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),n+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),r),f}var iy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,r){return MI(window,e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=Ib(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};iy=gi([Ee(0,qr),Ee(1,vp)],iy);var OI=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,i){this._rowCount=i,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=[]}},ET={};U8(ET,{getSafariVersion:()=>jI,isChromeOS:()=>NT,isFirefox:()=>TT,isIpad:()=>II,isIphone:()=>BI,isLegacyEdge:()=>DI,isLinux:()=>Bb,isMac:()=>Ff,isNode:()=>yp,isSafari:()=>AT,isWindows:()=>RT});var yp=typeof process<"u"&&"title"in process,fh=yp?"node":navigator.userAgent,ph=yp?"node":navigator.platform,TT=fh.includes("Firefox"),DI=fh.includes("Edge"),AT=/^((?!chrome|android).)*safari/i.test(fh);function jI(){if(!AT)return 0;let e=fh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ff=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ph),II=ph==="iPad",BI=ph==="iPhone",RT=["Windows","Win16","Win32","WinCE"].includes(ph),Bb=ph.indexOf("Linux")>=0,NT=/\bCrOS\b/.test(fh),LT=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=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),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}},PI=class extends LT{_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())}}},zI=class extends LT{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Uf=!yp&&"requestIdleCallback"in window?zI:PI,$I=class{constructor(){this._queue=new Uf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ny=class extends at{constructor(e,t,i,n,r,o,c,d,p){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new Pl),this._pausedResizeTask=new $I,this._observerDisposable=this._register(new Pl),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new OI((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new HI(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ri(()=>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 i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ri(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(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,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ny=gi([Ee(2,Tn),Ee(3,vp),Ee(4,Ao),Ee(5,dh),Ee(6,En),Ee(7,Gr),Ee(8,Xl)],ny);var HI=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 FI(e,t,i,n){let r=i.buffer.x,o=i.buffer.y;if(!i.buffer.hasScrollback)return GI(r,o,e,t,i,n)+bp(o,t,i,n)+qI(r,o,e,t,i,n);let c;if(o===t)return c=r>e?"D":"C",Ku(Math.abs(r-e),qu(c,n));c=o>t?"D":"C";let d=Math.abs(o-t),p=WI(o>t?e:r,i)+(d-1)*i.cols+1+UI(o>t?r:e);return Ku(p,qu(c,n))}function UI(e,t){return e-1}function WI(e,t){return t.cols-e}function GI(e,t,i,n,r,o){return bp(t,n,r,o).length===0?"":Ku(OT(e,t,e,t-ko(t,r),!1,r).length,qu("D",o))}function bp(e,t,i,n){let r=e-ko(e,i),o=t-ko(t,i),c=Math.abs(r-o)-KI(e,t,i);return Ku(c,qu(MT(e,t),n))}function qI(e,t,i,n,r,o){let c;bp(t,n,r,o).length>0?c=n-ko(n,r):c=t;let d=n,p=VI(e,t,i,n,r,o);return Ku(OT(e,c,i,d,p==="C",r).length,qu(p,o))}function KI(e,t,i){let n=0,r=e-ko(e,i),o=t-ko(t,i);for(let c=0;c<Math.abs(r-o);c++){let d=MT(e,t)==="A"?-1:1;i.buffer.lines.get(r+d*c)?.isWrapped&&n++}return n}function ko(e,t){let i=0,n=t.buffer.lines.get(e),r=n?.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,n=t.buffer.lines.get(--e),r=n?.isWrapped;return i}function VI(e,t,i,n,r,o){let c;return bp(i,n,r,o).length>0?c=n-ko(n,r):c=t,e<i&&c<=n||e>=i&&c<n?"C":"D"}function MT(e,t){return e>t?"A":"B"}function OT(e,t,i,n,r,o){let c=e,d=t,p="";for(;(c!==i||d!==n)&&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 qu(e,t){let i=t?"O":"[";return pe.ESC+i+e}function Ku(e,t){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=t;return i}var YI=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 RC(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var __=50,XI=15,ZI=50,JI=500,QI=" ",eB=new RegExp(QI,"g"),sy=class extends at{constructor(e,t,i,n,r,o,c,d,p){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=r,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ns,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),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 YI(this._bufferService),this._activeSelectionMode=0,this._register(ri(()=>{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 i=this._bufferService.buffer,n=[];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=i.translateBufferLineToString(c,!0,r,o);n.push(d)}}else{let r=e[1]===t[1]?t[0]:void 0;n.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let c=i.lines.get(o),d=i.translateBufferLineToString(o,!0);c?.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let o=i.lines.get(t[1]),c=i.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?n[n.length-1]+=c:n.push(c)}}return n.map(r=>r.replace(eB," ")).join(RT?`\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())),Bb&&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),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!t?!1:this._areCoordsInSelection(t,i,n)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([e,t],i,n)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=RC(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,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=Ib(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-__),__),t/=__,t/Math.abs(t)+Math.round(t*(XI-1)))}shouldForceSelection(e){return Ff?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(),ZI)}_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&&!(Ff&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let n=i.lines.get(this._model.selectionEnd[1]);n&&n.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<JI&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let n=FI(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let n=0;t>=n;n++){let r=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==n&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let c=r.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),p=d,f=e[0]-d,g=0,v=0,y=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],R=e[0];o.getWidth(k)===0&&(g++,k--),o.getWidth(R)===2&&(v++,R++);let O=o.getString(R).length;for(O>1&&(S+=O-1,p+=O-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,k--):I>1&&(y+=I-1,d-=I-1),d--,k--}for(;R<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(R+1,this._workCell));){o.loadCell(R+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,R++):I>1&&(S+=I-1,p+=I-1),p++,R++}}p++;let w=d+f-g+y,x=Math.min(this._bufferService.cols,p-d+g+v-y-S);if(!(!t&&c.slice(d,p).trim()==="")){if(i&&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 R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let O=this._bufferService.cols-R.start;w-=O,x+=O}}}if(n&&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 R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(x+=R.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=RC(i,this._bufferService.cols)}};sy=gi([Ee(3,En),Ee(4,Ao),Ee(5,Rb),Ee(6,Tn),Ee(7,qr),Ee(8,Gr)],sy);var NC=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},LC=class{constructor(){this._color=new NC,this._css=new NC}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Di=Object.freeze((()=>{let e=[li.toColor("#2e3436"),li.toColor("#cc0000"),li.toColor("#4e9a06"),li.toColor("#c4a000"),li.toColor("#3465a4"),li.toColor("#75507b"),li.toColor("#06989a"),li.toColor("#d3d7cf"),li.toColor("#555753"),li.toColor("#ef2929"),li.toColor("#8ae234"),li.toColor("#fce94f"),li.toColor("#729fcf"),li.toColor("#ad7fa8"),li.toColor("#34e2e2"),li.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=t[i/36%6|0],r=t[i/6%6|0],o=t[i%6];e.push({css:Ri.toCss(n,r,o),rgba:Ri.toRgba(n,r,o)})}for(let i=0;i<24;i++){let n=8+i*10;e.push({css:Ri.toCss(n,n,n),rgba:Ri.toRgba(n,n,n)})}return e})()),co=li.toColor("#ffffff"),bu=li.toColor("#000000"),MC=li.toColor("#ffffff"),OC=bu,tu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},tB=co,ry=class extends at{constructor(e){super(),this._optionsService=e,this._contrastCache=new LC,this._halfContrastCache=new LC,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:co,background:bu,cursor:MC,cursorAccent:OC,selectionForeground:void 0,selectionBackgroundTransparent:tu,selectionBackgroundOpaque:Xt.blend(bu,tu),selectionInactiveBackgroundTransparent:tu,selectionInactiveBackgroundOpaque:Xt.blend(bu,tu),scrollbarSliderBackground:Xt.opacity(co,.2),scrollbarSliderHoverBackground:Xt.opacity(co,.4),scrollbarSliderActiveBackground:Xt.opacity(co,.5),overviewRulerBorder:co,ansi:Di.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=zt(e.foreground,co),t.background=zt(e.background,bu),t.cursor=Xt.blend(t.background,zt(e.cursor,MC)),t.cursorAccent=Xt.blend(t.background,zt(e.cursorAccent,OC)),t.selectionBackgroundTransparent=zt(e.selectionBackground,tu),t.selectionBackgroundOpaque=Xt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=zt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Xt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?zt(e.selectionForeground,EC):void 0,t.selectionForeground===EC&&(t.selectionForeground=void 0),Xt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Xt.opacity(t.selectionBackgroundTransparent,.3)),Xt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Xt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=zt(e.scrollbarSliderBackground,Xt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=zt(e.scrollbarSliderHoverBackground,Xt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=zt(e.scrollbarSliderActiveBackground,Xt.opacity(t.foreground,.5)),t.overviewRulerBorder=zt(e.overviewRulerBorder,tB),t.ansi=Di.slice(),t.ansi[0]=zt(e.black,Di[0]),t.ansi[1]=zt(e.red,Di[1]),t.ansi[2]=zt(e.green,Di[2]),t.ansi[3]=zt(e.yellow,Di[3]),t.ansi[4]=zt(e.blue,Di[4]),t.ansi[5]=zt(e.magenta,Di[5]),t.ansi[6]=zt(e.cyan,Di[6]),t.ansi[7]=zt(e.white,Di[7]),t.ansi[8]=zt(e.brightBlack,Di[8]),t.ansi[9]=zt(e.brightRed,Di[9]),t.ansi[10]=zt(e.brightGreen,Di[10]),t.ansi[11]=zt(e.brightYellow,Di[11]),t.ansi[12]=zt(e.brightBlue,Di[12]),t.ansi[13]=zt(e.brightMagenta,Di[13]),t.ansi[14]=zt(e.brightCyan,Di[14]),t.ansi[15]=zt(e.brightWhite,Di[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<i;n++)t.ansi[n+16]=zt(e.extendedAnsi[n],Di[n+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()}}};ry=gi([Ee(0,Tn)],ry);function zt(e,t){if(e!==void 0)try{return li.toColor(e)}catch{}return t}var iB=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},nB=class{constructor(){this._services=new iB,this._services.set(Ab,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=X8(e).sort((o,c)=>o.index-c.index),n=[];for(let o of i){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);n.push(c)}let r=i.length>0?i[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,...n)}},sB={trace:0,debug:1,info:2,warn:3,error:4,off:5},rB="xterm.js: ",ay=class extends at{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=sB[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":rB)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};ay=gi([Ee(0,Tn)],ay);var DC=class extends at{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<i.length;n++)this._array[this._getCyclicIndex(e+n)]=i[n];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+i,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},rt=3,Ti=Object.freeze(new hh),$d=0,v_=2,Su=class DT{constructor(t,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*rt);let r=i||Ns.fromCharData([0,Q5,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let i=this._data[t*rt+0],n=i&2097151;return[this._data[t*rt+1],i&2097152?this._combined[t]:n?Aa(n):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,i){this._data[t*rt+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*rt+0]=t|2097152|i[2]<<22):this._data[t*rt+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*rt+0]>>22}hasWidth(t){return this._data[t*rt+0]&12582912}getFg(t){return this._data[t*rt+1]}getBg(t){return this._data[t*rt+2]}hasContent(t){return this._data[t*rt+0]&4194303}getCodePoint(t){let i=this._data[t*rt+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*rt+0]&2097152}getString(t){let i=this._data[t*rt+0];return i&2097152?this._combined[t]:i&2097151?Aa(i&2097151):""}isProtected(t){return this._data[t*rt+2]&536870912}loadCell(t,i){return $d=t*rt,i.content=this._data[$d+0],i.fg=this._data[$d+1],i.bg=this._data[$d+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*rt+0]=i.content,this._data[t*rt+1]=i.fg,this._data[t*rt+2]=i.bg}setCellFromCodepoint(t,i,n,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*rt+0]=i|n<<22,this._data[t*rt+1]=r.fg,this._data[t*rt+2]=r.bg}addCodepointToCell(t,i,n){let r=this._data[t*rt+0];r&2097152?this._combined[t]+=Aa(i):r&2097151?(this._combined[t]=Aa(r&2097151)+Aa(i),r&=-2097152,r|=2097152):r=i|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[t*rt+0]=r}insertCells(t,i,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length-t){let r=new Ns;for(let o=this.length-t-i-1;o>=0;--o)this.setCell(t+i+o,this.loadCell(t+o,r));for(let o=0;o<i;++o)this.setCell(t+o,n)}else for(let r=t;r<this.length;++r)this.setCell(r,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,i,n){if(t%=this.length,i<this.length-t){let r=new Ns;for(let o=0;o<this.length-t-i;++o)this.setCell(t+o,this.loadCell(t+i+o,r));for(let o=this.length-i;o<this.length;++o)this.setCell(o,n)}else for(let r=t;r<this.length;++r)this.setCell(r,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,i,n,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.setCell(t++,n)}resize(t,i){if(t===this.length)return this._data.length*4*v_<this._data.buffer.byteLength;let n=t*rt;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let r=new Uint32Array(n);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,n);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,n*4*v_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*v_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,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 i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new DT(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*rt+0]&4194303)return t+(this._data[t*rt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*rt+0]&4194303||this._data[t*rt+2]&50331648)return t+(this._data[t*rt+0]>>22);return 0}copyCellsFrom(t,i,n,r,o){let c=t._data;if(o)for(let p=r-1;p>=0;p--){for(let f=0;f<rt;f++)this._data[(n+p)*rt+f]=c[(i+p)*rt+f];c[(i+p)*rt+2]&268435456&&(this._extendedAttrs[n+p]=t._extendedAttrs[i+p])}else for(let p=0;p<r;p++){for(let f=0;f<rt;f++)this._data[(n+p)*rt+f]=c[(i+p)*rt+f];c[(i+p)*rt+2]&268435456&&(this._extendedAttrs[n+p]=t._extendedAttrs[i+p])}let d=Object.keys(t._combined);for(let p=0;p<d.length;p++){let f=parseInt(d[p],10);f>=i&&(this._combined[f-i+n]=t._combined[f])}}translateToString(t,i,n,r){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;i<n;){let c=this._data[i*rt+0],d=c&2097151,p=c&2097152?this._combined[i]:d?Aa(d):La;if(o+=p,r)for(let f=0;f<p.length;++f)r.push(i);i+=c>>22||1}return r&&r.push(i),o}};function aB(e,t,i,n,r,o){let c=[];for(let d=0;d<e.length-1;d++){let p=d,f=e.get(++p);if(!f.isWrapped)continue;let g=[e.get(d)];for(;p<e.length&&f.isWrapped;)g.push(f),f=e.get(++p);if(!o&&n>=d&&n<p){d+=g.length-1;continue}let v=0,y=Vu(g,v,t),S=1,w=0;for(;S<g.length;){let k=Vu(g,S,t),R=k-w,O=i-y,I=Math.min(R,O);g[v].copyCellsFrom(g[S],w,y,I,!1),y+=I,y===i&&(v++,y=0),w+=I,w===k&&(S++,w=0),y===0&&v!==0&&g[v-1].getWidth(i-1)===2&&(g[v].copyCellsFrom(g[v-1],i-1,y++,1,!1),g[v-1].setCell(i-1,r))}g[v].replaceCells(y,i,r);let x=0;for(let k=g.length-1;k>0&&(k>v||g[k].getTrimmedLength()===0);k--)x++;x>0&&(c.push(d+g.length-x),c.push(x)),d+=g.length-1}return c}function oB(e,t){let i=[],n=0,r=t[n],o=0;for(let c=0;c<e.length;c++)if(r===c){let d=t[++n];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,r=t[++n]}else i.push(c);return{layout:i,countRemoved:o}}function lB(e,t){let i=[];for(let n=0;n<t.length;n++)i.push(e.get(t[n]));for(let n=0;n<i.length;n++)e.set(n,i[n]);e.length=t.length}function cB(e,t,i){let n=[],r=e.map((p,f)=>Vu(e,f,t)).reduce((p,f)=>p+f),o=0,c=0,d=0;for(;d<r;){if(r-d<i){n.push(r-d);break}o+=i;let p=Vu(e,c,t);o>p&&(o-=p,c++);let f=e[c].getWidth(o-1)===2;f&&o--;let g=f?i-1:i;n.push(g),d+=g}return n}function Vu(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return n&&r?i-1:i}var jT=class IT{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=IT._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Co(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};jT._nextId=1;var uB=jT,Bi={},uo=Bi.B;Bi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Bi.A={"#":"£"};Bi.B=void 0;Bi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Bi.C=Bi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Bi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Bi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Bi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Bi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Bi.E=Bi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Bi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Bi.H=Bi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Bi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var jC=4294967295,IC=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ti.clone(),this.savedCharset=uo,this.markers=[],this._nullCell=Ns.fromCharData([0,Q5,1,0]),this._whitespaceCell=Ns.fromCharData([0,La,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Uf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new DC(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 zf),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 zf),this._whitespaceCell}getBlankLine(e,t){return new Su(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>jC?jC:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ti);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 DC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Ti),n=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++)n+=+this.lines.get(c).resize(e,i);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 Su(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Su(e,i)));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++)n+=+this.lines.get(o).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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 i=this._optionsService.rawOptions.reflowCursorLine,n=aB(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ti),i);if(n.length>0){let r=oB(this.lines,n);lB(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let n=this.getNullCell(Ti),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Su(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(Ti),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(!i){let I=this.ybase+this.y;if(I>=c&&I<c+p.length)continue}let f=p[p.length-1].getTrimmedLength(),g=cB(p,this._cols,e),v=g.length-p.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+v):y=Math.max(0,this.lines.length-this.lines.maxLength+v);let S=[];for(let I=0;I<v;I++){let A=this.getBlankLine(Ti,!0);S.push(A)}S.length>0&&(r.push({start:c+p.length+o,newLines:S}),o+=S.length),p.push(...S);let w=g.length-1,x=g[w];x===0&&(w--,x=g[w]);let k=p.length-v-1,R=f;for(;k>=0;){let I=Math.min(R,x);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[k],R-I,x-I,I,!0),x-=I,x===0&&(w--,x=g[w]),R-=I,R===0){k--;let A=Math.max(k,0);R=Vu(p,A,this._cols)}}for(let I=0;I<p.length;I++)g[I]<e&&p[I].setCell(g[I],n);let O=v-y;for(;O-- >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+v,this.ybase+t-1)}if(r.length>0){let c=[],d=[];for(let x=0;x<this.lines.length;x++)d.push(this.lines.get(x));let p=this.lines.length,f=p-1,g=0,v=r[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let y=0;for(let x=Math.min(this.lines.maxLength-1,p+o-1);x>=0;x--)if(v&&v.start>f+y){for(let k=v.newLines.length-1;k>=0;k--)this.lines.set(x--,v.newLines[k]);x++,c.push({index:f+1,amount:v.newLines.length}),y+=v.newLines.length,v=r[++g]}else this.lines.set(x,d[f--]);let S=0;for(let x=c.length-1;x>=0;x--)c[x].index+=S,this.lines.onInsertEmitter.fire(c[x]),S+=c[x].amount;let w=Math.max(0,p+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,i=0,n){let r=this.lines.get(e);return r?r.translateToString(t,i,n):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 uB(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},hB=class extends at{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 IC(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new IC(!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)}},BT=2,PT=1,oy=class extends at{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,BT),this.rows=Math.max(e.rawOptions.rows||0,PT),this.buffers=this._register(new hB(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=i.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let r=i.ybase+i.scrollTop,o=i.ybase+i.scrollBottom;if(i.scrollTop===0){let c=i.lines.isFull;o===i.lines.length-1?c?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(o+1,0,n.clone()),c?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let c=o-r+1;i.lines.shiftElements(r+1,c-1,-1),i.lines.set(o,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};oy=gi([Ee(0,Tn)],oy);var fl={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:Ff,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},dB=["normal","bold","100","200","300","400","500","600","700","800","900"],fB=class extends at{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...fl};for(let i in e)if(i in t)try{let n=e[i];t[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ri(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in fl))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in fl))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=fl[e]),!pB(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=fl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=dB.includes(t)?t:fl[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 pB(e){return e==="block"||e==="underline"||e==="bar"}function wu(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let n in e)i[n]=t<=1?e[n]:e[n]&&wu(e[n],t-1);return i}var BC=Object.freeze({insertMode:!1}),PC=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ly=class extends at{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=wu(BC),this.decPrivateModes=wu(PC)}reset(){this.modes=wu(BC),this.decPrivateModes=wu(PC)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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))}};ly=gi([Ee(0,En),Ee(1,sT),Ee(2,Tn)],ly);var zC={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 y_(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var b_=String.fromCharCode,$C={DEFAULT:e=>{let t=[y_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${b_(t[0])}${b_(t[1])}${b_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${y_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${y_(e,!0)};${e.x};${e.y}${t}`}},cy=class extends at{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new be),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(zC))this.addProtocol(n,zC[n]);for(let n of Object.keys($C))this.addEncoding(n,$C[n]);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,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let n=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=n+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,i){if(i){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)}};cy=gi([Ee(0,En),Ee(1,Ao),Ee(2,Tn)],cy);var S_=[[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]],mB=[[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]],ji;function gB(e,t){let i=0,n=t.length-1,r;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(r=i+n>>1,e>t[r][1])i=r+1;else if(e<t[r][0])n=r-1;else return!0;return!1}var _B=class{constructor(){if(this.version="6",!ji){ji=new Uint8Array(65536),ji.fill(1),ji[0]=0,ji.fill(0,1,32),ji.fill(0,127,160),ji.fill(2,4352,4448),ji[9001]=2,ji[9002]=2,ji.fill(2,11904,42192),ji[12351]=1,ji.fill(2,44032,55204),ji.fill(2,63744,64256),ji.fill(2,65040,65050),ji.fill(2,65072,65136),ji.fill(2,65280,65377),ji.fill(2,65504,65511);for(let e=0;e<S_.length;++e)ji.fill(0,S_[e][0],S_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ji[e]:gB(e,mB)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let r=fo.extractWidth(t);r===0?n=!1:r>i&&(i=r)}return fo.createPropertyValue(0,i,n)}},fo=class yf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new _B;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,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?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 i=0,n=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 i+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:i+=this.wcwidth(f)}let d=this.charProperties(c,n),p=yf.extractWidth(d);yf.extractShouldJoin(d)&&(p-=yf.extractWidth(n)),i+=p,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},vB=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 HC(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var iu=2147483647,yB=256,zT=class uy{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>yB)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new uy;if(!t.length)return i;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let r=t[n];if(Array.isArray(r))for(let o=0;o<r.length;++o)i.addSubParam(r[o]);else i.addParam(r)}return i}clone(){let t=new uy(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 i=0;i<this.length;++i){t.push(this.params[i]);let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,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>iu?iu: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>iu?iu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&(t[i]=this._subParams.slice(n,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(r*10+t,iu):t}},nu=[],bB=class{constructor(){this._state=0,this._active=nu,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=nu}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=nu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||nu,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",_p(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].end(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=nu,this._id=-1,this._state=0}}},ss=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,i,n){this._hitLimit||(this._data+=_p(t,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let i=!1;if(this._hitLimit)i=!1;else if(t&&(i=this._handler(this._data),i instanceof Promise))return i.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,i}},su=[],SB=class{constructor(){this._handlers=Object.create(null),this._active=su,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=su}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=su,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||su,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",_p(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=su,this._ident=0}},xu=new zT;xu.addParam(0);var FC=class{constructor(e){this._handler=e,this._data="",this._params=xu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():xu,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=_p(e,t,i),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(i=>(this._params=xu,this._data="",this._hitLimit=!1,i));return this._params=xu,this._data="",this._hitLimit=!1,t}},wB=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,n){this.table[t<<8|e]=i<<4|n}addMany(e,t,i,n){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|n}},As=160,xB=(function(){let e=new wB(4095),t=Array.apply(null,Array(256)).map((d,p)=>p),i=(d,p)=>t.slice(d,p),n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let o=i(0,14),c;e.setDefault(1,0),e.addMany(n,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(i(128,144),c,3,0),e.addMany(i(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(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,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(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(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(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(As,0,2,0),e.add(As,8,5,8),e.add(As,6,0,6),e.add(As,11,0,11),e.add(As,13,13,13),e})(),CB=class extends at{constructor(e=xB){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 zT,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},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(ri(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new bB),this._dcsParser=this._register(new SB),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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");i<<=8,i|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=n,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.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,i,n,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=r}parse(e,t,i){let n=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(i===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(i===!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(i===!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(n=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(n!==24&&n!==26,i),c)return c;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],c=this._oscParser.end(n!==24&&n!==26,i),c)return c;n===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(n=e[d],r=this._transitions.table[this.currentState<<8|(n<160?n:As)],r>>4){case 2:for(let y=d+1;;++y){if(y>=t||(n=e[y])<32||n>126&&n<As){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<As){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<As){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<As){this._printHandler(e,d,y),d=y-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|n],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|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let g=this._escHandlers[this._collect<<8|n],v=g?g.length-1:-1;for(;v>=0&&(c=g[v](),c!==!0);v--)if(c instanceof Promise)return this._preserveStack(4,g,v,r,d),c;v<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let y=d+1;;++y)if(y>=t||(n=e[y])===24||n===26||n===27||n>127&&n<As){this._dcsParser.put(e,d,y),d=y-1;break}break;case 14:if(c=this._dcsParser.unhook(n!==24&&n!==26),c)return this._preserveStack(6,[],0,r,d),c;n===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 y=d+1;;y++)if(y>=t||(n=e[y])<32||n>127&&n<As){this._oscParser.put(e,d,y),d=y-1;break}break;case 6:if(c=this._oscParser.end(n!==24&&n!==26),c)return this._preserveStack(5,[],0,r,d),c;n===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},kB=/^([\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})$/,EB=/^[\da-f]+$/;function UC(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=kB.exec(t);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),EB.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(i*r,i*r+i),16);n[r]=i===1?o<<4:i===2?o:i===3?o>>4:o>>8}return n}}function w_(e,t){let i=e.toString(16),n=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function TB(e,t=16){let[i,n,r]=e;return`rgb:${w_(i,t)}/${w_(n,t)}/${w_(r,t)}`}var AB={"(":0,")":1,"*":2,"+":3,"-":1,".":2},wa=131072,WC=10;function GC(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 qC=5e3,KC=0,RB=class extends at{constructor(e,t,i,n,r,o,c,d,p=new CB){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=n,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new V8,this._utf8Decoder=new Y8,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ti.clone(),this._eraseAttrDataInternal=Ti.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 hy(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:g.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,g,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:g,data:v})}),this._parser.setDcsHandlerFallback((f,g,v)=>{g==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:g,payload:v})}),this._parser.setPrintHandler((f,g,v)=>this.print(f,g,v)),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(pe.BEL,()=>this.bell()),this._parser.setExecuteHandler(pe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(pe.BS,()=>this.backspace()),this._parser.setExecuteHandler(pe.HT,()=>this.tab()),this._parser.setExecuteHandler(pe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(pe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_f.IND,()=>this.index()),this._parser.setExecuteHandler(_f.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_f.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ss(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new ss(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new ss(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new ss(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new ss(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new ss(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new ss(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new ss(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new ss(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new ss(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new ss(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new ss(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 Bi)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 FC((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),qC))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${qC} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,r=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>wa&&(o=this._parseStack.position+wa)}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<wa&&(this._parseBuffer=new Uint32Array(Math.min(e.length,wa))),c||this._dirtyRowTracker.clearRange(),e.length>wa)for(let f=o;f<e.length;f+=wa){let g=f+wa<e.length?f+wa:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(f,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,g),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,v))return this._preserveStack(n,r,v,f),this._logSlowResolvingAsync(i),i}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,f))return this._preserveStack(n,r,f,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||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,i){let n,r,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let y=this._parser.precedingJoinState;for(let S=t;S<i;++S){if(n=e[S],n<127&&o){let R=o[String.fromCharCode(n)];R&&(n=R.charCodeAt(0))}let w=this._unicodeService.charProperties(n,y);r=fo.extractWidth(w);let x=fo.extractShouldJoin(w),k=x?fo.extractWidth(y):0;if(y=w,c&&this._onA11yChar.fire(Aa(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-k>d){if(p){let R=v,O=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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&v instanceof Su&&v.copyCellsFrom(R,O,0,k,!1);O<d;)R.setCellFromCodepoint(O++,0,1,g)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let R=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-R,n,r);for(let O=r-k;--O>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(v.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(g)),v.getWidth(d-1)===2&&v.setCellFromCodepoint(d-1,0,1,g)),v.setCellFromCodepoint(this._activeBuffer.x++,n,r,g),r>0)for(;--r;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=y,this._activeBuffer.x<d&&i-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>GC(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new FC(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ss(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,i,n=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),n&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,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 i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(r-1,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}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 i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(i,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}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(Ti));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=e.params[0]||1,n=fo.extractWidth(t),r=this._activeBuffer.x-n,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),c=new Uint32Array(o.length*i),d=0;for(let f=0;f<o.length;){let g=o.codePointAt(f)||0;c[d++]=g,f+=g>65535?2:1}let p=d;for(let f=1;f<i;++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(pe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(pe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(pe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(pe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(pe.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,uo),this._charsetService.setgCharset(1,uo),this._charsetService.setgCharset(2,uo),this._charsetService.setgCharset(3,uo);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 i;(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"))(i||={});let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:p}=this._bufferService,{active:f,alt:g}=d,v=this._optionsService.rawOptions,y=(x,k)=>(c.triggerDataEvent(`${pe.ESC}[${t?"":"?"}${x};${k}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?y(w,4):w===4?y(w,S(c.modes.insertMode)):w===12?y(w,3):w===20?y(w,S(v.convertEol)):y(w,0):w===1?y(w,S(n.applicationCursorKeys)):w===3?y(w,v.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?y(w,S(n.origin)):w===7?y(w,S(n.wraparound)):w===8?y(w,3):w===9?y(w,S(r==="X10")):w===12?y(w,S(v.cursorBlink)):w===25?y(w,S(!c.isCursorHidden)):w===45?y(w,S(n.reverseWraparound)):w===66?y(w,S(n.applicationKeypad)):w===67?y(w,4):w===1e3?y(w,S(r==="VT200")):w===1002?y(w,S(r==="DRAG")):w===1003?y(w,S(r==="ANY")):w===1004?y(w,S(n.sendFocus)):w===1005?y(w,4):w===1006?y(w,S(o==="SGR")):w===1015?y(w,4):w===1016?y(w,S(o==="SGR_PIXELS")):w===1048?y(w,1):w===47||w===1047||w===1049?y(w,S(f===g)):w===2004?y(w,S(n.bracketedPasteMode)):w===2026?y(w,S(n.synchronizedOutput)):y(w,0)}_updateAttrColor(e,t,i,n,r){return t===2?(e|=50331648,e&=-16777216,e|=hh.fromColorRGB([i,n,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let n=[0,0,-1,0,0,0],r=0,o=0;do{if(n[o+r]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do n[1]===5&&(r=1),n[o+d+1+r]=c[d];while(++d<c.length&&d+o+1+r<n.length);break}if(n[1]===5&&o+r>=2||n[1]===2&&o+r>=5)break;n[1]&&(r=1)}while(++o+t<e.length&&o+r<n.length);for(let c=2;c<n.length;++c)n[c]===-1&&(n[c]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[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=Ti.fg,e.bg=Ti.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,i,n=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=Ti.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=Ti.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=Ti.fg&16777215,n.bg&=-67108864,n.bg|=Ti.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${pe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[?${t};${i}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=Ti.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!GC(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(`${pe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>WC&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>WC&&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=[],i=e.split(";");for(;i.length>1;){let n=i.shift(),r=i.shift();if(/^\d+$/.exec(n)){let o=parseInt(n);if(VC(o))if(r==="?")t.push({type:0,index:o});else{let c=UC(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 i=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),n,r=i.findIndex(o=>o.startsWith("id="));return r!==-1&&(n=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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 i=e.split(";");for(let n=0;n<i.length&&!(t>=this._specialColors.length);++n,++t)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=UC(i[n]);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=[],i=e.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let r=parseInt(i[n]);VC(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,uo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(AB[e[0]],Bi[e[1]]||uo),!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=Ti.clone(),this._eraseAttrDataInternal=Ti.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 Ns;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 i=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(i);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=c=>(this._coreService.triggerDataEvent(`${pe.ESC}${c}${pe.ESC}\\`),!0),n=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.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)}},hy=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&&(KC=e,e=t,t=KC),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};hy=gi([Ee(0,En)],hy);function VC(e){return 0<=e&&e<256}var NB=5e7,YC=12,LB=50,MB=class extends at{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 be),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>NB)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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],r=this._action(n,t);if(r){let c=d=>performance.now()-i>=YC?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(i,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-=n.length,performance.now()-i>=YC)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>LB&&(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()}},dy=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 i=e,n=this._getEntryIdKey(i),r=this._entriesWithId.get(n);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(i),data:i,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 i=this._dataByLinkId.get(e);if(i&&i.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};dy=gi([Ee(0,En)],dy);var XC=!1,OB=class extends at{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pl),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new nB,this.optionsService=this._register(new fB(e)),this._instantiationService.setService(Tn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(oy)),this._instantiationService.setService(En,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ay)),this._instantiationService.setService(sT,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ly)),this._instantiationService.setService(Ao,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(cy)),this._instantiationService.setService(nT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fo)),this._instantiationService.setService(Q8,this.unicodeService),this._charsetService=this._instantiationService.createInstance(vB),this._instantiationService.setService(J8,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(dy),this._instantiationService.setService(rT,this._oscLinkService),this._inputHandler=this._register(new RB(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(rn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(rn.forward(this._bufferService.onResize,this._onResize)),this._register(rn.forward(this.coreService.onData,this._onData)),this._register(rn.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 MB((t,i)=>this._inputHandler.parse(t,i))),this._register(rn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),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&&!XC&&(this._logService.warn("writeSync is unreliable and will be removed soon."),XC=!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,BT),t=Math.max(t,PT),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(HC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(HC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ri(()=>{for(let t of e)t.dispose()})}}},DB={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 jB(e,t,i,n){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=pe.ESC+"OA":r.key=pe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=pe.ESC+"OD":r.key=pe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=pe.ESC+"OC":r.key=pe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=pe.ESC+"OB":r.key=pe.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":pe.DEL,e.altKey&&(r.key=pe.ESC+r.key);break;case 9:if(e.shiftKey){r.key=pe.ESC+"[Z";break}r.key=pe.HT,r.cancel=!0;break;case 13:r.key=e.altKey?pe.ESC+pe.CR:pe.CR,r.cancel=!0;break;case 27:r.key=pe.ESC,e.altKey&&(r.key=pe.ESC+pe.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=pe.ESC+"[1;"+(o+1)+"D":t?r.key=pe.ESC+"OD":r.key=pe.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=pe.ESC+"[1;"+(o+1)+"C":t?r.key=pe.ESC+"OC":r.key=pe.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=pe.ESC+"[1;"+(o+1)+"A":t?r.key=pe.ESC+"OA":r.key=pe.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=pe.ESC+"[1;"+(o+1)+"B":t?r.key=pe.ESC+"OB":r.key=pe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=pe.ESC+"[2~");break;case 46:o?r.key=pe.ESC+"[3;"+(o+1)+"~":r.key=pe.ESC+"[3~";break;case 36:o?r.key=pe.ESC+"[1;"+(o+1)+"H":t?r.key=pe.ESC+"OH":r.key=pe.ESC+"[H";break;case 35:o?r.key=pe.ESC+"[1;"+(o+1)+"F":t?r.key=pe.ESC+"OF":r.key=pe.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=pe.ESC+"[5;"+(o+1)+"~":r.key=pe.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=pe.ESC+"[6;"+(o+1)+"~":r.key=pe.ESC+"[6~";break;case 112:o?r.key=pe.ESC+"[1;"+(o+1)+"P":r.key=pe.ESC+"OP";break;case 113:o?r.key=pe.ESC+"[1;"+(o+1)+"Q":r.key=pe.ESC+"OQ";break;case 114:o?r.key=pe.ESC+"[1;"+(o+1)+"R":r.key=pe.ESC+"OR";break;case 115:o?r.key=pe.ESC+"[1;"+(o+1)+"S":r.key=pe.ESC+"OS";break;case 116:o?r.key=pe.ESC+"[15;"+(o+1)+"~":r.key=pe.ESC+"[15~";break;case 117:o?r.key=pe.ESC+"[17;"+(o+1)+"~":r.key=pe.ESC+"[17~";break;case 118:o?r.key=pe.ESC+"[18;"+(o+1)+"~":r.key=pe.ESC+"[18~";break;case 119:o?r.key=pe.ESC+"[19;"+(o+1)+"~":r.key=pe.ESC+"[19~";break;case 120:o?r.key=pe.ESC+"[20;"+(o+1)+"~":r.key=pe.ESC+"[20~";break;case 121:o?r.key=pe.ESC+"[21;"+(o+1)+"~":r.key=pe.ESC+"[21~";break;case 122:o?r.key=pe.ESC+"[23;"+(o+1)+"~":r.key=pe.ESC+"[23~";break;case 123:o?r.key=pe.ESC+"[24;"+(o+1)+"~":r.key=pe.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=pe.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=pe.DEL:e.keyCode===219?r.key=pe.ESC:e.keyCode===220?r.key=pe.FS:e.keyCode===221&&(r.key=pe.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let c=DB[e.keyCode]?.[e.shiftKey?1:0];if(c)r.key=pe.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=pe.ESC+p}else if(e.keyCode===32)r.key=pe.ESC+(e.ctrlKey?pe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),r.key=pe.ESC+d,r.cancel=!0}}else i&&!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=pe.US),e.key==="@"&&(r.key=pe.NUL));break}return r}var bi=0,IB=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Uf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Uf,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,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<n.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(n[r]=e[t],t++):n[r]=this._array[i++];this._array=n,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||(bi=this._search(t),bi===-1)||this._getKey(this._array[bi])!==t)return!1;do if(this._array[bi]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(bi),!0;while(++bi<this._array.length&&this._getKey(this._array[bi])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,i=new Array(this._array.length-e.length),n=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[n++]=this._array[r];this._array=i,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&&(bi=this._search(e),!(bi<0||bi>=this._array.length)&&this._getKey(this._array[bi])===e))do yield this._array[bi];while(++bi<this._array.length&&this._getKey(this._array[bi])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(bi=this._search(e),!(bi<0||bi>=this._array.length)&&this._getKey(this._array[bi])===e))do t(this._array[bi]);while(++bi<this._array.length&&this._getKey(this._array[bi])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let n=t+i>>1,r=this._getKey(this._array[n]);if(r>e)i=n-1;else if(r<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},x_=0,ZC=0,BB=class extends at{constructor(){super(),this._decorations=new IB(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ri(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new PB(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let n=0,r=0;for(let o of this._decorations.getKeyIterator(t))n=o.options.x??0,r=n+(o.options.width??1),e>=n&&e<r&&(!i||(o.options.layer??"bottom")===i)&&(yield o)}forEachDecorationAtCell(e,t,i,n){this._decorations.forEachByKey(t,r=>{x_=r.options.x??0,ZC=x_+(r.options.width??1),e>=x_&&e<ZC&&(!i||(r.options.layer??"bottom")===i)&&n(r)})}},PB=class extends Da{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=li.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=li.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},zB=1e3,$B=class{constructor(e,t=zB){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,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 n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=n-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)}},JC=20,Wf=class extends at{constructor(e,t,i,n){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=n,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 $B(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(Ke(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ri(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<JC+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===JC+1&&(this._liveRegion.textContent+=Mv.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 i=this._terminal.buffer,n=i.lines.length.toString();for(let r=e;r<=t;r++){let o=i.lines.get(i.ydisp+r),c=[],d=o?.translateToString(!0,void 0,void 0,c)||"",p=(i.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",n),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==n)return;let c,d;if(t===0?(c=i,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=i,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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:d,offset:p})=>{let f=d instanceof Text?d.parentNode:d,g=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(f);if(!v)return console.warn("columns is null. Race condition?"),null;let y=p<v.length?v[p]:v.slice(-1)[0]+1;return y>=this._terminal.cols&&(++g,y=0),{row:g,column:y}},o=r(t),c=r(i);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,i=this._rowColumns.get(e)?.slice(-1)?.[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};Wf=gi([Ee(1,Ab),Ee(2,Gr),Ee(3,qr)],Wf);var fy=class extends at{constructor(e,t,i,n,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=n,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ri(()=>{Co(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(Ke(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ke(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ke(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ke(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 i=e.composedPath();for(let n=0;n<i.length;n++){let r=i[n];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(n=>{n?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let c=o?.map(d=>({link:d}));this._activeProviderReplies?.set(n,c),i=this._checkLinkProviderResult(n,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let n=0;n<t.size;n++){let r=t.get(n);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(i.has(f)){r.splice(o--,1);break}i.add(f)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let n=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&&n){let o=n.find(c=>this._linkAtPosition(c.link,t));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let c=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(c){i=!0,this._handleNewLink(c);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&HB(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,Co(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:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(n,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,i){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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,n=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=n}_positionFromMouseEvent(e,t,i){let n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,n,r){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:r}}};fy=gi([Ee(1,Rb),Ee(2,qr),Ee(3,En),Ee(4,oT)],fy);function HB(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 FB=class extends OB{constructor(e={}){super(e),this._linkifier=this._register(new Pl),this.browser=ET,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pl),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(BB),this._instantiationService.setService(dh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(LI),this._instantiationService.setService(oT,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Dv)),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(rn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(rn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(rn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(rn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ri(()=>{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 i,n="";switch(t.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+t.index}switch(t.type){case 0:let r=Xt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${pe.ESC}]${n};${TB(r)}${CT.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Ri.toColor(...t.color));else{let o=i;this._themeService.modifyColors(c=>c[o]=Ri.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(Wf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(pe.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(pe.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 i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),o=this._renderService.dimensions.css.cell.width*r,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=i*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=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ke(this.element,"copy",t=>{this.hasSelection()&&q8(t,this._selectionService)}));let e=t=>K8(t,this.textarea,this.coreService,this.optionsService);this._register(Ke(this.textarea,"paste",e)),this._register(Ke(this.element,"paste",e)),TT?this._register(Ke(this.element,"mousedown",t=>{t.button===2&&lC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ke(this.element,"contextmenu",t=>{lC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Bb&&this._register(Ke(this.element,"auxclick",t=>{t.button===1&&J5(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ke(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ke(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ke(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ke(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ke(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ke(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ke(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(Ke(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 i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Lv.get()),NT||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(RI,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Gr,this._coreBrowserService),this._register(Ke(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(Ke(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ty,this._document,this._helperContainer),this._instantiationService.setService(vp,this._charSizeService),this._themeService=this._instantiationService.createInstance(ry),this._instantiationService.setService(Xl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hf),this._instantiationService.setService(aT,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ny,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(Jv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(iy),this._instantiationService.setService(Rb,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(fy,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(Xv,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(sy,this.element,this.screenElement,n)),this._instantiationService.setService(t7,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(rn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Zv,this.screenElement)),this._register(Ke(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(Wf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($f,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($f,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ey,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(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 n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(i(o),o.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(o)),wheel:o=>(i(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&i(o)},mousemove:o=>{o.buttons||i(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?n.mousemove||(t.addEventListener("mousemove",r.mousemove),n.mousemove=r.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),o&16?n.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),n.wheel=r.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),o&2?n.mouseup||(n.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),o&4?n.mousedrag||(n.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ke(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return i(o),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(o)})),this._register(Ke(t,"wheel",o=>{if(!n.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=pe.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){Z5(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,i){this._selectionService.setSelection(e,t,i)}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 i=jB(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===pe.ETX||i.key===pe.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(UB(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(Ti));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(pe.ESC+"[I"):this.coreService.triggerDataEvent(pe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[4;${i};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function UB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var WB=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;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)}},GB=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 Ns)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},QC=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 GB(t)}getNullCell(){return new Ns}},qB=class extends at{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new QC(this._core.buffers.normal,"normal"),this._alternate=new QC(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)}},KB=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,n)=>t(i,n.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)}},VB=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}},YB=["cols","rows"],tr=0,XB=class extends at{constructor(e){super(),this._core=this._register(new FB(e)),this._addonManager=this._register(new WB),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],i=(n,r)=>{this._checkReadonlyOptions(n),this._core.options[n]=r};for(let n in this._core.options){let r={get:t.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,r)}}_checkReadonlyOptions(e){if(YB.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 KB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new VB(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 qB(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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 Lv.get()},set promptLabel(e){Lv.set(e)},get tooMuchOutput(){return Mv.get()},set tooMuchOutput(e){Mv.set(e)}}}_verifyIntegers(...e){for(tr of e)if(tr===1/0||isNaN(tr)||tr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(tr of e)if(tr&&(tr===1/0||isNaN(tr)||tr%1!==0||tr<0))throw new Error("This API only accepts positive integers")}};function ZB(e){let t=!1,i=!1,n=!1,r=!1,o=null,c=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),n=!1},p=()=>{c!==null&&(clearTimeout(c),c=null),i=!1},f=()=>{p(),i=!0,c=setTimeout(()=>{c=null,i=!1},0)},g=()=>{n=!1,o!==null&&clearTimeout(o),c!==null&&(clearTimeout(c),c=null),o=setTimeout(()=>{o=null,i=!1,e()},0)},v=()=>{t=!1,o===null&&(p(),n=!1)},y=()=>{t=!1,r=!1,p(),d()},S=w=>{if(o===null){if(t||i||QB(w)){n=!0,i&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),n&&g()},onCompositionCancel:v,handleKeyEvent(w){return JB(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:y}}function JB(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function QB(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function e9({terminal:e,selectionTarget:t,windowTarget:i,clipboard:n}){let r=!1,o=!1,c=!1;const d=()=>{o=!1,c=!1},p=y=>{e2(y)&&(o=!0,c=!1)},f=()=>{o&&(c=!0)},g=y=>{const S=o&&c&&e2(y);if(d(),!S)return;const w=e.getSelection();if(!(!w||!n))try{n.writeText(w).catch(()=>{})}catch{}},v=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),i.addEventListener("mouseup",g),i.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),v.dispose(),t.removeEventListener("mousedown",p,!0),i.removeEventListener("mouseup",g),i.removeEventListener("blur",d))}}}function e2(e){return e.button===0}function t9(e,t){return{activate(i,n){try{const r=new URL(n);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const i9={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:t9((e,t,i)=>window.open(e,t,i),e=>window.confirm(`Do you want to navigate to ${e}?
|
|
96
|
+
|
|
97
|
+
WARNING: This link could potentially be dangerous`)),lineHeight:1},n9="Symbols Nerd Font Mono",Hd=`ui-monospace, "SF Mono", Menlo, "${n9}", monospace`,Pb=14,$T=10,HT=22,s9={min:$T,max:HT},r9="cascadia",Yu=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Hd}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Hd}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Hd}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Hd}`,meta:"Variable · Adobe mono"}],Ol=Yu[0];function a9(e){return Yu.find(t=>t.id===e)??Ol}function Xu(){return{source:"curated",id:r9,customName:"",family:Ol.family,size:Pb}}function zb(e,t){const i=a9(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:Fb(t)}}function $b(e,t){const i=c9(e);return{source:"custom",id:null,customName:i,family:Lf(i,Ol.family),size:Fb(t)}}function FT(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=Fb(typeof t.size=="number"?t.size:Pb);return t.source==="custom"&&typeof t.customName=="string"?$b(t.customName,i):typeof t.id=="string"&&l9(t.id)?zb(t.id,i):null}function Hb(e){if(!e)return Xu();try{const t=FT(JSON.parse(e));if(t!==null)return t}catch{}return Xu()}function o9(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function Fb(e){return Number.isFinite(e)?Math.min(HT,Math.max($T,Math.round(e))):Pb}function l9(e){return Yu.some(t=>t.id===e)}function c9(e){return dp(e)}const Gf="fleet-plugin.terminal.renderer",Dl="fleet-plugin.terminal.font",t2="fleet-console.terminalRenderer",i2="fleet-console.terminalFont",py=new Set;let ja=w9(),Zu=null,bo=0;function u9(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Gf)!==null||window.localStorage.getItem(Dl)!==null)return;const e=window.localStorage.getItem(t2),t=window.localStorage.getItem(i2),i=e==="webgl"||e==="dom"?e:"webgl",n=Hb(t);window.localStorage.setItem(Gf,i),window.localStorage.setItem(Dl,o9(n)),window.localStorage.removeItem(t2),window.localStorage.removeItem(i2)}catch{}}function h9(e){bo+=1,Zu=e,g9()}function UT(){return b.useSyncExternalStore(S9,n2,n2)}function d9(e){y9(e),zl({renderer:e})}function f9(e){const t=zb(e,ja.font.size);bo+=1,zl({font:t}),Sp(t)}function p9(e){const t=$b(e,ja.font.size);bo+=1,zl({font:t}),Sp(t)}function m9(e){const t=ja.font.source==="custom"?$b(ja.font.customName,e):zb(ja.font.id,e);bo+=1,zl({font:t}),Sp(t)}async function g9(){if(!Zu)return;const e=bo;try{const t=await Zu.read("terminal");if(t!==null){const i=FT(t.font);if(i!==null){if(e!==bo)return;zl({font:i});try{window.localStorage.removeItem(Dl)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(Dl)}catch{}if(i!==null){const n=Hb(i);if(e!==bo)return;zl({font:n}),Sp(n);try{window.localStorage.removeItem(Dl)}catch{}}}}catch{}}async function Sp(e){if(Zu)try{await Zu.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function _9(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Gf);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function v9(){if(typeof window>"u")return Xu();try{return Hb(window.localStorage.getItem(Dl))}catch{return Xu()}}function y9(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Gf,e)}catch{}}function b9(){for(const e of py)e()}function zl(e){ja={...ja,...e},b9()}function S9(e){return py.add(e),()=>{py.delete(e)}}function n2(){return ja}function w9(){return typeof window>"u"?{renderer:"webgl",font:Xu()}:(u9(),{renderer:_9(),font:v9()})}function s2({baseY:e,viewportY:t}){return t>=e}function x9(e){let t=!0,i=null,n=null;const r=()=>{const{baseY:f,viewportY:g}=e.getViewport();i=Math.max(0,f-g)},o=()=>{if(i===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-i)))},c=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{n===null&&(n=e.requestFrame(()=>{n=null,c()}))},p=()=>{t&&(c(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=s2(e.getViewport()),t){i=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,i=null,p()},preserveAfterGeometryChange:f=>{f(),c(),d()},restoreAfterOutputParsing:()=>{if(t){p();return}s2(e.getViewport())||r()},dispose:()=>{n!==null&&e.cancelFrame(n),n=null}}}function C9({getPlatform:e,getSelection:t,writeText:i}){return{handleKeyEvent(n){if(!k9(n,e()))return!0;n.preventDefault?.(),n.stopPropagation?.();const r=t();return r&&!n.repeat&&i(r).catch(()=>{}),!1}}}function k9(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const E9="Symbols Nerd Font Mono",T9=`1em "${E9}"`,A9=650;let Fd=null;function WT(){return Fd||(Fd=N9(),Fd)}async function R9(){await L9(WT(),A9)}async function N9(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(T9)}catch{}}async function L9(e,t){await new Promise(i=>{let n=!1;const r=setTimeout(o,t);e.then(o,o);function o(){n||(n=!0,clearTimeout(r),i())}})}const M9=80,O9=16,D9=250,j9=1024*1024,I9=120,B9={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)"},P9={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)"},z9={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 Ub({operationId:e,ticketPath:t,wsPath:i,theme:n="instrument",onExit:r,active:o,zoom:c=1}){const d=n,{renderer:p,font:f}=UT(),g=b.useRef(null),v=b.useRef(null),y=b.useRef(null),S=b.useRef(null),w=b.useRef(null),x=b.useRef(null),k=b.useRef(null),[R,O]=b.useState(c),I=b.useRef(r);I.current=r;const A=b.useRef(o);A.current=o;const[$,L]=b.useState("connecting"),[H,U]=b.useState(0);b.useEffect(()=>{const K=g.current;if(!K)return;let z=!1,N=null,D=null,T=null;return(async()=>{if(await R9(),z)return;const j=r2(d),P=new XB({...i9,fontFamily:f.family,fontSize:f.size*R,theme:j});v.current=P;const V=new OD;k.current=V,P.loadAddon(V),P.open(K),a2(K,j);const Q=e9({terminal:P,selectionTarget:K,windowTarget:window,clipboard:navigator.clipboard});P.loadAddon(new aj),P.unicode.activeVersion="11";const B=ZB(()=>P.input(`
|
|
98
|
+
`)),Z=K.querySelector("textarea.xterm-helper-textarea, textarea")??K;Z.addEventListener("compositionstart",B.onCompositionStart),Z.addEventListener("compositionend",B.onCompositionEnd),Z.addEventListener("focusout",B.onCompositionCancel);const W=C9({getPlatform:()=>navigator.platform,getSelection:()=>P.getSelection(),writeText:qe=>navigator.clipboard.writeText(qe)});P.attachCustomKeyEventHandler(qe=>W.handleKeyEvent(qe)&&B.handleKeyEvent(qe));const re=x9({getViewport:()=>P.buffer.active,scrollToBottom:()=>$9(P),scrollToLine:qe=>H9(P,qe),requestFrame:qe=>window.requestAnimationFrame(qe),cancelFrame:qe=>window.cancelAnimationFrame(qe)});x.current=re;const ie=F9(K,Z,re.recordUserViewportChange),ve=G9(P,A.current!==!1,re.restoreAfterOutputParsing);w.current=ve;const xe=ED({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:qe=>P.onData(Re=>{re.resumeFollowing(),qe(Re)}),write:ve.write},onExit:()=>I.current?.(),onStatus:(qe,Re)=>{L(Re?`${qe}: ${Re}`:qe)}});y.current=xe;const Te=()=>{re.preserveAfterGeometryChange(()=>{V.fit(),xe.resize(P.cols,P.rows),P.refresh(0,P.rows-1)})},Ie=()=>{D&&clearTimeout(D),D=setTimeout(()=>{D=null,z||Te()},M9)},_t=async()=>{await document.fonts?.ready,!z&&(Te(),xe.start(),A.current!==!1&&P.focus())};N=new ResizeObserver(Ie),N.observe(K),_t(),T=()=>{D&&clearTimeout(D),Z.removeEventListener("compositionstart",B.onCompositionStart),Z.removeEventListener("compositionend",B.onCompositionEnd),Z.removeEventListener("focusout",B.onCompositionCancel),B.dispose(),xe.dispose(),Q.dispose(),ie.dispose(),ve.dispose(),re.dispose(),v.current=null,y.current=null,w.current=null,x.current=null,k.current=null;try{P.dispose()}catch{}},U(qe=>qe+1)})(),()=>{z=!0,N?.disconnect(),T?.()}},[e,t,i]),b.useEffect(()=>{w.current?.setActive(o!==!1),o&&(v.current?.focus(),x.current?.resumeFollowing())},[o]),b.useEffect(()=>{const K=v.current;if(!K)return;let z=!1;if(p==="webgl")try{const N=new H8;S.current=N,N.onContextLoss(()=>{if(!z){try{N.dispose()}catch{}S.current===N&&(S.current=null)}}),K.loadAddon(N)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{z=!0;const N=S.current;if(N){S.current=null;try{N.dispose()}catch{}}}},[p,e,H]),b.useEffect(()=>{const K=v.current,z=g.current;if(!K||!z)return;const N=r2(d);K.options.theme=N,a2(z,N)},[d,H]),b.useEffect(()=>{const K=v.current;K&&(K.options.fontFamily=f.family,o2(K,k.current,y.current,x.current))},[f.family,H]),b.useEffect(()=>{if(c===R)return;const K=setTimeout(()=>O(c),I9);return()=>clearTimeout(K)},[c,R]),b.useEffect(()=>{const K=v.current;K&&(K.options.fontSize=f.size*R,o2(K,k.current,y.current,x.current))},[R,f.size,H]);const oe=$.startsWith("live"),fe=R===1?void 0:{width:`${R*100}%`,height:`${R*100}%`,transform:`scale(${1/R})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[oe?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),$]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:g,style:fe})})]})})}function r2(e){return e==="carbon"?z9:e==="maritime"?P9:B9}function a2(e,t){const i=e.querySelector(".xterm-viewport");i&&(t.background?i.style.backgroundColor=t.background:i.style.removeProperty("background-color"))}function $9(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function H9(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function F9(e,t,i){const n=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!n)return{dispose:()=>{}};let r=!1,o=null;const c=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,i()})})},d=()=>c(),p=()=>{r=!0},f=S=>{r=U9(S,n)},g=()=>{r&&c()},v=()=>{const S=r;r=!1,S&&c()},y=S=>{W9(S)&&c()};return n.addEventListener("wheel",d,{capture:!0,passive:!0}),n.addEventListener("touchstart",p,{capture:!0,passive:!0}),n.addEventListener("touchend",v),n.addEventListener("touchcancel",v),n.addEventListener("pointerdown",f,!0),n.addEventListener("scroll",g),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),t.addEventListener("keydown",y,!0),{dispose:()=>{n.removeEventListener("wheel",d,!0),n.removeEventListener("touchstart",p,!0),n.removeEventListener("touchend",v),n.removeEventListener("touchcancel",v),n.removeEventListener("pointerdown",f,!0),n.removeEventListener("scroll",g),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),t.removeEventListener("keydown",y,!0),o!==null&&window.cancelAnimationFrame(o)}}}function U9(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(i=>i.classList?.contains("scrollbar")===!0)}function W9(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function G9(e,t,i){let n=t,r=!1,o=null,c=0,d=[];const p=()=>{o&&(clearTimeout(o),o=null)},f=()=>{if(p(),r||c===0)return;const v=q9(d,c);d=[],c=0,e.write(v,()=>{r||i()})},g=()=>{r||o||c===0||(o=setTimeout(f,n?O9:D9))};return{write:v=>{if(!(r||v.byteLength===0)){if(d.push(v),c+=v.byteLength,c>=j9){f();return}g()}},setActive:v=>{if(n!==v){if(n=v,p(),n){f();return}g()}},dispose:()=>{f(),r=!0,d=[],c=0,p()}}}function q9(e,t){if(e.length===1)return e[0]??new Uint8Array;const i=new Uint8Array(t);let n=0;for(const r of e)i.set(r,n),n+=r.byteLength;return i}function o2(e,t,i,n){const r=()=>{t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(n){n.preserveAfterGeometryChange(r);return}r()}const K9=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class qs extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function V9(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new qs(t.status,"Invalid agent state response");return i.agentClis.map(n=>nP(n,t.status))}async function Y9(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.clis))throw new qs(t.status,"Invalid Agent CLI state response");return i}async function X9(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new qs(t.status,"Invalid tenants response");return i.tenants.map(n=>sP(n,t.status))}async function Z9(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new qs(t.status,"Invalid jobs response");return i.tenants}async function J9(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new qs(t.status,"Invalid agent sessions response");return i.sessions.map(n=>wp(n,t.status))}async function Q9(e){const t=await fetch("/api/v1/operations",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.operations))throw new qs(t.status,"Invalid operations response");return{operations:i.operations.map(n=>rP(n,t.status))}}async function eP(e,t,i){const n=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:i});return await Kr(n),wp(await n.json(),n.status)}async function tP(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Kr(i),wp(await i.json(),i.status)}async function iP(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Kr(i)}function wp(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||my(i))throw new qs(t,"Invalid agent session response");return{sessionId:i.sessionId,terminalSessionId:typeof i.terminalSessionId=="string"?i.terminalSessionId:i.sessionId,cwdLabel:i.cwdLabel,label:typeof i.label=="string"?i.label:void 0,cliId:typeof i.cliId=="string"?i.cliId:void 0,cliLabel:typeof i.cliLabel=="string"?i.cliLabel:void 0,status:i.status,turnState:i.turnState==="running"||i.turnState==="ended"?i.turnState:"none",createdAt:i.createdAt,theaterId:typeof i.theaterId=="string"?i.theaterId:void 0,tenantId:typeof i.tenantId=="string"?i.tenantId:void 0,registrationId:typeof i.registrationId=="string"?i.registrationId:void 0,resumeAvailable:i.resumeAvailable===!0}}async function Kr(e){if(!e.ok)throw new qs(e.status,`Agent plugin request failed: ${e.status}`)}function nP(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new qs(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function sP(e,t){const i=e;if(!i||typeof i.tenantId!="string"||typeof i.tenantLabel!="string"||typeof i.createdAt!="number"||typeof i.sessions!="number")throw new qs(t,"Invalid tenant response");return i}function rP(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||my(i)||my(i.payload))throw new qs(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,ts:i.ts}}function my(e){return gy(e,new Set(K9))}function gy(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>gy(i,t)):Object.entries(e).some(([i,n])=>t.has(i)||gy(n,t))}const aP="active",_y=new Set(["done","error","aborted"]);function oP(e,t){let i=vy(e,t.jobId,t.updatedAt);for(const n of t.events)i=GT(i,n);return _y.has(t.status)&&!_y.has(i.status)&&(i={...i,status:t.status}),i}function GT(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,n={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:uP(e.recentEvents,t)};switch(t.type){case"job:registered":return lP(n,i);case"job:finalized":return{...n,status:fi(i.status)??"done",finishedAt:Ta(i.finishedAt)??t.at,summary:fi(i.summary),error:fi(i.error)};case"track:begin":return pl(n,i,t.id,r=>({...r,startedAt:Ta(i.startedAt)??t.at,requestPreview:fi(i.requestPreview)}));case"track:status":return pl(n,i,t.id,r=>({...r,status:fi(i.status)??r.status}));case"track:text":return pl(n,i,t.id,r=>{const o=r.text+(fi(i.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Ta(i.textLength)??fi(i.text)?.length??0),latestLine:hP(o)||r.latestLine}});case"track:thought":return pl(n,i,t.id,r=>{const o=r.thought+(fi(i.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Ta(i.textLength)??fi(i.text)?.length??0)}});case"track:tool":return pl(n,i,t.id,r=>({...r,status:"stream",tools:cP(r.tools,i)}));case"track:finalized":return pl(n,i,t.id,r=>{const o=l2(r.text,r.sentTextLength,fi(i.fallbackText),Ta(i.fallbackTextLength)),c=l2(r.thought,r.sentThoughtLength,fi(i.fallbackThought),Ta(i.fallbackThoughtLength));return{...r,status:fi(i.status)??"done",finishedAt:Ta(i.finishedAt)??t.at,error:fi(i.error),text:o.text,sentTextLength:o.sentLength,thought:c.text,sentThoughtLength:c.sentLength}});default:return n}}function vy(e,t,i){return{jobId:t,tenantId:e,status:aP,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function $l(e){return _y.has(e)}function lP(e,t){const i=Array.isArray(t.tracks)?t.tracks:[];let n=e.trackOrder,r=e.tracks;for(const o of i){if(!o.trackId)continue;const c=r[o.trackId],d={...c??qT(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||(n=[...n,o.trackId]),r={...r,[o.trackId]:d}}return{...e,label:fi(t.label)??e.label,ownerCarrierId:fi(t.ownerCarrierId)??e.ownerCarrierId,kind:fi(t.kind)??e.kind,signatureCli:fi(t.signatureCli)??e.signatureCli,startedAt:Ta(t.startedAt)??e.startedAt,trackOrder:n,tracks:r}}function pl(e,t,i,n){const r=fi(t.trackId);if(!r)return e;const o=e.tracks[r],c={...n(o??qT(r)),lastEventId:i};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:c}}}function qT(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function cP(e,t){const i=fi(t.toolId)??fi(t.id);if(!i)return e;const n={id:i,name:fi(t.name),input:t.input,output:t.output,status:fi(t.status)},r=e.findIndex(o=>o.id===i);return r>=0?[...e.slice(0,r),{...e[r],...n},...e.slice(r+1)]:[...e,n]}function l2(e,t,i,n){return i?t>=(n??i.length)?{text:e,sentLength:t}:{text:i,sentLength:n??i.length}:{text:e,sentLength:t}}function uP(e,t){return[...e,t].slice(-120)}function hP(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
99
|
+
`);return i[i.length-1]?.trim()??""}function fi(e){return typeof e=="string"?e:void 0}function Ta(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const dP=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function fP(){let e="";return t=>{e+=t;const i=[];let n=e.indexOf(`
|
|
100
|
+
|
|
101
|
+
`);for(;n>=0;){const r=e.slice(0,n);e=e.slice(n+2);const o=mP(r);o&&i.push(o),n=e.indexOf(`
|
|
102
|
+
|
|
103
|
+
`)}return i}}function pP(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const n=t.tenant?.tenantId;return!n||!t.truncation?null:{kind:"truncation",tenantId:n,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const n=u2(t.session);return n?{kind:"session",tenantId:n.tenantId??n.sessionId,session:n}:null}if(e.event==="session:attention"){const n=u2(t.session);return n?{kind:"attention",tenantId:n.tenantId??n.sessionId,session:n,reason:gP(t.reason)}:null}const i=c2(t.event)??c2(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function mP(e){const t=e.split(`
|
|
104
|
+
`),i=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",n=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
105
|
+
`);return!n&&i==="message"?null:{event:i,data:n}}function c2(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 u2(e){try{return wp(e,200)}catch{return null}}function gP(e){return typeof e=="string"&&dP.has(e)?e:void 0}const Wb={droppedCount:0},yy=new Set;let Jt={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function _P(){return rE(vP,KT)}function KT(){return Jt}function vP(e){return yy.add(e),()=>{yy.delete(e)}}function ls(e){Jt={...Jt,...e},kP()}function yP(e){ls({agentClis:e})}function bP(e){const t={};for(const i of e)t[i.sessionId]=i;ls({sessions:t,sessionOrder:[...e].sort((i,n)=>n.createdAt-i.createdAt).map(i=>i.sessionId)})}function qf(e){const t=!!Jt.sessions[e.sessionId];ls({sessions:{...Jt.sessions,[e.sessionId]:e},sessionOrder:t?Jt.sessionOrder:[e.sessionId,...Jt.sessionOrder],turnState:{...Jt.turnState,[e.sessionId]:e.turnState}})}function VT(e){const{[e]:t,...i}=Jt.sessions,{[e]:n,...r}=Jt.turnState;ls({sessions:i,sessionOrder:Jt.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:Jt.activeTerminalSessionId===e?null:Jt.activeTerminalSessionId,turnState:r})}function YT(e){ls({activeTerminalSessionId:e})}function SP(e){ls({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Jt.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&Jt.tenantJobs[t])]})}function wP(e){const t={};for(const i of e){const n={};for(const r of i.jobs)n[r.jobId]=oP(i.tenantId,r);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(r=>r.jobId),jobs:n,truncation:i.truncation??Wb}}ls({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...Jt.tenantOrder.filter(i=>t[i])]})}function xP(e,t){const i=e.tenantId,n=e.jobId??EP(e),r=Jt.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:Wb},o=n?r.jobs[n]??vy(i,n,e.at):vy(i,"__unknown__",e.at),c=GT(o,e),d=n&&r.jobOrder.includes(n)?r.jobOrder:n?[n,...r.jobOrder]:r.jobOrder,p={...r,tenantLabel:t??r.tenantLabel,jobOrder:d,jobs:n?{...r.jobs,[n]:c}:r.jobs};return ls({tenantJobs:{...Jt.tenantJobs,[i]:p},tenantOrder:Jt.tenantOrder.includes(i)?Jt.tenantOrder:[i,...Jt.tenantOrder]}),{job:c,unknownTenant:!Jt.tenantJobs[i]}}function CP(e,t,i){const n=Jt.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:Wb};ls({tenantJobs:{...Jt.tenantJobs,[e]:{...n,tenantLabel:t??n.tenantLabel,truncation:i}}})}function XT(e){const t=e.tenantId;if(!t)return[];const i=Jt.tenantJobs[t];return i?i.jobOrder.map(n=>i.jobs[n]).filter(n=>!!n):[]}function kP(){for(const e of yy)e()}function EP(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const h2=250,TP=5e3,by=new Map;function AP(e){const t=new AbortController;return RP(t.signal,e),()=>t.abort()}async function RP(e,t){let i=h2;for(;!e.aborted;){ls({connection:"connecting"});try{await OP(e,t);const n=await fetch("/plugins/terminal/agent/events",{signal:e});if(!n.ok||!n.body)throw new Error(`Agent stream failed: ${n.status}`);ls({connection:"live",connectionError:null}),i=h2,await NP(n.body.getReader(),e,t),e.aborted||ls({connection:"connecting",connectionError:null})}catch(n){if(e.aborted)return;ls({connection:"connecting",connectionError:n instanceof Error?n.message:String(n)})}if(e.aborted)return;await jP(i,e),i=Math.min(i*2,TP)}}async function NP(e,t,i){const n=new TextDecoder,r=fP();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const c of r(n.decode(o.value,{stream:!0}))){const d=pP(c);if(d){if(d.kind==="truncation"&&d.truncation){CP(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){qf(d.session),Kf(i,d.session.sessionId,Gb(d.session));continue}if(d.kind==="attention"&&d.session){qf(d.session),d.reason!=="idle_prompt"&&Kf(i,d.session.sessionId,"awaiting");continue}d.event&&(xP(d.event,d.tenantLabel),MP(i,d.event.tenantId))}}}}function Gb(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&LP(e)?"running":"idle"}function LP(e){return XT(e).some(t=>!$l(t.status))}function Kf(e,t,i){const n=by.get(t);e.status.set(t,i),by.set(t,i),n!==i&&(i==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):i==="idle"&&(n==="running"||n==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function MP(e,t){const{sessions:i}=KT();for(const n of Object.values(i))n.tenantId===t&&by.get(n.sessionId)!=="awaiting"&&Kf(e,n.sessionId,Gb(n))}async function OP(e,t){const[i,n,r,o,c]=await Promise.all([V9(e),J9(e),X9(e),Z9(e),Q9(e)]);yP(i),bP(n),SP(r),wP(o);for(const d of n)Kf(t,d.sessionId,Gb(d));DP(c.operations,t)}function DP(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function jP(e,t){await new Promise(i=>{const n=()=>{clearTimeout(r),t.removeEventListener("abort",n),i()},r=setTimeout(n,e);t.addEventListener("abort",n)})}const IP=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function BP(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const i=Math.floor(t/60),n=t%60;return`${i}m ${n}s`}function PP(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function zP(e){return e.trackOrder.reduce((t,i)=>{const n=e.tracks[i];return n?t+Math.round((n.sentTextLength+n.sentThoughtLength)/4):t},0)}function ZT(e){if(e)return IP.has(e)?e:void 0}function $P(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function xp(e){return e==="err"||e==="error"}function Ju(e,t){return!$l(e)&&$P(t)}function qb(e,t){return xp(e)?"error":e==="done"||e==="aborted"?e:$l(t)?t:e}function HP(e,t){const i=new Set(e),n=t.filter(r=>i.has(r)?!1:(i.add(r),!0));return n.length===0?e:[...e,...n]}function FP(e,t,i){const n=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)n.get(o)?.expiresAt!==i&&(n.set(o,{jobId:o,expiresAt:i}),r=!0);return r?[...n.values()]:e}function UP(e,t,i){const n=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>i&&n.has(o.jobId));return r.length===e.length?e:r}function JT(e,t){const i=new Map(e.map(n=>[n.jobId,n]));return t.flatMap(n=>{const r=i.get(n);return r?[r]:[]})}function WP(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),i=t.filter(({job:r,track:o})=>Ju(r.status,o.status)),n=i.length>0?i:t;for(const{job:r,track:o}of n){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(Ju(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function GP(e,t,i){const n=new Set(e.map(o=>o.jobId)),r=JT(t,i.map(o=>o.jobId)).filter(o=>!n.has(o.jobId));return r.length===0?e:[...e,...r]}class QT extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function qP(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await eA(t),tA(await t.json(),t.status)}async function KP(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await eA(i),tA(await i.json(),i.status)}async function eA(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new QT(e.status,t)}function tA(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean"||i.codexLaunchMode!=="acp"&&i.codexLaunchMode!=="app-server")throw new QT(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor,codexLaunchMode:i.codexLaunchMode}}const Sy=new Set;let Vf={loading:!1,state:null,savingField:null,error:null},bf=0;function iA(){return b.useSyncExternalStore(VP,d2,d2)}function d2(){return Vf}function VP(e){return Sy.add(e),()=>{Sy.delete(e)}}async function YP(e){const t=++bf;jl({loading:!0,error:null});try{const i=await qP(e);if(t!==bf)return;jl({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==bf)return;jl({loading:!1,error:sA(i)})}}async function nA(e,t){const i=Vf.state;if(!i)return!1;bf+=1;const n={...i,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:n.enableMetaphor}:{codexLaunchMode:n.codexLaunchMode};jl({state:n,savingField:e,error:null});try{const o=await KP(r);return jl({state:o,savingField:null,error:null}),!0}catch(o){return jl({state:i,savingField:null,error:sA(o)}),!1}}function jl(e){Vf={...Vf,...e};for(const t of Sy)t()}function sA(e){return e instanceof Error?e.message:String(e)}const XP=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],ZP="/plugins/terminal/agent/ticket",JP="/plugins/terminal/ws",C_="fleet-plugin.terminal.stream-dock-expanded",QP="fleet-plugin.terminal.stream-dock-collapsed",ez=56,tz=4e3,iz={...s9,step:1,defaultValue:14},nz="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",rA={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Cu(e.payload,"cliLabel")??void 0,render:e=>u.jsx(lz,{context:e})},aA={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(hz,{})},oA={id:"agent.attention",title:"Agent input waiting"},sz={id:"agent.ended",title:"Agent turn ended"},Ud={id:"terminal",operationKinds:[rA],settingsSections:[aA],notificationKinds:[oA,sz],install:e=>rz(e),closeOperation:async e=>{try{await iP(e)}finally{VT(e)}},launch:async({theaterId:e,kind:t})=>{const i=await eP(e,t.id);return qf(i),YT(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?u.jsx(Ez,{}):e.id==="codex"?u.jsx(Tz,{}):u.jsx(kz,{})};function rz(e){return AP({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function lA(e,t){const i=b.useRef(null),n=b.useRef(!0),[r,o]=b.useState(!0),c=b.useCallback(p=>{n.current!==p&&(n.current=p,o(p))},[]);b.useEffect(()=>{const p=i.current;if(!p)return;const f=()=>{const g=p.scrollHeight-p.scrollTop-p.clientHeight;c(g<=ez)};return p.addEventListener("scroll",f,{passive:!0}),()=>p.removeEventListener("scroll",f)},[e,c]),b.useLayoutEffect(()=>{c(!0);const p=i.current;p&&(p.scrollTop=p.scrollHeight)},[e,c]),b.useLayoutEffect(()=>{const p=i.current;!p||!n.current||(p.scrollTop=p.scrollHeight)},[t]);const d=b.useCallback(()=>{const p=i.current;p&&(p.scrollTop=p.scrollHeight,p.focus({preventScroll:!0}),c(!0))},[c]);return{containerRef:i,pinned:r,jumpToLatest:d}}function az(){const[e,t]=b.useState(()=>{try{return localStorage.removeItem(QP),localStorage.getItem(C_)==="true"}catch{return!1}}),i=b.useCallback(n=>{try{n?localStorage.setItem(C_,"true"):localStorage.removeItem(C_)}catch{}t(n)},[]);return[e,i]}function oz(e,t){const[i,n]=b.useState(Date.now);return b.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":BP((t??i)-e)}function lz({context:e}){const i=_P().sessions[e.operationId]??vz(e),[n,r]=b.useState(!1),[o,c]=b.useState([]),[d,p]=b.useState([]),f=b.useRef(null),g=b.useRef(null),v=b.useRef(null),y=b.useRef(new Set),S=XT(i),w=S.filter(L=>!$l(L.status)),x=GP(w,S,d),k=JT(S,o),R=String(n),O=k.map(L=>`${L.jobId}:${L.lastEventId}`).join(","),I=lA(R,O);b.useLayoutEffect(()=>{const L=y.current,H=S.filter(U=>L.has(U.jobId)&&$l(U.status)).map(U=>U.jobId);y.current=new Set(w.map(U=>U.jobId)),H.length!==0&&p(U=>FP(U,H,Date.now()+tz))},[w,S]),b.useEffect(()=>{if(d.length===0)return;const L=Math.min(...d.map(U=>U.expiresAt)),H=window.setTimeout(()=>{p(U=>UP(U,S,Date.now()))},Math.max(0,L-Date.now()));return()=>window.clearTimeout(H)},[S,d]),b.useEffect(()=>{n&&c(L=>HP(L,w.map(H=>H.jobId)))},[w,n]);const A=b.useCallback(()=>{r(!1),c([]),v.current?.focus()},[]),$=b.useCallback(()=>{c(x.map(L=>L.jobId)),r(!0)},[x]);return b.useLayoutEffect(()=>{n&&f.current?.focus()},[n]),b.useEffect(()=>{if(!n)return;const L=H=>{if(H.key==="Escape"){H.stopPropagation(),A();return}if(H.key==="Tab"){const U=g.current;if(!U)return;const oe=Array.from(U.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(z=>!z.hasAttribute("disabled")),fe=oe[0],K=oe[oe.length-1];H.shiftKey&&document.activeElement===fe?(H.preventDefault(),K?.focus()):!H.shiftKey&&document.activeElement===K&&(H.preventDefault(),fe?.focus())}};return document.addEventListener("keydown",L,!0),()=>document.removeEventListener("keydown",L,!0)},[n,A]),i.status==="dormant"?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{_z(i.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(Ub,{operationId:i.sessionId,ticketPath:ZP,wsPath:JP,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>VT(i.sessionId)}),x.length>0?u.jsx(cz,{activeJobs:x,onOpenDetail:$,detailBtnRef:v}):null,n?u.jsxs("div",{ref:g,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:A}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:A,children:"×"}),u.jsx("div",{ref:I.containerRef,className:"job-overlay-body",tabIndex:-1,children:k.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):k.map(L=>u.jsx(mz,{job:L},L.jobId))}),I.pinned?null:u.jsx("button",{type:"button",className:"follow-button",onClick:I.jumpToLatest,children:"↓ Follow"})]})]}):null]})}function cz({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[n,r]=az(),o=e[0],c=oz(o?.startedAt,o?.finishedAt),d=e.reduce((L,H)=>L+zP(H),0),p=PP(d),f=e.length===1&&o?ZT(o.ownerCarrierId):void 0,g=e.length===1&&o?o.label:void 0,v=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",y=WP(e),S=e.map(L=>`${L.jobId}:${L.lastEventId}`).join(","),w=`${n}:${e.map(L=>L.jobId).join(",")}`,{containerRef:x,pinned:k,jumpToLatest:R}=lA(w,S),O=e.some(L=>L.trackOrder.some(H=>{const U=L.tracks[H];return U?Ju(L.status,U.status):!1})),I=e.some(L=>!$l(L.status)),A=e.some(L=>L.status==="error"||L.trackOrder.some(H=>xp(L.tracks[H]?.status??""))),$=I?"job-dock-dot":A?"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:$,"aria-hidden":"true"}),u.jsxs("span",{className:"job-dock-carrier",title:g,children:[f?u.jsx("span",{className:"job-dock-captain-dot","data-captain":f,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:v})]}),u.jsxs("span",{className:"job-dock-strip-line",style:n?{display:"none"}:void 0,"aria-hidden":"true",children:[y.thinking?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):y.text,!n&&O&&y.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":n?"Collapse stream dock":"Expand stream dock","aria-expanded":n,onClick:()=>r(!n),children:n?"▼":"▲"}),u.jsx("button",{ref:i,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${n?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:x,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(L=>{const H=e.length>1,U=!H&&L.trackOrder.length===1;return L.trackOrder.map(oe=>{const fe=L.tracks[oe];return fe?u.jsx(uz,{track:fe,job:L,multiJob:H,singleTrack:U},`${L.jobId}:${oe}`):null})})]}),k?null:u.jsx("button",{type:"button",className:"follow-button",onClick:R,children:"↓ Follow"})]})]})}function uz({track:e,job:t,multiJob:i,singleTrack:n}){const r=Ju(t.status,e.status),c=bz(e.text),d=!c&&r&&!!e.thought,p=r?yz(e):void 0,f=qb(e.status,t.status),g=i||!n,v=i?ZT(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[g?u.jsxs("span",{className:"job-dock-row-name",children:[v?u.jsx("span",{className:"job-dock-captain-dot","data-captain":v,"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":""}${xp(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 hz(){const[e,t]=b.useState([]),[i,n]=b.useState(null),{renderer:r,font:o}=UT(),c=iA();return b.useEffect(()=>{const d=new AbortController;return Y9(d.signal).then(p=>t(p.clis)).catch(p=>{d.signal.aborted||n(p instanceof Error?p.message:String(p))}),()=>d.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsx(dz,{}),u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),i?u.jsx("p",{className:"settings-error",children:i}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(d=>u.jsx(pz,{cli:d,codexLaunchMode:c.state?.codexLaunchMode,disabled:c.savingField!==null,onCodexLaunchModeChange:p=>{nA("codexLaunchMode",p)}},d.id))}),c.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:c.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(Sz,{terminalFont:o}),u.jsx(wz,{terminalRenderer:r})]})}function dz(){const e=iA(),t=e.state,i=e.savingField!==null;return b.useEffect(()=>{const n=new AbortController;return YP(n.signal),()=>n.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(fz,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:i,onToggle:()=>{nA("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 fz({title:e,help:t,onLabel:i,offLabel:n,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?i:n})})]})}function pz({cli:e,codexLaunchMode:t,disabled:i,onCodexLaunchModeChange:n}){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:i,onClick:()=>n("acp"),children:"ACP"}),u.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:i,onClick:()=>n("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 mz({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const i=e.tracks[t];return i?u.jsx(gz,{track:i,jobStatus:e.status},i.trackId):null})})]})}function gz({track:e,jobStatus:t}){const i=Cz(e.status,t),n=i==="track-card--live",r=qb(e.status,t);return u.jsxs("article",{className:i?`track-card ${i}`:"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,n?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 _z(e){qf(await tP(e)),YT(e)}function vz(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Cu(e.operation.payload,"cliId")??void 0,cliLabel:Cu(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Cu(e.operation.payload,"tenantId")??void 0,registrationId:Cu(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Cu(e,t){const i=e[t];return typeof i=="string"?i:null}function yz(e){const t=e.tools.find(i=>i.status!=="completed"&&i.status!=="failed"&&i.status!=="error");return t?t.name??t.id:void 0}function bz(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
106
|
+
`);return i[i.length-1]?.trim()??""}function Sz({terminalFont:e}){const[t,i]=b.useState([]),[n,r]=b.useState(!0),[o,c]=b.useState(null),d=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Ol.id:Ol.id}:{source:"system",familyName:e.customName};b.useEffect(()=>{const f=new AbortController;return r(!0),c(null),f5({signal:f.signal}).then(g=>{f.signal.aborted||i(g.fonts.filter(v=>v.monospace).map(v=>({family:v.family,monospace:v.monospace})))}).catch(g=>{f.signal.aborted||xz(g)||(i([]),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"){p9(f.familyName);return}const g=Yu.find(v=>v.id===f.id);g&&f9(g.id)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[u.jsx("div",{className:"global-settings-row",children:u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),u.jsx("div",{"aria-describedby":"terminal-font-help",children:u.jsx(h5,{builtIns:Yu.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:Ol.family,previewText:nz,size:e.size,sizeRange:iz,loading:n,error:o,onSelectionChange:p,onSizeCommit:m9})}),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 wz({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:XP.map(t=>{const i=t.id===e;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>d9(t.id),children:t.label},t.id)})})]})})}function xz(e){return e instanceof DOMException&&e.name==="AbortError"}function Cz(e,t){if(Ju(t,e))return"track-card--live";const i=qb(e,t);return xp(i)?"track-card--bad":i==="done"||i==="aborted"?"track-card--idle":""}function kz(){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 Ez(){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 Tz(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}const Az="global-shell",Rz="/plugins/terminal/global/ticket",Nz="/plugins/terminal/ws",Lz=168,Mz={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},Oz={id:"global-shell",title:"Shell",icon:Dz,preferredExtraWidth:Lz,render:e=>u.jsx("div",{style:Mz,children:u.jsx(Ub,{operationId:Az,ticketPath:Rz,wsPath:Nz,theme:"instrument",active:!0})})};function Dz(){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 jz="/plugins/terminal/shell/ticket",Iz="/plugins/terminal/ws",cA={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>b.createElement(Bz,{context:e})},k_={id:"terminal",operationKinds:[cA],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(Pz,{})};function Bz({context:e}){return u.jsx(Ub,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:jz,wsPath:Iz,theme:e.theme,onExit:e.onClose})}function Pz(){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 zz=new Set(["agent"]),$z={id:"terminal",operationKinds:[cA,rA],settingsSections:[aA],notificationKinds:[oA],railPanels:[Oz],install:e=>(WT(),h9(e.settings),Ud.install?.(e)),closeOperation:async e=>{const t=await Fz(e);if(t?.type==="shell"){await k_.closeOperation?.(e);return}t&&zz.has(t.type)&&await Ud.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?k_.launch?.(e)??{id:""}:Ud.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?k_.renderLaunchIcon?.(e):Ud.renderLaunchIcon?.(e)},Hz=[$z];async function Fz(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const i=await t.json();return typeof i.operation?.type=="string"?{type:i.operation.type}:null}const J={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"},Uz={src:J.ts,lib:J.ts,app:J.ts,test:J.shell,tests:J.shell,__tests__:J.shell,spec:J.shell,specs:J.shell,node_modules:J.binary,vendor:J.binary,dist:J.config,build:J.config,out:J.config,target:J.config,docs:J.md,doc:J.md,public:J.data,assets:J.data,static:J.data,components:J.image,scripts:J.js,styles:J.css,".git":J.html,".github":J.config,".vscode":J.css},f2={ts:{shape:"angle",tone:J.ts},tsx:{shape:"angle",tone:J.ts},mts:{shape:"angle",tone:J.ts},cts:{shape:"angle",tone:J.ts},"d.ts":{shape:"angle",tone:J.ts},js:{shape:"angle",tone:J.js},jsx:{shape:"angle",tone:J.js},mjs:{shape:"angle",tone:J.js},cjs:{shape:"angle",tone:J.js},json:{shape:"braces",tone:J.json},jsonc:{shape:"braces",tone:J.json},json5:{shape:"braces",tone:J.json},jsonl:{shape:"braces",tone:J.json},graphql:{shape:"braces",tone:J.image},gql:{shape:"braces",tone:J.image},proto:{shape:"braces",tone:J.go},css:{shape:"hash",tone:J.css},scss:{shape:"hash",tone:J.css},sass:{shape:"hash",tone:J.css},less:{shape:"hash",tone:J.css},styl:{shape:"hash",tone:J.css},html:{shape:"markup",tone:J.html},htm:{shape:"markup",tone:J.html},xml:{shape:"markup",tone:J.html},xhtml:{shape:"markup",tone:J.html},vue:{shape:"markup",tone:J.shell},svelte:{shape:"markup",tone:J.rust},astro:{shape:"markup",tone:J.image},md:{shape:"doc",tone:J.md},mdx:{shape:"doc",tone:J.md},markdown:{shape:"doc",tone:J.md},rst:{shape:"doc",tone:J.md},txt:{shape:"doc",tone:J.default},text:{shape:"doc",tone:J.default},log:{shape:"doc",tone:J.default},adoc:{shape:"doc",tone:J.md},pdf:{shape:"doc",tone:J.ruby},py:{shape:"angle",tone:J.py},pyi:{shape:"angle",tone:J.py},pyw:{shape:"angle",tone:J.py},go:{shape:"angle",tone:J.go},rs:{shape:"angle",tone:J.rust},rb:{shape:"angle",tone:J.ruby},rake:{shape:"angle",tone:J.ruby},gemspec:{shape:"angle",tone:J.ruby},java:{shape:"angle",tone:J.html},kt:{shape:"angle",tone:J.config},kts:{shape:"angle",tone:J.config},scala:{shape:"angle",tone:J.ruby},c:{shape:"angle",tone:J.ts},h:{shape:"angle",tone:J.ts},cpp:{shape:"angle",tone:J.css},cc:{shape:"angle",tone:J.css},cxx:{shape:"angle",tone:J.css},hpp:{shape:"angle",tone:J.css},cs:{shape:"angle",tone:J.config},php:{shape:"angle",tone:J.config},swift:{shape:"angle",tone:J.html},lua:{shape:"angle",tone:J.ts},dart:{shape:"angle",tone:J.go},sh:{shape:"terminal",tone:J.shell},bash:{shape:"terminal",tone:J.shell},zsh:{shape:"terminal",tone:J.shell},fish:{shape:"terminal",tone:J.shell},ps1:{shape:"terminal",tone:J.css},bat:{shape:"terminal",tone:J.shell},cmd:{shape:"terminal",tone:J.shell},yaml:{shape:"gear",tone:J.config},yml:{shape:"gear",tone:J.config},toml:{shape:"gear",tone:J.config},ini:{shape:"gear",tone:J.config},conf:{shape:"gear",tone:J.config},cfg:{shape:"gear",tone:J.config},properties:{shape:"gear",tone:J.config},env:{shape:"gear",tone:J.config},editorconfig:{shape:"gear",tone:J.config},png:{shape:"image",tone:J.image},jpg:{shape:"image",tone:J.image},jpeg:{shape:"image",tone:J.image},gif:{shape:"image",tone:J.image},webp:{shape:"image",tone:J.image},svg:{shape:"image",tone:J.image},ico:{shape:"image",tone:J.image},bmp:{shape:"image",tone:J.image},avif:{shape:"image",tone:J.image},tiff:{shape:"image",tone:J.image},heic:{shape:"image",tone:J.image},mp4:{shape:"image",tone:J.data},mov:{shape:"image",tone:J.data},webm:{shape:"image",tone:J.data},mkv:{shape:"image",tone:J.data},mp3:{shape:"chip",tone:J.shell},wav:{shape:"chip",tone:J.shell},flac:{shape:"chip",tone:J.shell},ogg:{shape:"chip",tone:J.shell},sql:{shape:"database",tone:J.data},csv:{shape:"database",tone:J.data},tsv:{shape:"database",tone:J.data},db:{shape:"database",tone:J.data},sqlite:{shape:"database",tone:J.data},sqlite3:{shape:"database",tone:J.data},parquet:{shape:"database",tone:J.data},zip:{shape:"archive",tone:J.archive},tar:{shape:"archive",tone:J.archive},gz:{shape:"archive",tone:J.archive},tgz:{shape:"archive",tone:J.archive},bz2:{shape:"archive",tone:J.archive},xz:{shape:"archive",tone:J.archive},rar:{shape:"archive",tone:J.archive},"7z":{shape:"archive",tone:J.archive},zst:{shape:"archive",tone:J.archive},bin:{shape:"chip",tone:J.binary},exe:{shape:"chip",tone:J.binary},dll:{shape:"chip",tone:J.binary},so:{shape:"chip",tone:J.binary},dylib:{shape:"chip",tone:J.binary},wasm:{shape:"chip",tone:J.config},class:{shape:"chip",tone:J.binary},lock:{shape:"chip",tone:J.binary},woff:{shape:"chip",tone:J.config},woff2:{shape:"chip",tone:J.config},ttf:{shape:"chip",tone:J.config},otf:{shape:"chip",tone:J.config}},Wz={dockerfile:{shape:"chip",tone:J.css},"docker-compose.yml":{shape:"gear",tone:J.css},"docker-compose.yaml":{shape:"gear",tone:J.css},makefile:{shape:"gear",tone:J.html},"cmakelists.txt":{shape:"gear",tone:J.html},".gitignore":{shape:"gear",tone:J.html},".gitattributes":{shape:"gear",tone:J.html},".dockerignore":{shape:"gear",tone:J.html},".npmignore":{shape:"gear",tone:J.html},".npmrc":{shape:"gear",tone:J.ruby},"package.json":{shape:"braces",tone:J.shell},"tsconfig.json":{shape:"braces",tone:J.ts},license:{shape:"doc",tone:J.json},"license.md":{shape:"doc",tone:J.json},licence:{shape:"doc",tone:J.json}},Gz={shape:"default",tone:J.default},wy={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 qz({name:e}){const t=Vz(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:wy[t.shape]})}function Kz({name:e,open:t}){const i=Uz[e.toLowerCase()]??J.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${i})`},children:t?wy.folderOpen:wy.folderClosed})}function Vz(e){const t=e.toLowerCase(),i=Wz[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:J.config};if(t.startsWith("readme"))return{shape:"doc",tone:J.md};if(t.endsWith(".d.ts"))return f2["d.ts"];const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const r=t.slice(n+1),o=f2[r];if(o)return o}return Gz}function Yz(e,t){return`${e??""}:${t??""}`}function xy(e,t){const i=Yf(t);if(i===null)return null;const n=e?Yf(e):"";return n===null?null:n?i?`${n}/${i}`:n:i}function Sf(e,t){const i=Yf(t),n=e?Yf(e):"";return i===null||n===null?null:n?i===n?"":i.startsWith(`${n}/`)?i.slice(n.length+1):null:i}function uA(e,t){const i=Sf(e,t.relativePath);if(i===null)return null;const n=i===""||t.parentRelativePath===null?null:Sf(e,t.parentRelativePath);if(i!==""&&t.parentRelativePath!==null&&n===null)return null;const r=[];for(const o of t.entries){const c=Sf(e,o.relativePath);c!==null&&r.push({...o,relativePath:c})}return{...t,relativePath:i,parentRelativePath:n,entries:r}}function Xz(e,t){return Sf(e,t)}function Yf(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const i of e.replaceAll("\\","/").split("/"))if(!(!i||i===".")){if(i==="..")return null;t.push(i)}return t.join("/")}const Zz=200,Wd=30,p2=5,hA="fleet-console.fileExplorer.showHidden",m2=500;function Is(e,t){return e===t}async function Jz({entries:e,cachedResults:t,files:i,showHidden:n,isCurrent:r,onFolderResult:o}){const c=[],d=new Map(t),p=new Set,f=new Set;let g=0;const v=y=>{for(const S of y)if(!(!e$(S,n)||p.has(S.relativePath))){if(p.size>=m2)return;p.add(S.relativePath),c.push(S)}};for(v(e);c.length>0&&r();){const y=c.shift();if(!y)return;const S=d.get(y.relativePath);if(S){if(f.has(S.relativePath))continue;f.add(S.relativePath),v(S.entries);continue}if(g>=m2)return;g+=1;try{const w=await i.listFolder(y.relativePath);if(!r())return;if(d.set(y.relativePath,w),o(y.relativePath,w),f.has(w.relativePath))continue;f.add(w.relativePath),v(w.entries)}catch{}}}function dA(e,t,i,n,r,o,c,d,p=new Set){const f=[];for(const g of e){if(!d&&g.name.startsWith("."))continue;const v=o.get(g.relativePath),y=v?.entries,S=v?.relativePath??g.relativePath,w=g.kind==="dir"&&p.has(S),x=g.kind==="dir"&&!w&&fA(y??[],o,c,d);if(c&&!g.name.toLowerCase().includes(c)&&!x)continue;const k=n.has(g.relativePath)||!!(c&&x);if(f.push({entry:g,depth:t,isSelected:i===g.relativePath,isExpanded:k,isLoading:r.has(g.relativePath)}),g.kind==="dir"&&k&&!w&&y){const R=new Set(p);R.add(S),f.push(...dA(y,t+1,i,n,r,o,c,d,R))}}return f}function Qz({contextKey:e,contextRelPath:t,files:i,theaterId:n,selectedPath:r,onSelect:o}){const[c,d]=b.useState(null),[p,f]=b.useState(null),[g,v]=b.useState(""),[y,S]=b.useState(new Set),[w,x]=b.useState(new Set),[k,R]=b.useState(new Map),[O,I]=b.useState(""),[A,$]=b.useState(0),[L,H]=b.useState(600),[U,oe]=b.useState(()=>t$()),fe=b.useRef(null),K=b.useRef(y);K.current=y;const z=b.useRef(g);z.current=g;const N=b.useRef(i);N.current=i;const D=b.useRef(e);D.current=e;const T=b.useRef(k);T.current=k;const E=b.useRef(0),j=!!O;b.useEffect(()=>{n&&(d(null),f(null),v(""),S(new Set),R(new Map),I(""),$(0))},[e,n]),b.useEffect(()=>{if(!n)return;const Re=e;i.listFolder(g||void 0).then(Se=>{Is(Re,D.current)&&(d(Se),f(null))}).catch(Se=>{Is(Re,D.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")})},[e,n,g,i]),b.useEffect(()=>{const Re=++E.current;if(!j||!c)return;let Se=!0;const Ue=e,Ye=()=>Se&&Re===E.current&&Is(Ue,D.current);return Jz({entries:c.entries,cachedResults:T.current,files:i,showHidden:U,isCurrent:Ye,onFolderResult:(pt,nt)=>{Ye()&&R(ge=>new Map(ge).set(pt,nt))}}),()=>{Se=!1}},[e,i,j,c,U]),b.useEffect(()=>{const Re=fe.current;if(!Re)return;const Se=new ResizeObserver(()=>H(Re.clientHeight));return Se.observe(Re),H(Re.clientHeight),()=>Se.disconnect()},[]),b.useEffect(()=>{if(!n)return;let Re=!0;const Se=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,Ue=new EventSource(Se),Ye=()=>{const nt=e;N.current.listFolder(z.current||void 0).then(ge=>{Is(nt,D.current)&&(d(ge),f(null))}).catch(()=>{})},pt=()=>{Ye();for(const nt of K.current){const ge=e;N.current.listFolder(nt).then(Le=>{Is(ge,D.current)&&R(Gt=>new Map(Gt).set(nt,Le))}).catch(()=>{})}};return Ue.addEventListener("change",nt=>{let ge;try{ge=JSON.parse(nt.data)}catch{return}if(typeof ge!="string")return;const Le=Xz(t,ge);if(Le!==null&&((Le===""||Le===z.current)&&Ye(),Le!==""&&K.current.has(Le))){const Gt=e;N.current.listFolder(Le).then(Wn=>{Is(Gt,D.current)&&R(Ks=>new Map(Ks).set(Le,Wn))}).catch(()=>{})}}),Ue.onopen=()=>{if(Re){Re=!1;return}pt()},()=>{Ue.close()}},[t,n,i]);const P=b.useCallback(Re=>{const Se=Re.relativePath,Ue=!y.has(Se);if(S(Ye=>{const pt=new Set(Ye);return pt.has(Se)?(pt.delete(Se),pt):(pt.add(Se),pt)}),Ue){const Ye=e;x(pt=>new Set(pt).add(Se)),i.listFolder(Se).then(pt=>{Is(Ye,D.current)&&(R(nt=>new Map(nt).set(Se,pt)),x(nt=>{const ge=new Set(nt);return ge.delete(Se),ge}))}).catch(()=>{Is(Ye,D.current)&&x(pt=>{const nt=new Set(pt);return nt.delete(Se),nt})})}},[e,i,y]),V=b.useCallback(Re=>{Re.kind==="dir"?P(Re):o(Re)},[P,o]),Q=b.useCallback(Re=>{$(Re.currentTarget.scrollTop)},[]),B=b.useCallback(()=>{oe(Re=>{const Se=!Re;try{localStorage.setItem(hA,Se?"1":"0")}catch{}return Se})},[]),Z=b.useCallback(()=>{if(!n)return;const Re=e;i.listFolder(g||void 0).then(Se=>{Is(Re,D.current)&&(d(Se),f(null))}).catch(Se=>{Is(Re,D.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")});for(const Se of y)i.listFolder(Se).then(Ue=>{Is(Re,D.current)&&R(Ye=>new Map(Ye).set(Se,Ue))}).catch(()=>{})},[e,i,g,y,n]),W=O.toLowerCase(),re=b.useMemo(()=>c?dA(c.entries,0,r,y,w,k,W,U):[],[c,r,y,w,k,W,U]),ie=!U&&c!==null&&c.entries.length>0&&re.length===0&&!O,ve=re.length>Zz,xe=ve?Math.max(0,Math.floor(A/Wd)-p2):0,Te=ve?Math.min(re.length,Math.ceil((A+L)/Wd)+p2):re.length,Ie=re.slice(xe,Te),_t=re.length*Wd,qe=xe*Wd;return n?p&&!c?u.jsx("div",{className:"fexp-tree-error",children:p}):c?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:O,onChange:Re=>I(Re.target.value),"aria-label":"Filter files"}),O&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>I(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:Z,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${U?" is-active":""}`,onClick:B,"aria-pressed":U,"aria-label":U?"Hide hidden files":"Show hidden files",title:U?"Hide hidden files":"Show hidden files",children:U?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:fe,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:ve?Q:void 0,children:[!1,ve?u.jsx("div",{style:{height:_t,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${qe}px)`},children:Ie.map(Re=>u.jsx(g2,{row:Re,onEntryClick:V},Re.entry.relativePath))})}):Ie.map(Re=>u.jsx(g2,{row:Re,onEntryClick:V},Re.entry.relativePath)),re.length===0&&O&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),re.length===0&&!O&&c.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),ie&&u.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):u.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function fA(e,t,i,n,r=new Set){for(const o of e)if(!(!n&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(i))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),fA(c.entries,t,i,n,d))return!0}}}return!1}function e$(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function g2({row:e,onEntryClick:t}){const{entry:i,depth:n,isSelected:r,isExpanded:o,isLoading:c}=e,d=i.kind==="dir",p=n*16,f=b.useCallback(()=>t(i),[i,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(Kz,{name:i.name,open:o}):u.jsx(qz,{name:i.name})}),u.jsx("span",{className:"fexp-tree-name",children:i.name}),c&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function t$(){try{return localStorage.getItem(hA)==="1"}catch{return!1}}function i$({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 n$(e,t){switch(t){case"typescript":case"javascript":return r$(e);case"json":return a$(e);case"python":return l$(e);case"css":case"scss":case"sass":case"less":return c$(e);case"html":case"xml":return u$(e);case"bash":case"shell":return h$(e);case"yaml":return d$(e);default:return[{kind:"text",value:e}]}}const s$=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 r$(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const n=e.indexOf("*/",i+2),r=n===-1?e.slice(i):e.slice(i,n+2);t.push({kind:"com",value:r}),i+=r.length;continue}if(e.startsWith("//",i)){const n=e.indexOf(`
|
|
107
|
+
`,i),r=n===-1?e.slice(i):e.slice(i,n);t.push({kind:"com",value:r}),i+=r.length;continue}if(e[i]==="`"){const{slice:n,length:r}=Ba(e,i,"`","`");t.push({kind:"str",value:n}),i+=r;continue}if(e[i]==='"'||e[i]==="'"){const{slice:n,length:r}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:n}),i+=r;continue}if(/[0-9]/.test(e[i])||e[i]==="."&&/[0-9]/.test(e[i+1]??"")){const n=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(n){t.push({kind:"num",value:n[0]}),i+=n[0].length;continue}}if(/[a-zA-Z_$]/.test(e[i])){const n=e.slice(i).match(/^[a-zA-Z_$][\w$]*/);if(n){const r=n[0],o=e.slice(i+r.length).match(/^\s*\(/);s$.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),i+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}function a$(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:n,length:r}=Ba(e,i,'"','"'),c=e.slice(i+r).trimStart().startsWith(":");t.push({kind:c?"attr":"str",value:n}),i+=r;continue}if(/[0-9\-]/.test(e[i])){const n=e.slice(i).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(n){t.push({kind:"num",value:n[0]}),i+=n[0].length;continue}}if(e.startsWith("true",i)||e.startsWith("false",i)||e.startsWith("null",i)){const n=e.slice(i).match(/^(true|false|null)/);if(n){t.push({kind:"key",value:n[0]}),i+=n[0].length;continue}}if(/[{}[\]:,]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}const o$=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 l$(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const n=e.indexOf(`
|
|
108
|
+
`,i),r=n===-1?e.slice(i):e.slice(i,n);t.push({kind:"com",value:r}),i+=r.length;continue}if(e.startsWith('"""',i)||e.startsWith("'''",i)){const n=e.slice(i,i+3),r=e.indexOf(n,i+3),o=r===-1?e.slice(i):e.slice(i,r+3);t.push({kind:"str",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:n,length:r}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:n}),i+=r;continue}if(/[0-9]/.test(e[i])){const n=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(n){t.push({kind:"num",value:n[0]}),i+=n[0].length;continue}}if(/[a-zA-Z_]/.test(e[i])){const n=e.slice(i).match(/^[a-zA-Z_]\w*/);if(n){const r=n[0],o=e.slice(i+r.length).match(/^\s*\(/);o$.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),i+=r.length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function c$(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const n=e.indexOf("*/",i+2),r=n===-1?e.slice(i):e.slice(i,n+2);t.push({kind:"com",value:r}),i+=r.length;continue}if(e.startsWith("//",i)){const n=e.indexOf(`
|
|
109
|
+
`,i),r=n===-1?e.slice(i):e.slice(i,n);t.push({kind:"com",value:r}),i+=r.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:n,length:r}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:n}),i+=r;continue}if(e[i]==="."||e[i]==="#"||e[i]===":"){const n=e.slice(i).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(n){t.push({kind:"tag",value:n[0]}),i+=n[0].length;continue}}if(/[a-zA-Z-]/.test(e[i])){const n=e.slice(i).match(/^[a-zA-Z-][\w-]*/);if(n){const r=n[0];e.slice(i+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),i+=r.length;continue}}if(/[0-9]/.test(e[i])){const n=e.slice(i).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(n){t.push({kind:"num",value:n[0]}),i+=n[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function u$(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("<!--",i)){const n=e.indexOf("-->",i+4),r=n===-1?e.slice(i):e.slice(i,n+3);t.push({kind:"com",value:r}),i+=r.length;continue}if(e[i]==="<"){t.push({kind:"punct",value:"<"}),i++,e[i]==="/"&&(t.push({kind:"punct",value:"/"}),i++);const n=e.slice(i).match(/^[a-zA-Z][\w:-]*/);n&&(t.push({kind:"tag",value:n[0]}),i+=n[0].length);continue}if(e[i]==='"'||e[i]==="'"){const{slice:n,length:r}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:n}),i+=r;continue}if(/[a-zA-Z]/.test(e[i])){const n=e.slice(i).match(/^[a-zA-Z][\w:-]*/);if(n){const r=e.slice(i+n[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:n[0]}),i+=n[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function h$(e){const t=[];let i=0;const n=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;i<e.length;){if(e[i]==="#"){const r=e.indexOf(`
|
|
110
|
+
`,i),o=r===-1?e.slice(i):e.slice(i,r);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:r,length:o}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:r}),i+=o;continue}if(/[a-zA-Z_]/.test(e[i])){const r=e.slice(i).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:n.has(r[0])?"key":"text",value:r[0]}),i+=r[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function d$(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const n=e.indexOf(`
|
|
111
|
+
`,i),r=n===-1?e.slice(i):e.slice(i,n);t.push({kind:"com",value:r}),i+=r.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:n,length:r}=Ba(e,i,e[i],e[i]);t.push({kind:"str",value:n}),i+=r;continue}if(/[a-zA-Z_]/.test(e[i])){const n=e.slice(i).match(/^[a-zA-Z_][\w-]*/);if(n){e.slice(i+n[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:n[0]}):["true","false","null","yes","no","on","off"].includes(n[0])?t.push({kind:"key",value:n[0]}):t.push({kind:"text",value:n[0]}),i+=n[0].length;continue}}if(/[0-9\-]/.test(e[i])){const n=e.slice(i).match(/^-?[\d]*\.?[\d]+/);if(n){t.push({kind:"num",value:n[0]}),i+=n[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function Ba(e,t,i,n){let r=t+i.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(n,r)){r+=n.length;break}if(n!=="`"&&e[r]===`
|
|
112
|
+
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function f$({content:e,lang:t,truncated:i}){const n=b.useMemo(()=>p$(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[i&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:n.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 p$(e,t){return e.split(`
|
|
113
|
+
`).map(n=>m$(n,t))}function m$(e,t){return t==="plaintext"||t==="markdown"?_2(e)||" ":n$(e,t).map(n=>{const r=_2(n.value);return n.kind==="text"?r:`<span class="syn-${n.kind}">${r}</span>`}).join("")||" "}function _2(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function g$({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function Kb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ro=Kb();function pA(e){Ro=e}var Du={exec:()=>null};function kt(e,t=""){let i=typeof e=="string"?e:e.source,n={replace:(r,o)=>{let c=typeof o=="string"?o:o.source;return c=c.replace(Cn.caret,"$1"),i=i.replace(r,c),n},getRegex:()=>new RegExp(i,t)};return n}var _$=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Cn={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")},v$=/^(?:[ \t]*(?:\n|$))+/,y$=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,b$=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,mh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,S$=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vb=/(?:[*+-]|\d{1,9}[.)])/,mA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,gA=kt(mA).replace(/bull/g,Vb).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(),w$=kt(mA).replace(/bull/g,Vb).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(),Yb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,x$=/^[^\n]+/,Xb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,C$=kt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Xb).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),k$=kt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Vb).getRegex(),Cp="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",Zb=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,E$=kt("^ {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",Zb).replace("tag",Cp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_A=kt(Yb).replace("hr",mh).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",Cp).getRegex(),T$=kt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_A).getRegex(),Jb={blockquote:T$,code:y$,def:C$,fences:b$,heading:S$,hr:mh,html:E$,lheading:gA,list:k$,newline:v$,paragraph:_A,table:Du,text:x$},v2=kt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mh).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",Cp).getRegex(),A$={...Jb,lheading:w$,table:v2,paragraph:kt(Yb).replace("hr",mh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",v2).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",Cp).getRegex()},R$={...Jb,html:kt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Zb).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:Du,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:kt(Yb).replace("hr",mh).replace("heading",` *#{1,6} *[^
|
|
114
|
+
]`).replace("lheading",gA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},N$=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,L$=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,vA=/^( {2,}|\\)\n(?!\s*$)/,M$=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,kp=/[\p{P}\p{S}]/u,Qb=/[\s\p{P}\p{S}]/u,yA=/[^\s\p{P}\p{S}]/u,O$=kt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qb).getRegex(),bA=/(?!~)[\p{P}\p{S}]/u,D$=/(?!~)[\s\p{P}\p{S}]/u,j$=/(?:[^\s\p{P}\p{S}]|~)/u,I$=kt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",_$?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),SA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,B$=kt(SA,"u").replace(/punct/g,kp).getRegex(),P$=kt(SA,"u").replace(/punct/g,bA).getRegex(),wA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",z$=kt(wA,"gu").replace(/notPunctSpace/g,yA).replace(/punctSpace/g,Qb).replace(/punct/g,kp).getRegex(),$$=kt(wA,"gu").replace(/notPunctSpace/g,j$).replace(/punctSpace/g,D$).replace(/punct/g,bA).getRegex(),H$=kt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yA).replace(/punctSpace/g,Qb).replace(/punct/g,kp).getRegex(),F$=kt(/\\(punct)/,"gu").replace(/punct/g,kp).getRegex(),U$=kt(/^<(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(),W$=kt(Zb).replace("(?:-->|$)","-->").getRegex(),G$=kt("^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",W$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Xf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,q$=kt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Xf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xA=kt(/^!?\[(label)\]\[(ref)\]/).replace("label",Xf).replace("ref",Xb).getRegex(),CA=kt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Xb).getRegex(),K$=kt("reflink|nolink(?!\\()","g").replace("reflink",xA).replace("nolink",CA).getRegex(),y2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,e0={_backpedal:Du,anyPunctuation:F$,autolink:U$,blockSkip:I$,br:vA,code:L$,del:Du,emStrongLDelim:B$,emStrongRDelimAst:z$,emStrongRDelimUnd:H$,escape:N$,link:q$,nolink:CA,punctuation:O$,reflink:xA,reflinkSearch:K$,tag:G$,text:M$,url:Du},V$={...e0,link:kt(/^!?\[(label)\]\((.*?)\)/).replace("label",Xf).getRegex(),reflink:kt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Xf).getRegex()},Cy={...e0,emStrongRDelimAst:$$,emStrongLDelim:P$,url:kt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",y2).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:kt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",y2).getRegex()},Y$={...Cy,br:kt(vA).replace("{2,}","*").getRegex(),text:kt(Cy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Gd={normal:Jb,gfm:A$,pedantic:R$},ru={normal:e0,gfm:Cy,breaks:Y$,pedantic:V$},X$={"&":"&","<":"<",">":">",'"':""","'":"'"},b2=e=>X$[e];function nr(e,t){if(t){if(Cn.escapeTest.test(e))return e.replace(Cn.escapeReplace,b2)}else if(Cn.escapeTestNoEncode.test(e))return e.replace(Cn.escapeReplaceNoEncode,b2);return e}function S2(e){try{e=encodeURI(e).replace(Cn.percentDecode,"%")}catch{return null}return e}function w2(e,t){let i=e.replace(Cn.findPipe,(o,c,d)=>{let p=!1,f=c;for(;--f>=0&&d[f]==="\\";)p=!p;return p?"|":" |"}),n=i.split(Cn.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Cn.slashPipe,"|");return n}function au(e,t,i){let n=e.length;if(n===0)return"";let r=0;for(;r<n&&e.charAt(n-r-1)===t;)r++;return e.slice(0,n-r)}function Z$(e,t){if(e.indexOf(t[1])===-1)return-1;let i=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])i++;else if(e[n]===t[1]&&(i--,i<0))return n;return i>0?-2:-1}function x2(e,t,i,n,r){let o=t.href,c=t.title||null,d=e[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:i,href:o,title:c,text:d,tokens:n.inlineTokens(d)};return n.state.inLink=!1,p}function J$(e,t,i){let n=e.match(i.other.indentCodeCompensation);if(n===null)return t;let r=n[1];return t.split(`
|
|
115
|
+
`).map(o=>{let c=o.match(i.other.beginningSpace);if(c===null)return o;let[d]=c;return d.length>=r.length?o.slice(r.length):o}).join(`
|
|
116
|
+
`)}var Zf=class{options;rules;lexer;constructor(e){this.options=e||Ro}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let i=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:au(i,`
|
|
117
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],n=J$(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let n=au(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:au(t[0],`
|
|
118
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=au(t[0],`
|
|
119
|
+
`).split(`
|
|
120
|
+
`),n="",r="",o=[];for(;i.length>0;){let c=!1,d=[],p;for(p=0;p<i.length;p++)if(this.rules.other.blockquoteStart.test(i[p]))d.push(i[p]),c=!0;else if(!c)d.push(i[p]);else break;i=i.slice(p);let f=d.join(`
|
|
121
|
+
`),g=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
122
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
123
|
+
${f}`:f,r=r?`${r}
|
|
124
|
+
${g}`:g;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,o,!0),this.lexer.state.top=v,i.length===0)break;let y=o.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){let S=y,w=S.raw+`
|
|
125
|
+
`+i.join(`
|
|
126
|
+
`),x=this.blockquote(w);o[o.length-1]=x,n=n.substring(0,n.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(y?.type==="list"){let S=y,w=S.raw+`
|
|
127
|
+
`+i.join(`
|
|
128
|
+
`),x=this.list(w);o[o.length-1]=x,n=n.substring(0,n.length-y.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,i=w.substring(o.at(-1).raw.length).split(`
|
|
129
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim(),n=i.length>1,r={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let o=this.rules.other.listItemRegex(i),c=!1;for(;e;){let p=!1,f="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let v=t[2].split(`
|
|
130
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,R=>" ".repeat(3*R.length)),y=e.split(`
|
|
131
|
+
`,1)[0],S=!v.trim(),w=0;if(this.options.pedantic?(w=2,g=v.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=v.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(y)&&(f+=y+`
|
|
132
|
+
`,e=e.substring(y.length+1),p=!0),!p){let R=this.rules.other.nextBulletRegex(w),O=this.rules.other.hrRegex(w),I=this.rules.other.fencesBeginRegex(w),A=this.rules.other.headingBeginRegex(w),$=this.rules.other.htmlBeginRegex(w);for(;e;){let L=e.split(`
|
|
133
|
+
`,1)[0],H;if(y=L,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),H=y):H=y.replace(this.rules.other.tabCharGlobal," "),I.test(y)||A.test(y)||$.test(y)||R.test(y)||O.test(y))break;if(H.search(this.rules.other.nonSpaceChar)>=w||!y.trim())g+=`
|
|
134
|
+
`+H.slice(w);else{if(S||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(v)||A.test(v)||O.test(v))break;g+=`
|
|
135
|
+
`+y}!S&&!y.trim()&&(S=!0),f+=L+`
|
|
136
|
+
`,e=e.substring(L.length+1),v=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(g),x&&(k=x[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!x,checked:k,loose:!1,text:g,tokens:[]}),r.raw+=f}let d=r.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let p=0;p<r.items.length;p++)if(this.lexer.state.top=!1,r.items[p].tokens=this.lexer.blockTokens(r.items[p].text,[]),!r.loose){let f=r.items[p].tokens.filter(v=>v.type==="space"),g=f.length>0&&f.some(v=>this.rules.other.anyLine.test(v.raw));r.loose=g}if(r.loose)for(let p=0;p<r.items.length;p++)r.items[p].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let i=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=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:i,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=w2(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
137
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===n.length){for(let c of n)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<i.length;c++)o.header.push({text:i[c],tokens:this.lexer.inline(i[c]),header:!0,align:o.align[c]});for(let c of r)o.rows.push(w2(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 i=t[1].charAt(t[1].length-1)===`
|
|
138
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let i=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let o=au(i.slice(0,-1),"\\");if((i.length-o.length)%2===0)return}else{let o=Z$(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 n=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),x2(t,{href:n&&n.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 i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[n.toLowerCase()];if(!r){let o=i[0].charAt(0);return{type:"text",raw:o,text:o}}return x2(i,r,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||n[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,o,c,d=r,p=0,f=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(n=f.exec(t))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(c=[...o].length,n[3]||n[4]){d+=c;continue}else if((n[5]||n[6])&&r%3&&!((r+c)%3)){p+=c;continue}if(d-=c,d>0)continue;c=Math.min(c,c+d+p);let g=[...n[0]][0].length,v=e.slice(0,r+n.index+g+c);if(Math.min(r,c)%2){let S=v.slice(1,-1);return{type:"em",raw:v,text:S,tokens:this.lexer.inlineTokens(S)}}let y=v.slice(2,-2);return{type:"strong",raw:v,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let i,n;return t[2]==="@"?(i=t[1],n="mailto:"+i):(i=t[1],n=i),{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,n;if(t[2]==="@")i=t[0],n="mailto:"+i;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);i=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:i}}}},Bs=class ky{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ro,this.options.tokenizer=this.options.tokenizer||new Zf,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:Cn,block:Gd.normal,inline:ru.normal};this.options.pedantic?(i.block=Gd.pedantic,i.inline=ru.pedantic):this.options.gfm&&(i.block=Gd.gfm,this.options.breaks?i.inline=ru.breaks:i.inline=ru.gfm),this.tokenizer.rules=i}static get rules(){return{block:Gd,inline:ru}}static lex(t,i){return new ky(i).lex(t)}static lexInline(t,i){return new ky(i).inlineTokens(t)}lex(t){t=t.replace(Cn.carriageReturn,`
|
|
139
|
+
`),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let n=this.inlineQueue[i];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[],n=!1){for(this.options.pedantic&&(t=t.replace(Cn.tabCharGlobal," ").replace(Cn.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(c=>(r=c.call({lexer:this},t,i))?(t=t.substring(r.raw.length),i.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let c=i.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
140
|
+
`:i.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let c=i.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
141
|
+
`)?"":`
|
|
142
|
+
`)+r.raw,c.text+=`
|
|
143
|
+
`+r.text,this.inlineQueue.at(-1).src=c.text):i.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let c=i.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
144
|
+
`)?"":`
|
|
145
|
+
`)+r.raw,c.text+=`
|
|
146
|
+
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},i.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),i.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=i.at(-1);n&&c?.type==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
147
|
+
`)?"":`
|
|
148
|
+
`)+r.raw,c.text+=`
|
|
149
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(r),n=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=i.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
150
|
+
`)?"":`
|
|
151
|
+
`)+r.raw,c.text+=`
|
|
152
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.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,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){let n=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(n))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)o=r[2]?r[2].length:0,n=n.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let c=!1,d="";for(;t;){c||(d=""),c=!1;let p;if(this.options.extensions?.inline?.some(g=>(p=g.call({lexer:this},t,i))?(t=t.substring(p.raw.length),i.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let g=i.at(-1);p.type==="text"&&g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):i.push(p);continue}if(p=this.tokenizer.emStrong(t,n,d)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),i.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),i.push(p);continue}let f=t;if(this.options.extensions?.startInline){let g=1/0,v=t.slice(1),y;this.options.extensions.startInline.forEach(S=>{y=S.call({lexer:this},v),typeof y=="number"&&y>=0&&(g=Math.min(g,y))}),g<1/0&&g>=0&&(f=t.substring(0,g+1))}if(p=this.tokenizer.inlineText(f)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(d=p.raw.slice(-1)),c=!0;let g=i.at(-1);g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):i.push(p);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return i}},Jf=class{options;parser;constructor(e){this.options=e||Ro}space(e){return""}code({text:e,lang:t,escaped:i}){let n=(t||"").match(Cn.notSpaceStart)?.[0],r=e.replace(Cn.endingNewline,"")+`
|
|
153
|
+
`;return n?'<pre><code class="language-'+nr(n)+'">'+(i?r:nr(r,!0))+`</code></pre>
|
|
154
|
+
`:"<pre><code>"+(i?r:nr(r,!0))+`</code></pre>
|
|
155
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
156
|
+
${this.parser.parse(e)}</blockquote>
|
|
157
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
158
|
+
`}hr(e){return`<hr>
|
|
159
|
+
`}list(e){let t=e.ordered,i=e.start,n="";for(let c=0;c<e.items.length;c++){let d=e.items[c];n+=this.listitem(d)}let r=t?"ol":"ul",o=t&&i!==1?' start="'+i+'"':"";return"<"+r+o+`>
|
|
160
|
+
`+n+"</"+r+`>
|
|
161
|
+
`}listitem(e){let t="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+nr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):t+=i+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
162
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
163
|
+
`}table(e){let t="",i="";for(let r=0;r<e.header.length;r++)i+=this.tablecell(e.header[r]);t+=this.tablerow({text:i});let n="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];i="";for(let c=0;c<o.length;c++)i+=this.tablecell(o[c]);n+=this.tablerow({text:i})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
164
|
+
<thead>
|
|
165
|
+
`+t+`</thead>
|
|
166
|
+
`+n+`</table>
|
|
167
|
+
`}tablerow({text:e}){return`<tr>
|
|
168
|
+
${e}</tr>
|
|
169
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
|
|
170
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${nr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){let n=this.parser.parseInline(i),r=S2(e);if(r===null)return n;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+nr(t)+'"'),o+=">"+n+"</a>",o}image({href:e,title:t,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=S2(e);if(r===null)return nr(i);e=r;let o=`<img src="${e}" alt="${i}"`;return t&&(o+=` title="${nr(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:nr(e.text)}},t0=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""}},Ps=class Ey{options;renderer;textRenderer;constructor(t){this.options=t||Ro,this.options.renderer=this.options.renderer||new Jf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new t0}static parse(t,i){return new Ey(i).parse(t)}static parseInline(t,i){return new Ey(i).parseInline(t)}parse(t,i=!0){let n="";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)){n+=p||"";continue}}let c=o;switch(c.type){case"space":{n+=this.renderer.space(c);continue}case"hr":{n+=this.renderer.hr(c);continue}case"heading":{n+=this.renderer.heading(c);continue}case"code":{n+=this.renderer.code(c);continue}case"table":{n+=this.renderer.table(c);continue}case"blockquote":{n+=this.renderer.blockquote(c);continue}case"list":{n+=this.renderer.list(c);continue}case"html":{n+=this.renderer.html(c);continue}case"def":{n+=this.renderer.def(c);continue}case"paragraph":{n+=this.renderer.paragraph(c);continue}case"text":{let d=c,p=this.renderer.text(d);for(;r+1<t.length&&t[r+1].type==="text";)d=t[++r],p+=`
|
|
171
|
+
`+this.renderer.text(d);i?n+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):n+=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 n}parseInline(t,i=this.renderer){let n="";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)){n+=d||"";continue}}let c=o;switch(c.type){case"escape":{n+=i.text(c);break}case"html":{n+=i.html(c);break}case"link":{n+=i.link(c);break}case"image":{n+=i.image(c);break}case"strong":{n+=i.strong(c);break}case"em":{n+=i.em(c);break}case"codespan":{n+=i.codespan(c);break}case"br":{n+=i.br(c);break}case"del":{n+=i.del(c);break}case"text":{n+=i.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 n}},ku=class{options;block;constructor(e){this.options=e||Ro}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?Bs.lex:Bs.lexInline}provideParser(){return this.block?Ps.parse:Ps.parseInline}},kA=class{defaults=Kb();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ps;Renderer=Jf;TextRenderer=t0;Lexer=Bs;Tokenizer=Zf;Hooks=ku;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let n of e)switch(i=i.concat(t.call(this,n)),n.type){case"table":{let r=n;for(let o of r.header)i=i.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let c of o)i=i.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=n;i=i.concat(this.walkTokens(r.items,t));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let c=r[o].flat(1/0);i=i.concat(this.walkTokens(c,t))}):r.tokens&&(i=i.concat(this.walkTokens(r.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.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)}),n.extensions=t),i.renderer){let r=this.defaults.renderer||new Jf(this.defaults);for(let o in i.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let c=o,d=i.renderer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g||""}}n.renderer=r}if(i.tokenizer){let r=this.defaults.tokenizer||new Zf(this.defaults);for(let o in i.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let c=o,d=i.tokenizer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}n.tokenizer=r}if(i.hooks){let r=this.defaults.hooks||new ku;for(let o in i.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let c=o,d=i.hooks[c],p=r[c];ku.passThroughHooks.has(o)?r[c]=f=>{if(this.defaults.async&&ku.passThroughHooksRespectAsync.has(o))return(async()=>{let v=await d.call(r,f);return p.call(r,v)})();let g=d.call(r,f);return p.call(r,g)}:r[c]=(...f)=>{if(this.defaults.async)return(async()=>{let v=await d.apply(r,f);return v===!1&&(v=await p.apply(r,f)),v})();let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}n.hooks=r}if(i.walkTokens){let r=this.defaults.walkTokens,o=i.walkTokens;n.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,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bs.lex(e,t??this.defaults)}parser(e,t){return Ps.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let n={...i},r={...this.defaults,...n},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.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?Bs.lex:Bs.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?Ps.parse:Ps.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?Bs.lex:Bs.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?Ps.parse:Ps.parseInline)(c,r);return r.hooks&&(d=r.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(e,t){return i=>{if(i.message+=`
|
|
172
|
+
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+nr(i.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}},Eo=new kA;function $t(e,t){return Eo.parse(e,t)}$t.options=$t.setOptions=function(e){return Eo.setOptions(e),$t.defaults=Eo.defaults,pA($t.defaults),$t};$t.getDefaults=Kb;$t.defaults=Ro;$t.use=function(...e){return Eo.use(...e),$t.defaults=Eo.defaults,pA($t.defaults),$t};$t.walkTokens=function(e,t){return Eo.walkTokens(e,t)};$t.parseInline=Eo.parseInline;$t.Parser=Ps;$t.parser=Ps.parse;$t.Renderer=Jf;$t.TextRenderer=t0;$t.Lexer=Bs;$t.lexer=Bs.lex;$t.Tokenizer=Zf;$t.Hooks=ku;$t.parse=$t;$t.options;$t.setOptions;$t.use;$t.walkTokens;$t.parseInline;Ps.parse;Bs.lex;const{entries:EA,setPrototypeOf:C2,isFrozen:Q$,getPrototypeOf:eH,getOwnPropertyDescriptor:tH}=Object;let{freeze:kn,seal:Ls,create:bl}=Object,{apply:Ty,construct:Ay}=typeof Reflect<"u"&&Reflect;kn||(kn=function(t){return t});Ls||(Ls=function(t){return t});Ty||(Ty=function(t,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return t.apply(i,r)});Ay||(Ay=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return new t(...n)});const ou=Ni(Array.prototype.forEach),iH=Ni(Array.prototype.lastIndexOf),k2=Ni(Array.prototype.pop),lu=Ni(Array.prototype.push),nH=Ni(Array.prototype.splice),Sn=Array.isArray,Eu=Ni(String.prototype.toLowerCase),E_=Ni(String.prototype.toString),E2=Ni(String.prototype.match),ml=Ni(String.prototype.replace),T2=Ni(String.prototype.indexOf),sH=Ni(String.prototype.trim),rH=Ni(Number.prototype.toString),aH=Ni(Boolean.prototype.toString),A2=typeof BigInt>"u"?null:Ni(BigInt.prototype.toString),R2=typeof Symbol>"u"?null:Ni(Symbol.prototype.toString),di=Ni(Object.prototype.hasOwnProperty),cu=Ni(Object.prototype.toString),sn=Ni(RegExp.prototype.test),qd=oH(TypeError);function Ni(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return Ty(e,t,n)}}function oH(e){return function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return Ay(e,i)}}function it(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Eu;if(C2&&C2(e,null),!Sn(t))return e;let n=t.length;for(;n--;){let r=t[n];if(typeof r=="string"){const o=i(r);o!==r&&(Q$(t)||(t[n]=o),r=o)}e[r]=!0}return e}function lH(e){for(let t=0;t<e.length;t++)di(e,t)||(e[t]=null);return e}function zn(e){const t=bl(null);for(const[i,n]of EA(e))di(e,i)&&(Sn(n)?t[i]=lH(n):n&&typeof n=="object"&&n.constructor===Object?t[i]=zn(n):t[i]=n);return t}function cH(e){switch(typeof e){case"string":return e;case"number":return rH(e);case"boolean":return aH(e);case"bigint":return A2?A2(e):"0";case"symbol":return R2?R2(e):"Symbol()";case"undefined":return cu(e);case"function":case"object":{if(e===null)return cu(e);const t=e,i=Sl(t,"toString");if(typeof i=="function"){const n=i(t);return typeof n=="string"?n:cu(n)}return cu(e)}default:return cu(e)}}function Sl(e,t){for(;e!==null;){const n=tH(e,t);if(n){if(n.get)return Ni(n.get);if(typeof n.value=="function")return Ni(n.value)}e=eH(e)}function i(){return null}return i}function uH(e){try{return sn(e,""),!0}catch{return!1}}const N2=kn(["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"]),T_=kn(["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"]),A_=kn(["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"]),hH=kn(["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"]),R_=kn(["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"]),dH=kn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),L2=kn(["#text"]),M2=kn(["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"]),N_=kn(["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"]),O2=kn(["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"]),Kd=kn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fH=Ls(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pH=Ls(/<%[\w\W]*|[\w\W]*%>/gm),mH=Ls(/\$\{[\w\W]*/gm),gH=Ls(/^data-[\-\w.\u00B7-\uFFFF]+$/),_H=Ls(/^aria-[\-\w]+$/),TA=Ls(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vH=Ls(/^(?:\w+script|data):/i),yH=Ls(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),AA=Ls(/^html$/i),bH=Ls(/^[a-z][.\w]*(-[.\w]+)+$/i);var D2=Object.freeze({__proto__:null,ARIA_ATTR:_H,ATTR_WHITESPACE:yH,CUSTOM_ELEMENT:bH,DATA_ATTR:gH,DOCTYPE_NAME:AA,ERB_EXPR:pH,IS_ALLOWED_URI:TA,IS_SCRIPT_OR_DATA:vH,MUSTACHE_EXPR:fH,TMPLIT_EXPR:mH});const uu={element:1,text:3,progressingInstruction:7,comment:8,document:9},SH=function(){return typeof window>"u"?null:window},wH=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const r="data-tt-policy-suffix";i&&i.hasAttribute(r)&&(n=i.getAttribute(r));const o="dompurify"+(n?"#"+n:"");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}},j2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function RA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:SH();const t=Me=>RA(Me);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==uu.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const n=i,r=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:d,Element:p,NodeFilter:f,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:v,DOMParser:y,trustedTypes:S}=e,w=p.prototype,x=Sl(w,"cloneNode"),k=Sl(w,"remove"),R=Sl(w,"nextSibling"),O=Sl(w,"childNodes"),I=Sl(w,"parentNode");if(typeof c=="function"){const Me=i.createElement("template");Me.content&&Me.content.ownerDocument&&(i=Me.content.ownerDocument)}let A,$="";const{implementation:L,createNodeIterator:H,createDocumentFragment:U,getElementsByTagName:oe}=i,{importNode:fe}=n;let K=j2();t.isSupported=typeof EA=="function"&&typeof I=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:N,TMPLIT_EXPR:D,DATA_ATTR:T,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:V}=D2;let{IS_ALLOWED_URI:Q}=D2,B=null;const Z=it({},[...N2,...T_,...A_,...R_,...L2]);let W=null;const re=it({},[...M2,...N_,...O2,...Kd]);let ie=Object.seal(bl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ve=null,xe=null;const Te=Object.seal(bl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ie=!0,_t=!0,qe=!1,Re=!0,Se=!1,Ue=!0,Ye=!1,pt=!1,nt=!1,ge=!1,Le=!1,Gt=!1,Wn=!0,Ks=!1;const Vs="user-content-";let Mt=!0,us=!1,Pi={},_i=null;const An=it({},["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 gn=null;const Gn=it({},["audio","video","img","source","image","track"]);let dr=null;const qn=it({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ln="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Ot="http://www.w3.org/1999/xhtml";let Dt=Ot,fr=!1,Li=null;const hs=it({},[ln,qt,Ot],E_);let Xi=it({},["mi","mo","mn","ms","mtext"]),ds=it({},["annotation-xml"]);const Ms=it({},["title","style","font","a","script"]);let jt=null;const G=["application/xhtml+xml","text/html"],ce="text/html";let _e=null,Pe=null;const Tt=i.createElement("form"),bt=function(F){return F instanceof RegExp||F instanceof Function},Ae=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Pe&&Pe===F)return;(!F||typeof F!="object")&&(F={}),F=zn(F),jt=G.indexOf(F.PARSER_MEDIA_TYPE)===-1?ce:F.PARSER_MEDIA_TYPE,_e=jt==="application/xhtml+xml"?E_:Eu,B=di(F,"ALLOWED_TAGS")&&Sn(F.ALLOWED_TAGS)?it({},F.ALLOWED_TAGS,_e):Z,W=di(F,"ALLOWED_ATTR")&&Sn(F.ALLOWED_ATTR)?it({},F.ALLOWED_ATTR,_e):re,Li=di(F,"ALLOWED_NAMESPACES")&&Sn(F.ALLOWED_NAMESPACES)?it({},F.ALLOWED_NAMESPACES,E_):hs,dr=di(F,"ADD_URI_SAFE_ATTR")&&Sn(F.ADD_URI_SAFE_ATTR)?it(zn(qn),F.ADD_URI_SAFE_ATTR,_e):qn,gn=di(F,"ADD_DATA_URI_TAGS")&&Sn(F.ADD_DATA_URI_TAGS)?it(zn(Gn),F.ADD_DATA_URI_TAGS,_e):Gn,_i=di(F,"FORBID_CONTENTS")&&Sn(F.FORBID_CONTENTS)?it({},F.FORBID_CONTENTS,_e):An,ve=di(F,"FORBID_TAGS")&&Sn(F.FORBID_TAGS)?it({},F.FORBID_TAGS,_e):zn({}),xe=di(F,"FORBID_ATTR")&&Sn(F.FORBID_ATTR)?it({},F.FORBID_ATTR,_e):zn({}),Pi=di(F,"USE_PROFILES")?F.USE_PROFILES&&typeof F.USE_PROFILES=="object"?zn(F.USE_PROFILES):F.USE_PROFILES:!1,Ie=F.ALLOW_ARIA_ATTR!==!1,_t=F.ALLOW_DATA_ATTR!==!1,qe=F.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=F.SAFE_FOR_TEMPLATES||!1,Ue=F.SAFE_FOR_XML!==!1,Ye=F.WHOLE_DOCUMENT||!1,ge=F.RETURN_DOM||!1,Le=F.RETURN_DOM_FRAGMENT||!1,Gt=F.RETURN_TRUSTED_TYPE||!1,nt=F.FORCE_BODY||!1,Wn=F.SANITIZE_DOM!==!1,Ks=F.SANITIZE_NAMED_PROPS||!1,Mt=F.KEEP_CONTENT!==!1,us=F.IN_PLACE||!1,Q=uH(F.ALLOWED_URI_REGEXP)?F.ALLOWED_URI_REGEXP:TA,Dt=typeof F.NAMESPACE=="string"?F.NAMESPACE:Ot,Xi=di(F,"MATHML_TEXT_INTEGRATION_POINTS")&&F.MATHML_TEXT_INTEGRATION_POINTS&&typeof F.MATHML_TEXT_INTEGRATION_POINTS=="object"?zn(F.MATHML_TEXT_INTEGRATION_POINTS):it({},["mi","mo","mn","ms","mtext"]),ds=di(F,"HTML_INTEGRATION_POINTS")&&F.HTML_INTEGRATION_POINTS&&typeof F.HTML_INTEGRATION_POINTS=="object"?zn(F.HTML_INTEGRATION_POINTS):it({},["annotation-xml"]);const ae=di(F,"CUSTOM_ELEMENT_HANDLING")&&F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING=="object"?zn(F.CUSTOM_ELEMENT_HANDLING):bl(null);if(ie=bl(null),di(ae,"tagNameCheck")&&bt(ae.tagNameCheck)&&(ie.tagNameCheck=ae.tagNameCheck),di(ae,"attributeNameCheck")&&bt(ae.attributeNameCheck)&&(ie.attributeNameCheck=ae.attributeNameCheck),di(ae,"allowCustomizedBuiltInElements")&&typeof ae.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=ae.allowCustomizedBuiltInElements),Se&&(_t=!1),Le&&(ge=!0),Pi&&(B=it({},L2),W=bl(null),Pi.html===!0&&(it(B,N2),it(W,M2)),Pi.svg===!0&&(it(B,T_),it(W,N_),it(W,Kd)),Pi.svgFilters===!0&&(it(B,A_),it(W,N_),it(W,Kd)),Pi.mathMl===!0&&(it(B,R_),it(W,O2),it(W,Kd))),Te.tagCheck=null,Te.attributeCheck=null,di(F,"ADD_TAGS")&&(typeof F.ADD_TAGS=="function"?Te.tagCheck=F.ADD_TAGS:Sn(F.ADD_TAGS)&&(B===Z&&(B=zn(B)),it(B,F.ADD_TAGS,_e))),di(F,"ADD_ATTR")&&(typeof F.ADD_ATTR=="function"?Te.attributeCheck=F.ADD_ATTR:Sn(F.ADD_ATTR)&&(W===re&&(W=zn(W)),it(W,F.ADD_ATTR,_e))),di(F,"ADD_URI_SAFE_ATTR")&&Sn(F.ADD_URI_SAFE_ATTR)&&it(dr,F.ADD_URI_SAFE_ATTR,_e),di(F,"FORBID_CONTENTS")&&Sn(F.FORBID_CONTENTS)&&(_i===An&&(_i=zn(_i)),it(_i,F.FORBID_CONTENTS,_e)),di(F,"ADD_FORBID_CONTENTS")&&Sn(F.ADD_FORBID_CONTENTS)&&(_i===An&&(_i=zn(_i)),it(_i,F.ADD_FORBID_CONTENTS,_e)),Mt&&(B["#text"]=!0),Ye&&it(B,["html","head","body"]),B.table&&(it(B,["tbody"]),delete ve.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw qd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=F.TRUSTED_TYPES_POLICY,$=A.createHTML("")}else A===void 0&&(A=wH(S,r)),A!==null&&typeof $=="string"&&($=A.createHTML(""));kn&&kn(F),Pe=F},ke=it({},[...T_,...A_,...hH]),$e=it({},[...R_,...dH]),Ft=function(F){let ae=I(F);(!ae||!ae.tagName)&&(ae={namespaceURI:Dt,tagName:"template"});const Ce=Eu(F.tagName),Ze=Eu(ae.tagName);return Li[F.namespaceURI]?F.namespaceURI===qt?ae.namespaceURI===Ot?Ce==="svg":ae.namespaceURI===ln?Ce==="svg"&&(Ze==="annotation-xml"||Xi[Ze]):!!ke[Ce]:F.namespaceURI===ln?ae.namespaceURI===Ot?Ce==="math":ae.namespaceURI===qt?Ce==="math"&&ds[Ze]:!!$e[Ce]:F.namespaceURI===Ot?ae.namespaceURI===qt&&!ds[Ze]||ae.namespaceURI===ln&&!Xi[Ze]?!1:!$e[Ce]&&(Ms[Ce]||!ke[Ce]):!!(jt==="application/xhtml+xml"&&Li[F.namespaceURI]):!1},st=function(F){lu(t.removed,{element:F});try{I(F).removeChild(F)}catch{k(F)}},Si=function(F,ae){try{lu(t.removed,{attribute:ae.getAttributeNode(F),from:ae})}catch{lu(t.removed,{attribute:null,from:ae})}if(ae.removeAttribute(F),F==="is")if(ge||Le)try{st(ae)}catch{}else try{ae.setAttribute(F,"")}catch{}},ue=function(F){let ae=null,Ce=null;if(nt)F="<remove></remove>"+F;else{const At=E2(F,/^[\r\n\t ]+/);Ce=At&&At[0]}jt==="application/xhtml+xml"&&Dt===Ot&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Ze=A?A.createHTML(F):F;if(Dt===Ot)try{ae=new y().parseFromString(Ze,jt)}catch{}if(!ae||!ae.documentElement){ae=L.createDocument(Dt,"template",null);try{ae.documentElement.innerHTML=fr?$:Ze}catch{}}const Qe=ae.body||ae.documentElement;return F&&Ce&&Qe.insertBefore(i.createTextNode(Ce),Qe.childNodes[0]||null),Dt===Ot?oe.call(ae,Ye?"html":"body")[0]:Ye?ae.documentElement:Qe},ut=function(F){return H.call(F.ownerDocument||F,F,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},St=function(F){return F instanceof v&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof g)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},He=function(F){return typeof d=="function"&&F instanceof d};function ye(Me,F,ae){ou(Me,Ce=>{Ce.call(t,F,ae,Pe)})}const vt=function(F){let ae=null;if(ye(K.beforeSanitizeElements,F,null),St(F))return st(F),!0;const Ce=_e(F.nodeName);if(ye(K.uponSanitizeElement,F,{tagName:Ce,allowedTags:B}),Ue&&F.hasChildNodes()&&!He(F.firstElementChild)&&sn(/<[/\w!]/g,F.innerHTML)&&sn(/<[/\w!]/g,F.textContent)||Ue&&F.namespaceURI===Ot&&Ce==="style"&&He(F.firstElementChild)||F.nodeType===uu.progressingInstruction||Ue&&F.nodeType===uu.comment&&sn(/<[/\w]/g,F.data))return st(F),!0;if(ve[Ce]||!(Te.tagCheck instanceof Function&&Te.tagCheck(Ce))&&!B[Ce]){if(!ve[Ce]&&cn(Ce)&&(ie.tagNameCheck instanceof RegExp&&sn(ie.tagNameCheck,Ce)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ce)))return!1;if(Mt&&!_i[Ce]){const Ze=I(F)||F.parentNode,Qe=O(F)||F.childNodes;if(Qe&&Ze){const At=Qe.length;for(let ei=At-1;ei>=0;--ei){const ti=x(Qe[ei],!0);Ze.insertBefore(ti,R(F))}}}return st(F),!0}return F instanceof p&&!Ft(F)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&sn(/<\/no(script|embed|frames)/i,F.innerHTML)?(st(F),!0):(Se&&F.nodeType===uu.text&&(ae=F.textContent,ou([z,N,D],Ze=>{ae=ml(ae,Ze," ")}),F.textContent!==ae&&(lu(t.removed,{element:F.cloneNode()}),F.textContent=ae)),ye(K.afterSanitizeElements,F,null),!1)},Qt=function(F,ae,Ce){if(xe[ae]||Wn&&(ae==="id"||ae==="name")&&(Ce in i||Ce in Tt))return!1;const Ze=W[ae]||Te.attributeCheck instanceof Function&&Te.attributeCheck(ae,F);if(!(_t&&!xe[ae]&&sn(T,ae))){if(!(Ie&&sn(E,ae))){if(!Ze||xe[ae]){if(!(cn(F)&&(ie.tagNameCheck instanceof RegExp&&sn(ie.tagNameCheck,F)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(F))&&(ie.attributeNameCheck instanceof RegExp&&sn(ie.attributeNameCheck,ae)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(ae,F))||ae==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&sn(ie.tagNameCheck,Ce)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ce))))return!1}else if(!dr[ae]){if(!sn(Q,ml(Ce,P,""))){if(!((ae==="src"||ae==="xlink:href"||ae==="href")&&F!=="script"&&T2(Ce,"data:")===0&&gn[F])){if(!(qe&&!sn(j,ml(Ce,P,"")))){if(Ce)return!1}}}}}}return!0},_n=it({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),cn=function(F){return!_n[Eu(F)]&&sn(V,F)},Kn=function(F){ye(K.beforeSanitizeAttributes,F,null);const{attributes:ae}=F;if(!ae||St(F))return;const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let Ze=ae.length;for(;Ze--;){const Qe=ae[Ze],{name:At,namespaceURI:ei,value:ti}=Qe,me=_e(At),je=ti;let Be=At==="value"?je:sH(je);if(Ce.attrName=me,Ce.attrValue=Be,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,ye(K.uponSanitizeAttribute,F,Ce),Be=Ce.attrValue,Ks&&(me==="id"||me==="name")&&T2(Be,Vs)!==0&&(Si(At,F),Be=Vs+Be),Ue&&sn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){Si(At,F);continue}if(me==="attributename"&&E2(Be,"href")){Si(At,F);continue}if(Ce.forceKeepAttr)continue;if(!Ce.keepAttr){Si(At,F);continue}if(!Re&&sn(/\/>/i,Be)){Si(At,F);continue}Se&&ou([z,N,D],ii=>{Be=ml(Be,ii," ")});const wt=_e(F.nodeName);if(!Qt(wt,me,Be)){Si(At,F);continue}if(A&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!ei)switch(S.getAttributeType(wt,me)){case"TrustedHTML":{Be=A.createHTML(Be);break}case"TrustedScriptURL":{Be=A.createScriptURL(Be);break}}if(Be!==je)try{ei?F.setAttributeNS(ei,At,Be):F.setAttribute(At,Be),St(F)?st(F):k2(t.removed)}catch{Si(At,F)}}ye(K.afterSanitizeAttributes,F,null)},un=function(F){let ae=null;const Ce=ut(F);for(ye(K.beforeSanitizeShadowDOM,F,null);ae=Ce.nextNode();)ye(K.uponSanitizeShadowNode,ae,null),vt(ae),Kn(ae),ae.content instanceof o&&un(ae.content);ye(K.afterSanitizeShadowDOM,F,null)};return t.sanitize=function(Me){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=null,Ce=null,Ze=null,Qe=null;if(fr=!Me,fr&&(Me="<!-->"),typeof Me!="string"&&!He(Me)&&(Me=cH(Me),typeof Me!="string"))throw qd("dirty is not a string, aborting");if(!t.isSupported)return Me;if(pt||Ae(F),t.removed=[],typeof Me=="string"&&(us=!1),us){const ti=Me.nodeName;if(typeof ti=="string"){const me=_e(ti);if(!B[me]||ve[me])throw qd("root node is forbidden and cannot be sanitized in-place")}}else if(Me instanceof d)ae=ue("<!---->"),Ce=ae.ownerDocument.importNode(Me,!0),Ce.nodeType===uu.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?ae=Ce:ae.appendChild(Ce);else{if(!ge&&!Se&&!Ye&&Me.indexOf("<")===-1)return A&&Gt?A.createHTML(Me):Me;if(ae=ue(Me),!ae)return ge?null:Gt?$:""}ae&&nt&&st(ae.firstChild);const At=ut(us?Me:ae);for(;Ze=At.nextNode();)vt(Ze),Kn(Ze),Ze.content instanceof o&&un(Ze.content);if(us)return Me;if(ge){if(Se){ae.normalize();let ti=ae.innerHTML;ou([z,N,D],me=>{ti=ml(ti,me," ")}),ae.innerHTML=ti}if(Le)for(Qe=U.call(ae.ownerDocument);ae.firstChild;)Qe.appendChild(ae.firstChild);else Qe=ae;return(W.shadowroot||W.shadowrootmode)&&(Qe=fe.call(n,Qe,!0)),Qe}let ei=Ye?ae.outerHTML:ae.innerHTML;return Ye&&B["!doctype"]&&ae.ownerDocument&&ae.ownerDocument.doctype&&ae.ownerDocument.doctype.name&&sn(AA,ae.ownerDocument.doctype.name)&&(ei="<!DOCTYPE "+ae.ownerDocument.doctype.name+`>
|
|
173
|
+
`+ei),Se&&ou([z,N,D],ti=>{ei=ml(ei,ti," ")}),A&&Gt?A.createHTML(ei):ei},t.setConfig=function(){let Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ae(Me),pt=!0},t.clearConfig=function(){Pe=null,pt=!1},t.isValidAttribute=function(Me,F,ae){Pe||Ae({});const Ce=_e(Me),Ze=_e(F);return Qt(Ce,Ze,ae)},t.addHook=function(Me,F){typeof F=="function"&&lu(K[Me],F)},t.removeHook=function(Me,F){if(F!==void 0){const ae=iH(K[Me],F);return ae===-1?void 0:nH(K[Me],ae,1)[0]}return k2(K[Me])},t.removeHooks=function(Me){K[Me]=[]},t.removeAllHooks=function(){K=j2()},t}var ju=RA(),L_,I2;function xH(){if(I2)return L_;I2=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(ce=>{const _e=G[ce],Pe=typeof _e;(Pe==="object"||Pe==="function")&&!Object.isFrozen(_e)&&e(_e)}),G}class t{constructor(ce){ce.data===void 0&&(ce.data={}),this.data=ce.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(G){return G.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function n(G,...ce){const _e=Object.create(null);for(const Pe in G)_e[Pe]=G[Pe];return ce.forEach(function(Pe){for(const Tt in Pe)_e[Tt]=Pe[Tt]}),_e}const r="</span>",o=G=>!!G.scope,c=(G,{prefix:ce})=>{if(G.startsWith("language:"))return G.replace("language:","language-");if(G.includes(".")){const _e=G.split(".");return[`${ce}${_e.shift()}`,..._e.map((Pe,Tt)=>`${Pe}${"_".repeat(Tt+1)}`)].join(" ")}return`${ce}${G}`};class d{constructor(ce,_e){this.buffer="",this.classPrefix=_e.classPrefix,ce.walk(this)}addText(ce){this.buffer+=i(ce)}openNode(ce){if(!o(ce))return;const _e=c(ce.scope,{prefix:this.classPrefix});this.span(_e)}closeNode(ce){o(ce)&&(this.buffer+=r)}value(){return this.buffer}span(ce){this.buffer+=`<span class="${ce}">`}}const p=(G={})=>{const ce={children:[]};return Object.assign(ce,G),ce};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(ce){this.top.children.push(ce)}openNode(ce){const _e=p({scope:ce});this.add(_e),this.stack.push(_e)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ce){return this.constructor._walk(ce,this.rootNode)}static _walk(ce,_e){return typeof _e=="string"?ce.addText(_e):_e.children&&(ce.openNode(_e),_e.children.forEach(Pe=>this._walk(ce,Pe)),ce.closeNode(_e)),ce}static _collapse(ce){typeof ce!="string"&&ce.children&&(ce.children.every(_e=>typeof _e=="string")?ce.children=[ce.children.join("")]:ce.children.forEach(_e=>{f._collapse(_e)}))}}class g extends f{constructor(ce){super(),this.options=ce}addText(ce){ce!==""&&this.add(ce)}startScope(ce){this.openNode(ce)}endScope(){this.closeNode()}__addSublanguage(ce,_e){const Pe=ce.root;_e&&(Pe.scope=`language:${_e}`),this.add(Pe)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function v(G){return G?typeof G=="string"?G:G.source:null}function y(G){return x("(?=",G,")")}function S(G){return x("(?:",G,")*")}function w(G){return x("(?:",G,")?")}function x(...G){return G.map(_e=>v(_e)).join("")}function k(G){const ce=G[G.length-1];return typeof ce=="object"&&ce.constructor===Object?(G.splice(G.length-1,1),ce):{}}function R(...G){return"("+(k(G).capture?"":"?:")+G.map(Pe=>v(Pe)).join("|")+")"}function O(G){return new RegExp(G.toString()+"|").exec("").length-1}function I(G,ce){const _e=G&&G.exec(ce);return _e&&_e.index===0}const A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function $(G,{joinWith:ce}){let _e=0;return G.map(Pe=>{_e+=1;const Tt=_e;let bt=v(Pe),Ae="";for(;bt.length>0;){const ke=A.exec(bt);if(!ke){Ae+=bt;break}Ae+=bt.substring(0,ke.index),bt=bt.substring(ke.index+ke[0].length),ke[0][0]==="\\"&&ke[1]?Ae+="\\"+String(Number(ke[1])+Tt):(Ae+=ke[0],ke[0]==="("&&_e++)}return Ae}).map(Pe=>`(${Pe})`).join(ce)}const L=/\b\B/,H="[a-zA-Z]\\w*",U="[a-zA-Z_]\\w*",oe="\\b\\d+(\\.\\d+)?",fe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",K="\\b(0b[01]+)",z="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",N=(G={})=>{const ce=/^#![ ]*\//;return G.binary&&(G.begin=x(ce,/.*\b/,G.binary,/\b.*/)),n({scope:"meta",begin:ce,end:/$/,relevance:0,"on:begin":(_e,Pe)=>{_e.index!==0&&Pe.ignoreMatch()}},G)},D={begin:"\\\\[\\s\\S]",relevance:0},T={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},E={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},j={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/},P=function(G,ce,_e={}){const Pe=n({scope:"comment",begin:G,end:ce,contains:[]},_e);Pe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Tt=R("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pe.contains.push({begin:x(/[ ]+/,"(",Tt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},V=P("//","$"),Q=P("/\\*","\\*/"),B=P("#","$"),Z={scope:"number",begin:oe,relevance:0},W={scope:"number",begin:fe,relevance:0},re={scope:"number",begin:K,relevance:0},ie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},ve={scope:"title",begin:H,relevance:0},xe={scope:"title",begin:U,relevance:0},Te={begin:"\\.\\s*"+U,relevance:0};var _t=Object.freeze({__proto__:null,APOS_STRING_MODE:T,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:re,BINARY_NUMBER_RE:K,COMMENT:P,C_BLOCK_COMMENT_MODE:Q,C_LINE_COMMENT_MODE:V,C_NUMBER_MODE:W,C_NUMBER_RE:fe,END_SAME_AS_BEGIN:function(G){return Object.assign(G,{"on:begin":(ce,_e)=>{_e.data._beginMatch=ce[1]},"on:end":(ce,_e)=>{_e.data._beginMatch!==ce[1]&&_e.ignoreMatch()}})},HASH_COMMENT_MODE:B,IDENT_RE:H,MATCH_NOTHING_RE:L,METHOD_GUARD:Te,NUMBER_MODE:Z,NUMBER_RE:oe,PHRASAL_WORDS_MODE:j,QUOTE_STRING_MODE:E,REGEXP_MODE:ie,RE_STARTERS_RE:z,SHEBANG:N,TITLE_MODE:ve,UNDERSCORE_IDENT_RE:U,UNDERSCORE_TITLE_MODE:xe});function qe(G,ce){G.input[G.index-1]==="."&&ce.ignoreMatch()}function Re(G,ce){G.className!==void 0&&(G.scope=G.className,delete G.className)}function Se(G,ce){ce&&G.beginKeywords&&(G.begin="\\b("+G.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",G.__beforeBegin=qe,G.keywords=G.keywords||G.beginKeywords,delete G.beginKeywords,G.relevance===void 0&&(G.relevance=0))}function Ue(G,ce){Array.isArray(G.illegal)&&(G.illegal=R(...G.illegal))}function Ye(G,ce){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 pt(G,ce){G.relevance===void 0&&(G.relevance=1)}const nt=(G,ce)=>{if(!G.beforeMatch)return;if(G.starts)throw new Error("beforeMatch cannot be used with starts");const _e=Object.assign({},G);Object.keys(G).forEach(Pe=>{delete G[Pe]}),G.keywords=_e.keywords,G.begin=x(_e.beforeMatch,y(_e.begin)),G.starts={relevance:0,contains:[Object.assign(_e,{endsParent:!0})]},G.relevance=0,delete _e.beforeMatch},ge=["of","and","for","in","not","or","if","then","parent","list","value"],Le="keyword";function Gt(G,ce,_e=Le){const Pe=Object.create(null);return typeof G=="string"?Tt(_e,G.split(" ")):Array.isArray(G)?Tt(_e,G):Object.keys(G).forEach(function(bt){Object.assign(Pe,Gt(G[bt],ce,bt))}),Pe;function Tt(bt,Ae){ce&&(Ae=Ae.map(ke=>ke.toLowerCase())),Ae.forEach(function(ke){const $e=ke.split("|");Pe[$e[0]]=[bt,Wn($e[0],$e[1])]})}}function Wn(G,ce){return ce?Number(ce):Ks(G)?0:1}function Ks(G){return ge.includes(G.toLowerCase())}const Vs={},Mt=G=>{console.error(G)},us=(G,...ce)=>{console.log(`WARN: ${G}`,...ce)},Pi=(G,ce)=>{Vs[`${G}/${ce}`]||(console.log(`Deprecated as of ${G}. ${ce}`),Vs[`${G}/${ce}`]=!0)},_i=new Error;function An(G,ce,{key:_e}){let Pe=0;const Tt=G[_e],bt={},Ae={};for(let ke=1;ke<=ce.length;ke++)Ae[ke+Pe]=Tt[ke],bt[ke+Pe]=!0,Pe+=O(ce[ke-1]);G[_e]=Ae,G[_e]._emit=bt,G[_e]._multi=!0}function gn(G){if(Array.isArray(G.begin)){if(G.skip||G.excludeBegin||G.returnBegin)throw Mt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),_i;if(typeof G.beginScope!="object"||G.beginScope===null)throw Mt("beginScope must be object"),_i;An(G,G.begin,{key:"beginScope"}),G.begin=$(G.begin,{joinWith:""})}}function Gn(G){if(Array.isArray(G.end)){if(G.skip||G.excludeEnd||G.returnEnd)throw Mt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),_i;if(typeof G.endScope!="object"||G.endScope===null)throw Mt("endScope must be object"),_i;An(G,G.end,{key:"endScope"}),G.end=$(G.end,{joinWith:""})}}function dr(G){G.scope&&typeof G.scope=="object"&&G.scope!==null&&(G.beginScope=G.scope,delete G.scope)}function qn(G){dr(G),typeof G.beginScope=="string"&&(G.beginScope={_wrap:G.beginScope}),typeof G.endScope=="string"&&(G.endScope={_wrap:G.endScope}),gn(G),Gn(G)}function ln(G){function ce(Ae,ke){return new RegExp(v(Ae),"m"+(G.case_insensitive?"i":"")+(G.unicodeRegex?"u":"")+(ke?"g":""))}class _e{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ke,$e){$e.position=this.position++,this.matchIndexes[this.matchAt]=$e,this.regexes.push([$e,ke]),this.matchAt+=O(ke)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ke=this.regexes.map($e=>$e[1]);this.matcherRe=ce($(ke,{joinWith:"|"}),!0),this.lastIndex=0}exec(ke){this.matcherRe.lastIndex=this.lastIndex;const $e=this.matcherRe.exec(ke);if(!$e)return null;const Ft=$e.findIndex((Si,ue)=>ue>0&&Si!==void 0),st=this.matchIndexes[Ft];return $e.splice(0,Ft),Object.assign($e,st)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ke){if(this.multiRegexes[ke])return this.multiRegexes[ke];const $e=new _e;return this.rules.slice(ke).forEach(([Ft,st])=>$e.addRule(Ft,st)),$e.compile(),this.multiRegexes[ke]=$e,$e}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ke,$e){this.rules.push([ke,$e]),$e.type==="begin"&&this.count++}exec(ke){const $e=this.getMatcher(this.regexIndex);$e.lastIndex=this.lastIndex;let Ft=$e.exec(ke);if(this.resumingScanAtSamePosition()&&!(Ft&&Ft.index===this.lastIndex)){const st=this.getMatcher(0);st.lastIndex=this.lastIndex+1,Ft=st.exec(ke)}return Ft&&(this.regexIndex+=Ft.position+1,this.regexIndex===this.count&&this.considerAll()),Ft}}function Tt(Ae){const ke=new Pe;return Ae.contains.forEach($e=>ke.addRule($e.begin,{rule:$e,type:"begin"})),Ae.terminatorEnd&&ke.addRule(Ae.terminatorEnd,{type:"end"}),Ae.illegal&&ke.addRule(Ae.illegal,{type:"illegal"}),ke}function bt(Ae,ke){const $e=Ae;if(Ae.isCompiled)return $e;[Re,Ye,qn,nt].forEach(st=>st(Ae,ke)),G.compilerExtensions.forEach(st=>st(Ae,ke)),Ae.__beforeBegin=null,[Se,Ue,pt].forEach(st=>st(Ae,ke)),Ae.isCompiled=!0;let Ft=null;return typeof Ae.keywords=="object"&&Ae.keywords.$pattern&&(Ae.keywords=Object.assign({},Ae.keywords),Ft=Ae.keywords.$pattern,delete Ae.keywords.$pattern),Ft=Ft||/\w+/,Ae.keywords&&(Ae.keywords=Gt(Ae.keywords,G.case_insensitive)),$e.keywordPatternRe=ce(Ft,!0),ke&&(Ae.begin||(Ae.begin=/\B|\b/),$e.beginRe=ce($e.begin),!Ae.end&&!Ae.endsWithParent&&(Ae.end=/\B|\b/),Ae.end&&($e.endRe=ce($e.end)),$e.terminatorEnd=v($e.end)||"",Ae.endsWithParent&&ke.terminatorEnd&&($e.terminatorEnd+=(Ae.end?"|":"")+ke.terminatorEnd)),Ae.illegal&&($e.illegalRe=ce(Ae.illegal)),Ae.contains||(Ae.contains=[]),Ae.contains=[].concat(...Ae.contains.map(function(st){return Ot(st==="self"?Ae:st)})),Ae.contains.forEach(function(st){bt(st,$e)}),Ae.starts&&bt(Ae.starts,ke),$e.matcher=Tt($e),$e}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=n(G.classNameAliases||{}),bt(G)}function qt(G){return G?G.endsWithParent||qt(G.starts):!1}function Ot(G){return G.variants&&!G.cachedVariants&&(G.cachedVariants=G.variants.map(function(ce){return n(G,{variants:null},ce)})),G.cachedVariants?G.cachedVariants:qt(G)?n(G,{starts:G.starts?n(G.starts):null}):Object.isFrozen(G)?n(G):G}var Dt="11.11.1";class fr extends Error{constructor(ce,_e){super(ce),this.name="HTMLInjectionError",this.html=_e}}const Li=i,hs=n,Xi=Symbol("nomatch"),ds=7,Ms=function(G){const ce=Object.create(null),_e=Object.create(null),Pe=[];let Tt=!0;const bt="Could not find the language '{}', did you forget to load/include a language module?",Ae={disableAutodetect:!0,name:"Plain text",contains:[]};let ke={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function $e(me){return ke.noHighlightRe.test(me)}function Ft(me){let je=me.className+" ";je+=me.parentNode?me.parentNode.className:"";const Be=ke.languageDetectRe.exec(je);if(Be){const wt=F(Be[1]);return wt||(us(bt.replace("{}",Be[1])),us("Falling back to no-highlight mode for this block.",me)),wt?Be[1]:"no-highlight"}return je.split(/\s+/).find(wt=>$e(wt)||F(wt))}function st(me,je,Be){let wt="",ii="";typeof je=="object"?(wt=me,Be=je.ignoreIllegals,ii=je.language):(Pi("10.7.0","highlight(lang, code, ...args) has been deprecated."),Pi("10.7.0",`Please use highlight(code, options) instead.
|
|
174
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),ii=me,wt=je),Be===void 0&&(Be=!0);const hn={code:wt,language:ii};ei("before:highlight",hn);const Vn=hn.result?hn.result:Si(hn.language,hn.code,Be);return Vn.code=hn.code,ei("after:highlight",Vn),Vn}function Si(me,je,Be,wt){const ii=Object.create(null);function hn(we,Oe){return we.keywords[Oe]}function Vn(){if(!Ge.keywords){wi.addText(Rt);return}let we=0;Ge.keywordPatternRe.lastIndex=0;let Oe=Ge.keywordPatternRe.exec(Rt),Je="";for(;Oe;){Je+=Rt.substring(we,Oe.index);const ht=Zi.case_insensitive?Oe[0].toLowerCase():Oe[0],ai=hn(Ge,ht);if(ai){const[fs,nc]=ai;if(wi.addText(Je),Je="",ii[ht]=(ii[ht]||0)+1,ii[ht]<=ds&&(Vr+=nc),fs.startsWith("_"))Je+=Oe[0];else{const yh=Zi.classNameAliases[fs]||fs;Yn(Oe[0],yh)}}else Je+=Oe[0];we=Ge.keywordPatternRe.lastIndex,Oe=Ge.keywordPatternRe.exec(Rt)}Je+=Rt.substring(we),wi.addText(Je)}function Rn(){if(Rt==="")return;let we=null;if(typeof Ge.subLanguage=="string"){if(!ce[Ge.subLanguage]){wi.addText(Rt);return}we=Si(Ge.subLanguage,Rt,!0,vh[Ge.subLanguage]),vh[Ge.subLanguage]=we._top}else we=ut(Rt,Ge.subLanguage.length?Ge.subLanguage:null);Ge.relevance>0&&(Vr+=we.relevance),wi.__addSublanguage(we._emitter,we.language)}function Wt(){Ge.subLanguage!=null?Rn():Vn(),Rt=""}function Yn(we,Oe){we!==""&&(wi.startScope(Oe),wi.addText(we),wi.endScope())}function gh(we,Oe){let Je=1;const ht=Oe.length-1;for(;Je<=ht;){if(!we._emit[Je]){Je++;continue}const ai=Zi.classNameAliases[we[Je]]||we[Je],fs=Oe[Je];ai?Yn(fs,ai):(Rt=fs,Vn(),Rt=""),Je++}}function Lo(we,Oe){return we.scope&&typeof we.scope=="string"&&wi.openNode(Zi.classNameAliases[we.scope]||we.scope),we.beginScope&&(we.beginScope._wrap?(Yn(Rt,Zi.classNameAliases[we.beginScope._wrap]||we.beginScope._wrap),Rt=""):we.beginScope._multi&&(gh(we.beginScope,Oe),Rt="")),Ge=Object.create(we,{parent:{value:Ge}}),Ge}function ec(we,Oe,Je){let ht=I(we.endRe,Je);if(ht){if(we["on:end"]){const ai=new t(we);we["on:end"](Oe,ai),ai.isMatchIgnored&&(ht=!1)}if(ht){for(;we.endsParent&&we.parent;)we=we.parent;return we}}if(we.endsWithParent)return ec(we.parent,Oe,Je)}function Mo(we){return Ge.matcher.regexIndex===0?(Rt+=we[0],1):(Yr=!0,0)}function Op(we){const Oe=we[0],Je=we.rule,ht=new t(Je),ai=[Je.__beforeBegin,Je["on:begin"]];for(const fs of ai)if(fs&&(fs(we,ht),ht.isMatchIgnored))return Mo(Oe);return Je.skip?Rt+=Oe:(Je.excludeBegin&&(Rt+=Oe),Wt(),!Je.returnBegin&&!Je.excludeBegin&&(Rt=Oe)),Lo(Je,we),Je.returnBegin?0:Oe.length}function Nn(we){const Oe=we[0],Je=je.substring(we.index),ht=ec(Ge,we,Je);if(!ht)return Xi;const ai=Ge;Ge.endScope&&Ge.endScope._wrap?(Wt(),Yn(Oe,Ge.endScope._wrap)):Ge.endScope&&Ge.endScope._multi?(Wt(),gh(Ge.endScope,we)):ai.skip?Rt+=Oe:(ai.returnEnd||ai.excludeEnd||(Rt+=Oe),Wt(),ai.excludeEnd&&(Rt=Oe));do Ge.scope&&wi.closeNode(),!Ge.skip&&!Ge.subLanguage&&(Vr+=Ge.relevance),Ge=Ge.parent;while(Ge!==ht.parent);return ht.starts&&Lo(ht.starts,we),ai.returnEnd?0:Oe.length}function tc(){const we=[];for(let Oe=Ge;Oe!==Zi;Oe=Oe.parent)Oe.scope&&we.unshift(Oe.scope);we.forEach(Oe=>wi.openNode(Oe))}let $a={};function Oo(we,Oe){const Je=Oe&&Oe[0];if(Rt+=we,Je==null)return Wt(),0;if($a.type==="begin"&&Oe.type==="end"&&$a.index===Oe.index&&Je===""){if(Rt+=je.slice(Oe.index,Oe.index+1),!Tt){const ht=new Error(`0 width match regex (${me})`);throw ht.languageName=me,ht.badRule=$a.rule,ht}return 1}if($a=Oe,Oe.type==="begin")return Op(Oe);if(Oe.type==="illegal"&&!Be){const ht=new Error('Illegal lexeme "'+Je+'" for mode "'+(Ge.scope||"<unnamed>")+'"');throw ht.mode=Ge,ht}else if(Oe.type==="end"){const ht=Nn(Oe);if(ht!==Xi)return ht}if(Oe.type==="illegal"&&Je==="")return Rt+=`
|
|
175
|
+
`,1;if(ic>1e5&&ic>Oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Rt+=Je,Je.length}const Zi=F(me);if(!Zi)throw Mt(bt.replace("{}",me)),new Error('Unknown language: "'+me+'"');const _h=ln(Zi);let Do="",Ge=wt||_h;const vh={},wi=new ke.__emitter(ke);tc();let Rt="",Vr=0,pr=0,ic=0,Yr=!1;try{if(Zi.__emitTokens)Zi.__emitTokens(je,wi);else{for(Ge.matcher.considerAll();;){ic++,Yr?Yr=!1:Ge.matcher.considerAll(),Ge.matcher.lastIndex=pr;const we=Ge.matcher.exec(je);if(!we)break;const Oe=je.substring(pr,we.index),Je=Oo(Oe,we);pr=we.index+Je}Oo(je.substring(pr))}return wi.finalize(),Do=wi.toHTML(),{language:me,value:Do,relevance:Vr,illegal:!1,_emitter:wi,_top:Ge}}catch(we){if(we.message&&we.message.includes("Illegal"))return{language:me,value:Li(je),illegal:!0,relevance:0,_illegalBy:{message:we.message,index:pr,context:je.slice(pr-100,pr+100),mode:we.mode,resultSoFar:Do},_emitter:wi};if(Tt)return{language:me,value:Li(je),illegal:!1,relevance:0,errorRaised:we,_emitter:wi,_top:Ge};throw we}}function ue(me){const je={value:Li(me),illegal:!1,relevance:0,_top:Ae,_emitter:new ke.__emitter(ke)};return je._emitter.addText(me),je}function ut(me,je){je=je||ke.languages||Object.keys(ce);const Be=ue(me),wt=je.filter(F).filter(Ce).map(Wt=>Si(Wt,me,!1));wt.unshift(Be);const ii=wt.sort((Wt,Yn)=>{if(Wt.relevance!==Yn.relevance)return Yn.relevance-Wt.relevance;if(Wt.language&&Yn.language){if(F(Wt.language).supersetOf===Yn.language)return 1;if(F(Yn.language).supersetOf===Wt.language)return-1}return 0}),[hn,Vn]=ii,Rn=hn;return Rn.secondBest=Vn,Rn}function St(me,je,Be){const wt=je&&_e[je]||Be;me.classList.add("hljs"),me.classList.add(`language-${wt}`)}function He(me){let je=null;const Be=Ft(me);if($e(Be))return;if(ei("before:highlightElement",{el:me,language:Be}),me.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",me);return}if(me.children.length>0&&(ke.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(me)),ke.throwUnescapedHTML))throw new fr("One of your code blocks includes unescaped HTML.",me.innerHTML);je=me;const wt=je.textContent,ii=Be?st(wt,{language:Be,ignoreIllegals:!0}):ut(wt);me.innerHTML=ii.value,me.dataset.highlighted="yes",St(me,Be,ii.language),me.result={language:ii.language,re:ii.relevance,relevance:ii.relevance},ii.secondBest&&(me.secondBest={language:ii.secondBest.language,relevance:ii.secondBest.relevance}),ei("after:highlightElement",{el:me,result:ii,text:wt})}function ye(me){ke=hs(ke,me)}const vt=()=>{cn(),Pi("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Qt(){cn(),Pi("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _n=!1;function cn(){function me(){cn()}if(document.readyState==="loading"){_n||window.addEventListener("DOMContentLoaded",me,!1),_n=!0;return}document.querySelectorAll(ke.cssSelector).forEach(He)}function Kn(me,je){let Be=null;try{Be=je(G)}catch(wt){if(Mt("Language definition for '{}' could not be registered.".replace("{}",me)),Tt)Mt(wt);else throw wt;Be=Ae}Be.name||(Be.name=me),ce[me]=Be,Be.rawDefinition=je.bind(null,G),Be.aliases&&ae(Be.aliases,{languageName:me})}function un(me){delete ce[me];for(const je of Object.keys(_e))_e[je]===me&&delete _e[je]}function Me(){return Object.keys(ce)}function F(me){return me=(me||"").toLowerCase(),ce[me]||ce[_e[me]]}function ae(me,{languageName:je}){typeof me=="string"&&(me=[me]),me.forEach(Be=>{_e[Be.toLowerCase()]=je})}function Ce(me){const je=F(me);return je&&!je.disableAutodetect}function Ze(me){me["before:highlightBlock"]&&!me["before:highlightElement"]&&(me["before:highlightElement"]=je=>{me["before:highlightBlock"](Object.assign({block:je.el},je))}),me["after:highlightBlock"]&&!me["after:highlightElement"]&&(me["after:highlightElement"]=je=>{me["after:highlightBlock"](Object.assign({block:je.el},je))})}function Qe(me){Ze(me),Pe.push(me)}function At(me){const je=Pe.indexOf(me);je!==-1&&Pe.splice(je,1)}function ei(me,je){const Be=me;Pe.forEach(function(wt){wt[Be]&&wt[Be](je)})}function ti(me){return Pi("10.7.0","highlightBlock will be removed entirely in v12.0"),Pi("10.7.0","Please use highlightElement now."),He(me)}Object.assign(G,{highlight:st,highlightAuto:ut,highlightAll:cn,highlightElement:He,highlightBlock:ti,configure:ye,initHighlighting:vt,initHighlightingOnLoad:Qt,registerLanguage:Kn,unregisterLanguage:un,listLanguages:Me,getLanguage:F,registerAliases:ae,autoDetection:Ce,inherit:hs,addPlugin:Qe,removePlugin:At}),G.debugMode=function(){Tt=!1},G.safeMode=function(){Tt=!0},G.versionString=Dt,G.regex={concat:x,lookahead:y,either:R,optional:w,anyNumberOfTimes:S};for(const me in _t)typeof _t[me]=="object"&&e(_t[me]);return Object.assign(G,_t),G},jt=Ms({});return jt.newInstance=()=>Ms({}),L_=jt,jt.HighlightJS=jt,jt.default=jt,L_}var CH=xH();const xs=lb(CH);function B2(e){const t=e.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});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,i,r]};r.contains.push(d);const p={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},v={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${y.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"],R={match:/(\/[a-z._-]+)+/},O=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],I=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],A=["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"],$=["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:[...O,...I,"set","shopt",...A,...$]},contains:[S,e.SHEBANG(),w,v,o,c,R,d,p,f,g,i]}}const P2="[A-Za-z$_][0-9A-Za-z$_]*",kH=["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"],EH=["true","false","null","undefined","NaN","Infinity"],NA=["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"],LA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],MA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],TH=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],AH=[].concat(MA,NA,LA);function z2(e){const t=e.regex,i=(P,{after:V})=>{const Q="</"+P[0].slice(1);return P.input.indexOf(Q,V)!==-1},n=P2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,V)=>{const Q=P[0].length+P.index,B=P.input[Q];if(B==="<"||B===","){V.ignoreMatch();return}B===">"&&(i(P,{after:Q})||V.ignoreMatch());let Z;const W=P.input.substring(Q);if(Z=W.match(/^\s*=/)){V.ignoreMatch();return}if((Z=W.match(/^\s+extends\s+/))&&Z.index===0){V.ignoreMatch();return}}},d={$pattern:P2,keyword:kH,literal:EH,built_in:AH,"variable.language":TH},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",v={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},O={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,{match:/\$\d+/},v];y.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const A=[].concat(O,y.contains),$=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(A)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},H={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],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:{_:[...NA,...LA]}},oe={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(P){return t.concat("(?!",P.join("|"),")")}const N={match:t.concat(/\b/,z([...MA,"super","import"].map(P=>`${P}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),oe,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,O,{match:/\$\d+/},v,U,{scope:"attr",match:n+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{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"]}]}]},fe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},N,K,H,T,{match:/\$[(.]/}]}}function RH(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[t,i,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function $2(e){const t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},v=e.inherit(f,{contains:[]}),y=e.inherit(g,{contains:[]});f.contains.push(y),g.contains.push(v);let S=[i,p];return[f,g,v,y].forEach(R=>{R.contains=R.contains.concat(S)}),S=S.concat(f,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},i,o,f,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,n,p,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function H2(e){const t=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["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:n,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},g={begin:/\{\{/,relevance:0},v={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y="[0-9](_?[0-9])*",S=`(\\b(${y}))?\\.(${y})|\\b(${y})\\.`,w=`\\b|${n.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${y})|(${S}))[eE][+-]?(${y})[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(${y})[jJ](?=${w})`}]},k={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},R={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,x,v,e.HASH_COMMENT_MODE]}]};return f.contains=[v,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"},v,k,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[R]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,R,v]}]}}const Qf="[A-Za-z$_][0-9A-Za-z$_]*",OA=["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"],DA=["true","false","null","undefined","NaN","Infinity"],jA=["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"],IA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],BA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],PA=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zA=[].concat(BA,jA,IA);function NH(e){const t=e.regex,i=(P,{after:V})=>{const Q="</"+P[0].slice(1);return P.input.indexOf(Q,V)!==-1},n=Qf,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,V)=>{const Q=P[0].length+P.index,B=P.input[Q];if(B==="<"||B===","){V.ignoreMatch();return}B===">"&&(i(P,{after:Q})||V.ignoreMatch());let Z;const W=P.input.substring(Q);if(Z=W.match(/^\s*=/)){V.ignoreMatch();return}if((Z=W.match(/^\s+extends\s+/))&&Z.index===0){V.ignoreMatch();return}}},d={$pattern:Qf,keyword:OA,literal:DA,built_in:zA,"variable.language":PA},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",v={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},O={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,{match:/\$\d+/},v];y.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const A=[].concat(O,y.contains),$=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(A)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},H={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],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:{_:[...jA,...IA]}},oe={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(P){return t.concat("(?!",P.join("|"),")")}const N={match:t.concat(/\b/,z([...BA,"super","import"].map(P=>`${P}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),oe,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,O,{match:/\$\d+/},v,U,{scope:"attr",match:n+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{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"]}]}]},fe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},N,K,H,T,{match:/\$[(.]/}]}}function F2(e){const t=e.regex,i=NH(e),n=Qf,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:[i.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:Qf,keyword:OA.concat(p),literal:DA,built_in:zA.concat(r),"variable.language":PA},g={className:"meta",begin:"@"+n},v=(x,k,R)=>{const O=x.contains.findIndex(I=>I.label===k);if(O===-1)throw new Error("can not find mode to replace");x.contains.splice(O,1,R)};Object.assign(i.keywords,f),i.exports.PARAMS_CONTAINS.push(g);const y=i.contains.find(x=>x.scope==="attr"),S=Object.assign({},y,{match:t.concat(n,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,y,S]),i.contains=i.contains.concat([g,o,c,S]),v(i,"shebang",e.SHEBANG()),v(i,"use_strict",d);const w=i.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}const LH=/\[\[wiki:([^\]]+)\]\]/g,MH=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,OH=/^(\S[^:]*?):[ \t]*(.*)$/,DH=new kA({gfm:!0,breaks:!1}),U2={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},M_=VH();function Qu(e,t={}){const{entries:i,content:n}=BH(e),r=$H(n,t.resolveWikiLink),o=DH.parse(r,{async:!1}),c=zH(i),d=ju.sanitize(c+o,U2),p=new DOMParser().parseFromString(d,"text/html");return FH(p,t.omitDuplicateTitle),HH(p),UH(p),GH(p),{html:ju.sanitize(p.body.innerHTML,U2),toc:qH(p)}}function jH(e){const t=new TextEncoder().encode(e);let i="";for(const n of t)i+=String.fromCharCode(n);return btoa(i)}function IH(e){const t=atob(e),i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return new TextDecoder().decode(i)}function BH(e){const t=MH.exec(e);return t?{entries:PH(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function PH(e){const t=[];for(const i of e.split(/\r?\n/)){const n=i.replace(/\s+$/,"");if(n.trim()==="")continue;const r=OH.exec(n);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=n.trim();o.value=o.value?`${o.value} ${c}`:c}return t}function zH(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${Iu(i.key)}</dt><dd>${Iu(i.value)}</dd>`).join("")}</dl>`}function $H(e,t){return e.replace(LH,(i,n)=>{const r=n.trim();if(!r)return"";if(!t)return Iu(`[[wiki:${r}]]`);const o=t(r);if(o===null)return Iu(`[[wiki:${r}]]`);const c=Iu(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${c}</a>`})}function HH(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const n=i.textContent?.trim()??"",r=ZH(n||"section"),o=t.get(r)??0;t.set(r,o+1),i.id=o===0?r:`${r}-${o+1}`}}function FH(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||W2(i.textContent??"")===W2(t)&&i.remove()}function UH(e){for(const t of e.querySelectorAll("pre > code")){const i=YH(t.className),n=t.textContent??"",r=t.parentElement;if(!r)continue;if(i==="mermaid"){const c=e.createElement("div");c.className="diagram-block",c.setAttribute("data-mermaid-source",jH(n)),c.setAttribute("data-diagram-state","pending"),r.replaceWith(c);continue}const o=KH(n,i);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=n,r.insertBefore(WH(e,i||"text"),r.firstChild)}}function WH(e,t){const i=e.createElement("div");i.className="code-block-toolbar";const n=e.createElement("span");n.className="code-block-dots",n.setAttribute("aria-hidden","true");for(let c=0;c<3;c++)n.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",i.append(n,r,o),i}function GH(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";XH(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function qH(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 KH(e,t){return t&&M_.getLanguage(t)?M_.highlight(e,{language:t}).value:M_.highlightAuto(e).value}function VH(){return xs.registerLanguage("bash",B2),xs.registerLanguage("sh",B2),xs.registerLanguage("javascript",z2),xs.registerLanguage("js",z2),xs.registerLanguage("json",RH),xs.registerLanguage("markdown",$2),xs.registerLanguage("md",$2),xs.registerLanguage("python",H2),xs.registerLanguage("py",H2),xs.registerLanguage("typescript",F2),xs.registerLanguage("ts",F2),xs}function YH(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function XH(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function ZH(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function W2(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Iu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const JH="modulepreload",QH=function(e){return"/console/"+e},G2={},eF=function(t,i,n){let r=Promise.resolve();if(i&&i.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");r=p(i.map(f=>{if(f=QH(f),f in G2)return;G2[f]=!0;const g=f.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${v}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":JH,g||(y.as="script"),y.crossOrigin="",y.href=f,d&&y.setAttribute("nonce",d),document.head.appendChild(y),g)return new Promise((S,w)=>{y.addEventListener("load",S),y.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)})},tF=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",iF=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),nF=/^on/i,sF={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},q2="diagramInteractionBound",rF=/^oklch\s*\(\s*([^)]+)\s*\)$/i,aF=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Ts=[25,50,75,100,125,150,200],oF=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let O_=null;const K2=new WeakSet;let lF=0,cF=0,eh=null;function Ra(e){const t=e.trim();if(!t)return t;const i=LF(t);return i?MF(i):t}function i0(e){if(K2.has(e))return;K2.add(e),V2(e);const t=e instanceof Node?e:document.body;new MutationObserver(n=>{let r=!1;for(const o of n)if(o.type==="childList"){eh&&!eh.trigger.isConnected&&Tu(!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&&V2(e)}).observe(t,{childList:!0,subtree:!0})}function V2(e){const t=e.querySelectorAll(tF);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",uF(i))}async function uF(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=IH(t)}catch{D_(e,"Invalid diagram source");return}if(!i.trim()){D_(e,"Empty diagram source");return}try{const n=await dF(),r=`mermaid-diagram-${++lF}`,{svg:o}=await n.render(r,i);e.innerHTML=hF(o),mF(e,o),gF(e),_F(e),e.dataset.diagramState="rendered"}catch(n){const r=n instanceof Error?n.message:String(n);D_(e,r)}}function D_(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function hF(e){const t=(i,n)=>{nF.test(n.attrName)&&(n.keepAttr=!1)};ju.addHook("uponSanitizeAttribute",t);try{return ju.sanitize(e,sF)}finally{ju.removeHook("uponSanitizeAttribute",t)}}async function dF(){return O_||(O_=(async()=>{const e=await eF(()=>import("./mermaid.core-CKMZH6J-.js").then(i=>i.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:fF(),themeCSS:pF(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),O_}function fF(){const e=getComputedStyle(document.documentElement),t=(x,k)=>{const R=e.getPropertyValue(x).trim();return Ra(R||k)},i=(x,k)=>e.getPropertyValue(x).trim()||k,n=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),c=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),p=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),v=t("--ink-pearl","#e6e9ef"),y=t("--ink-spectral","#bcc4d0"),S=[r,n,c,p,Ra("oklch(70% 0.11 68)"),d,Ra("oklch(76% 0.09 205)"),o,Ra("oklch(68% 0.14 30)"),g,Ra("oklch(62% 0.08 228)"),Ra("oklch(52% 0.05 248)")],w=Object.fromEntries(oF.map((x,k)=>[x,S[k]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:v,primaryBorderColor:n,secondaryColor:"transparent",secondaryTextColor:v,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:y,tertiaryBorderColor:n,lineColor:d,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:n,clusterBkg:"transparent",clusterBorder:n,pieTitleTextColor:r,pieTitleTextSize:i("--font-size-title-lg","19px"),pieSectionTextColor:v,pieSectionTextSize:i("--font-size-md","13px"),pieLegendTextColor:v,pieLegendTextSize:i("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function pF(){const e=getComputedStyle(document.documentElement),t=(f,g)=>{const v=e.getPropertyValue(f).trim();return Ra(v||g)},i=t("--brass-deep","#a0782a"),n=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),c=Ra("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
|
|
176
|
+
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
177
|
+
stroke: ${i};
|
|
178
|
+
fill: ${d};
|
|
179
|
+
}
|
|
180
|
+
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
181
|
+
stroke: ${r};
|
|
182
|
+
}
|
|
183
|
+
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
184
|
+
fill: ${p};
|
|
185
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
186
|
+
}
|
|
187
|
+
.pieCircle {
|
|
188
|
+
stroke: ${i};
|
|
189
|
+
stroke-width: 1.35px;
|
|
190
|
+
opacity: 0.96;
|
|
191
|
+
filter: drop-shadow(0 0 1.5px ${c});
|
|
192
|
+
}
|
|
193
|
+
.pieOuterCircle {
|
|
194
|
+
stroke: ${n};
|
|
195
|
+
opacity: 0.7;
|
|
196
|
+
}
|
|
197
|
+
.slice, .legend text, .pieTitleText {
|
|
198
|
+
fill: ${p};
|
|
199
|
+
paint-order: stroke;
|
|
200
|
+
stroke: ${o};
|
|
201
|
+
stroke-width: 3px;
|
|
202
|
+
stroke-linejoin: round;
|
|
203
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
204
|
+
}
|
|
205
|
+
.slice {
|
|
206
|
+
font-weight: 600;
|
|
207
|
+
letter-spacing: 0.04em;
|
|
208
|
+
font-style: italic;
|
|
209
|
+
}
|
|
210
|
+
.pieTitleText {
|
|
211
|
+
font-weight: 600;
|
|
212
|
+
letter-spacing: 0.12em;
|
|
213
|
+
font-style: italic;
|
|
214
|
+
}
|
|
215
|
+
.legend text {
|
|
216
|
+
font-weight: 500;
|
|
217
|
+
letter-spacing: 0.03em;
|
|
218
|
+
}
|
|
219
|
+
.legend rect {
|
|
220
|
+
rx: 999px;
|
|
221
|
+
ry: 999px;
|
|
222
|
+
opacity: 0.9;
|
|
223
|
+
stroke: ${o};
|
|
224
|
+
stroke-width: 1.5px;
|
|
225
|
+
paint-order: stroke;
|
|
226
|
+
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${n});
|
|
227
|
+
}
|
|
228
|
+
`}function mF(e,t){const i=new DOMParser().parseFromString(t,"image/svg+xml"),n=Array.from(i.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(n.length,r.length);for(let c=0;c<o;c++){const d=n[c],p=r[c];if(!d||!p)continue;const f=d.getAttribute("href")??d.getAttribute("xlink:href")??"",g=HA(f);g&&p.setAttribute("href",g)}}function gF(e){const t=e.querySelector("svg");if(!t)return;let i;try{i=t.getBBox()}catch{return}const{x:n,y:r,width:o,height:c}=i;!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(c)||n<0||r<0||o<=0||c<=0||t.setAttribute("viewBox",`${Tl(n)} ${Tl(r)} ${Tl(o)} ${Tl(c)}`)}function _F(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),AF(e),e.dataset[q2]!=="true"&&(e.dataset[q2]="true",e.addEventListener("click",vF),e.addEventListener("keydown",yF))}function vF(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||ep(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),$A(t))}function yF(e){if(e.key!=="Enter"&&e.key!==" "||ep(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),$A(t))}function $A(e){const t=e.querySelector("svg");if(!t)return;Tu(!1);const i=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",n=document.createElement(i?"dialog":"div"),r=++cF,o=`diagram-lightbox-title-${r}`;n.className="diagram-lightbox",n.setAttribute("aria-labelledby",o),i||(n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.tabIndex=-1);const c=document.createElement("div");c.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const p=document.createElement("h2");p.id=o,p.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const v=Vd("−","Zoom out","out"),y=document.createElement("span");y.className="diagram-lightbox__zoom-readout",y.setAttribute("aria-live","polite");const S=Vd("+","Zoom in","in"),w=Vd("Fit","Fit diagram to viewport","fit"),x=Vd("Reset","Reset diagram zoom","reset");g.append(v,y,S,w,x);const k=document.createElement("div");k.className="diagram-lightbox__viewport";const R=wF(t),O=t.cloneNode(!0);O.removeAttribute("style"),CF(O,`diagram-lightbox-svg-${r}`),k.append(O),d.append(p,g,f),c.append(d,k),n.append(c),document.body.append(n);const I=new bF(k,O,y,R);v.addEventListener("click",()=>I.zoomOut()),S.addEventListener("click",()=>I.zoomIn()),w.addEventListener("click",()=>I.fit()),x.addEventListener("click",()=>I.reset());const A=kF(n),$=U=>{(U.target===n||U.target===f)&&Tu(!0)},L=U=>{if(U.key==="Escape"){U.preventDefault(),Tu(!0);return}I.handleKeyboard(U)||U.key==="Tab"&&TF(U,n)},H={dialog:n,trigger:e,inertStates:A,onClick:$,onKeyDown:L,cleanupPanZoom:()=>I.destroy()};i&&(H.onCancel=U=>{U.preventDefault(),Tu(!0)},n.addEventListener("cancel",H.onCancel),n.showModal()),n.addEventListener("click",$),document.addEventListener("keydown",L,!0),eh=H,I.fit(),f.focus()}function Vd(e,t,i){const n=document.createElement("button");return n.className="diagram-lightbox__zoom-button",n.type="button",n.dataset.zoomAction=i,n.setAttribute("aria-label",t),n.textContent=e,n}class bF{constructor(t,i,n,r){this.viewport=t,this.svg=i,this.readout=n,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=Ts.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,Ts.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Ts.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,i=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,n=Math.min(t/this.baseSize.width,i/this.baseSize.height),r=Math.floor(n*100),o=Ts.findIndex(d=>d>r),c=o===-1?Ts.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-i)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(Yd(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Yd(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=Yd(this.zoomIndex),n=i/100;this.svg.setAttribute("width",Tl(this.baseSize.width*n)),this.svg.setAttribute("height",Tl(this.baseSize.height*n)),this.readout.textContent=`${i}%`}zoomAroundViewportCenter(t){const i=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,i.left+i.width/2,i.top+i.height/2)}zoomAroundPoint(t,i,n){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,c=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+i-c.left,p=this.viewport.scrollTop+n-c.top;this.applyZoom(t),this.viewport.scrollLeft=d/r*this.svgWidth-(i-c.left),this.viewport.scrollTop=p/o*this.svgHeight-(n-c.top)}onPointerDown=t=>{if(t.button!==0||ep(t.target))return;const i=t.pointerId??1;if(this.pointers.set(i,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:i},this.viewport.setPointerCapture?.(i)};onPointerMove=t=>{const i=t.pointerId??1;if(this.pointers.has(i)&&this.pointers.set(i,t),this.pinchStart&&this.pointers.size>=2){const n=this.pointerDistance()/this.pinchStart.distance,r=Yd(this.pinchStart.zoomIndex)*n;this.applyZoom(xF(r));return}!this.dragStart||this.dragStart.pointerId!==i||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const i=t.pointerId??1;this.pointers.delete(i),this.viewport.releasePointerCapture?.(i),this.dragStart?.pointerId===i&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const i=t.deltaY<0?Math.min(this.zoomIndex+1,Ts.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{ep(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Ts.indexOf(200)?Ts.indexOf(100):Ts.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,i]=Array.from(this.pointers.values());return!t||!i?1:Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY)}}function SF(e){const t=Y2(e.getAttribute("width")),i=Y2(e.getAttribute("height"));if(t&&i)return{width:t,height:i};const n=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=n[2],o=n[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:i??d??600}}function wF(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:SF(e)}function Y2(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)&&i>0?i:null}function Tl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function xF(e){let t=0,i=Number.POSITIVE_INFINITY;return Ts.forEach((n,r)=>{const o=Math.abs(n-e);o<i&&(i=o,t=r)}),t}function Yd(e){return Ts[e]??Ts[0]}function CF(e,t){const i=e.getAttribute("id")??"";e.setAttribute("id",t);const n=e.querySelector("style");!i||!n?.textContent||(n.textContent=n.textContent.split(`#${i}`).join(`#${t}`))}function Tu(e){const t=eh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),EF(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),eh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function kF(e){const t=[];for(const i of Array.from(document.body.children))!(i instanceof HTMLElement)||i===e||(t.push({element:i,ariaHidden:i.getAttribute("aria-hidden"),inert:i.inert}),i.inert=!0,i.setAttribute("aria-hidden","true"));return t}function EF(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 TF(e,t){const i=Array.from(t.querySelectorAll(iF)).filter(NF);if(i.length===0){e.preventDefault(),t.focus();return}const n=i[0],r=i[i.length-1];!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))}function AF(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function ep(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!RF(t)}function RF(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function NF(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function HA(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 n;try{n=new URL(t)}catch{return null}return n.origin!==window.location.origin?null:HA(n.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const n=t.slice(7);let r;try{r=decodeURIComponent(n)}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 LF(e){const t=rF.exec(e);if(!t)return null;const i=t[1]?.trim();if(!i)return null;const n=i.indexOf("/"),r=n>=0?i.slice(0,n):i,o=n>=0?i.slice(n+1).trim():"",c=r.trim().split(/[\s,]+/).filter(Boolean);if(c.length!==3)return null;const[d,p,f]=c;if(!d||!p||!f)return null;const g=j_(d,1),v=j_(p,.4),y=OF(f);if(g===null||v===null||y===null)return null;let S=1;if(n>=0){const w=j_(o,1);if(w===null)return null;S=w}return{L:g,C:v,h:y,alpha:S}}function MF(e){const t=e.h*Math.PI/180,i=e.C*Math.cos(t),n=e.C*Math.sin(t),r=e.L,o=r+.3963377774*i+.2158037573*n,c=r-.1055613458*i-.0638541728*n,d=r-.0894841775*i-1.291485548*n,p=o**3,f=c**3,g=d**3,v=4.0767416621*p-3.3077115913*f+.2309699292*g,y=-1.2684380046*p+2.6097574011*f-.3413193965*g,S=-.0041960863*p-.7034186147*f+1.707614701*g,w=Xd(I_(v)),x=Xd(I_(y)),k=Xd(I_(S));if(e.alpha<1){const R=Xd(e.alpha);return`#${ro(w)}${ro(x)}${ro(k)}${ro(R)}`}return`#${ro(w)}${ro(x)}${ro(k)}`}function j_(e,t){if(!e)return null;if(e.endsWith("%")){const n=Number(e.slice(0,-1));return Number.isFinite(n)?n/100*t:null}const i=Number(e);return Number.isFinite(i)?i:null}function OF(e){const t=aF.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function I_(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 Xd(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function ro(e){return e.toString(16).padStart(2,"0")}const DF=new Set([".png",".jpg",".jpeg",".webp",".gif"]),jF=new Set(["img.shields.io"]),IF=/^[a-z][a-z0-9+.-]*:/i;function X2(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||IF.test(i))return null;const n=FA(i);if(!n)return null;const r=zF(n);return r===null?null:$F(r,t)}function BF(e){const t=FA(e).toLowerCase();return[...DF].some(i=>t.endsWith(i))}function Z2(e,t,i=null){const n=i?`${i.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${n}${t}`)}`}function PF(e){try{const t=new URL(e);return t.protocol==="https:"&&jF.has(t.hostname)}catch{return!1}}function FA(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function zF(e){try{return decodeURI(e)}catch{return null}}function $F(e,t){const i=e.replace(/\\/g,"/"),n=t.replace(/\\/g,"/"),r=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",o=i.startsWith("/")?i:`${r}/${i}`,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 HF({content:e,onOpenPath:t,relativePath:i,theaterId:n,contextRelPath:r,truncated:o}){const c=b.useMemo(()=>{const y=Qu(e).html,S=new DOMParser().parseFromString(y,"text/html");return B_(S.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:n,contextRelPath:r}),S.body.innerHTML},[e,i,n,r]),d=b.useRef(null);b.useEffect(()=>{const y=d.current;if(!y)return;i0(y),B_(y,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:n,contextRelPath:r});const S=new MutationObserver(()=>B_(y,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:n,contextRelPath:r}));return S.observe(y,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>S.disconnect()},[c,i,n,r]);const p=b.useCallback(y=>{const S=y.target.closest('[data-action="copy-code"]');if(!S)return;const w=S.closest("pre")?.getAttribute("data-code");if(!w)return;navigator.clipboard?.writeText(w);const x=S.textContent;S.textContent="Copied",window.setTimeout(()=>{S.textContent=x},1200)},[]),f=b.useCallback(y=>{const w=y.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(y.preventDefault(),t(x))},[t]),g=b.useCallback(y=>{if(y.key!=="Enter"&&y.key!==" ")return;const w=y.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(y.preventDefault(),t(x))},[t]),v=b.useCallback(y=>{p(y),f(y)},[p,f]);return u.jsxs("div",{className:"fexp-md-wrap",children:[o&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:d,className:"markdown-body",onClick:v,onKeyDown:g,dangerouslySetInnerHTML:{__html:c}})]})}function B_(e,t){for(const i of e.querySelectorAll("a[href]")){const n=i.getAttribute("href")??"",r=X2(n,t.currentRelativePath);r?(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("data-fexp-open-path",r),i.removeAttribute("aria-disabled")):n&&!/^(https?:|mailto:|#)/i.test(n)&&(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("aria-disabled","true"))}for(const i of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const n=i.getAttribute("src")??"",r=i.getAttribute("data-fexp-local-image-path");if(i.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&n===Z2(t.theaterId,r,t.contextRelPath)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&PF(n)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const o=X2(n,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&o&&BF(o)){i.setAttribute("src",Z2(t.theaterId,o,t.contextRelPath)),i.setAttribute("data-fexp-local-image-path",o),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&FF(i)}}function FF(e){const t=e.getAttribute("alt")?.trim(),i=e.ownerDocument.createElement("span");i.className="fexp-md-blocked-image",i.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(i)}const UF=360,n0=248,s0=200,tp=160,ip=4;function WF(e){return e-s0-ip>=tp}function GF(e,t,i){const n=i-s0-ip;return n<tp?e:Math.max(tp,Math.min(n,e-t))}function qF(e){const t=s0+ip;return`minmax(0, 1fr) ${ip}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function KF(e){return e?UF:null}const UA="fleet-console.file-explorer.treePaneWidth",r0={selectedPath:null,viewState:{kind:"none"}},VF={...r0,treePaneWidth:n0},WA=new Map,J2=new Map,Ry=new Set;let np=QF();function YF(e){return b.useSyncExternalStore(JF,()=>ZF(e),()=>VF)}function Q2(e,t){e&&KA(e,{selectedPath:t})}function xa(e,t){e&&KA(e,{viewState:t})}function XF(e){np=VA(e);try{localStorage.setItem(UA,String(np))}catch{}GA()}function GA(){for(const e of Ry)e()}function qA(e){return WA.get(e)??r0}function ZF(e){const t=e??"__none__",i=e!=null?qA(e):r0,n=J2.get(t);if(n&&n.selectedPath===i.selectedPath&&n.viewState===i.viewState&&n.treePaneWidth===np)return n;const r={...i,treePaneWidth:np};return J2.set(t,r),r}function KA(e,t){WA.set(e,{...qA(e),...t}),GA()}function JF(e){return Ry.add(e),()=>{Ry.delete(e)}}function QF(){try{return VA(Number(localStorage.getItem(UA)))}catch{return n0}}function VA(e){return!Number.isFinite(e)||e<=0?n0:Math.max(tp,Math.round(e))}const eU=new Set([".png",".jpg",".jpeg",".webp",".gif"]),tU={id:"file-explorer",title:"Files",icon:sU,pathAware:!0,render:e=>u.jsx(nU,{...e})};function iU(e,t){return{listFolder:async i=>{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:xy(t,i??"")})});if(!n.ok){const c=await n.json();throw new Error(c.error??"list_failed")}const r=await n.json(),o=uA(t,r);if(!o)throw new Error("context_boundary");return o}}}function nU(e){const{theaterId:t}=e,i=e.pathContext.relPath,n=Yz(t,i),{selectedPath:r,viewState:o,treePaneWidth:c}=YF(n),d=b.useRef(c);d.current=c;const p=b.useRef(null),[f,g]=b.useState(!1),v=b.useMemo(()=>iU(t,i),[t,i]),y=b.useCallback(async(R,O)=>{if(!t){xa(t,{kind:"error",message:"no_theater"});return}Q2(n,R);const I=O??R.split("/").filter(Boolean).at(-1)??R,A=I.slice(I.lastIndexOf(".")).toLowerCase();if(eU.has(A)){const $=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(xy(i,R)??"")}`:"";xa(n,{kind:"image",relativePath:R,name:I,src:$});return}xa(n,{kind:"loading"});try{const $=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:xy(i,R)})});if(!$.ok){const U=await $.json();throw new Error(U.error??"read_failed")}const L=await $.json();if(L.binary){xa(n,{kind:"binary",name:I});return}const H=uA(i,{relativePath:L.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(H===void 0)throw new Error("context_boundary");xa(n,{kind:"code",relativePath:H,content:L.content,lang:L.lang,truncated:L.truncated})}catch($){const L=$ instanceof Error?$.message:"Unable to load file";L==="binary_file"?xa(n,{kind:"binary",name:I}):xa(n,{kind:"error",message:L})}},[i,n,t]),S=b.useCallback(async R=>{R.kind==="file"&&await y(R.relativePath,R.name)},[y]),w=b.useCallback(()=>{xa(n,{kind:"none"}),Q2(n,null)},[n]),x=b.useCallback(R=>{R.preventDefault();const O=p.current;if(!O)return;const I=O.getBoundingClientRect().width;if(!WF(I))return;const A=R.clientX,$=d.current;g(!0);const L=U=>{const oe=U.clientX-A,fe=GF($,oe,I);d.current=fe,XF(fe)},H=()=>{document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",H),g(!1)};document.addEventListener("pointermove",L),document.addEventListener("pointerup",H)},[]),k=o.kind!=="none";return b.useLayoutEffect(()=>{e.requestExtraWidth?.(KF(k))},[e,k]),u.jsxs("div",{ref:p,className:`fexp-root${k?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:k?{gridTemplateColumns:qF(c)}:void 0,children:[k&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:o.kind!=="loading"&&o.kind!=="error"?"relativePath"in o?o.relativePath:o.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:w,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[o.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),o.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:o.message}),o.kind==="code"&&o.lang==="markdown"&&u.jsx(HF,{content:o.content,onOpenPath:y,relativePath:o.relativePath,theaterId:t,truncated:o.truncated,contextRelPath:i}),o.kind==="code"&&o.lang!=="markdown"&&u.jsx(f$,{content:o.content,lang:o.lang,truncated:o.truncated}),o.kind==="image"&&u.jsx(g$,{src:o.src,name:o.name}),o.kind==="binary"&&u.jsx(i$,{name:o.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:x,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(Qz,{files:v,theaterId:t,contextKey:n,contextRelPath:i,selectedPath:r,onSelect:S},n)})]})}function sU(){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 rU={id:"file-explorer",railPanels:[tU]},aU=[rU],oU={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function lU(e){const t={dirs:{},files:[]};for(const i of e){const n=i.path.split("/");n.pop();let r=t;for(const o of n)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(i)}return t}function YA({files:e,selectedPath:t,onSelect:i}){const n=lU(e);return u.jsx(XA,{node:n,depth:0,selectedPath:t,onSelect:i})}function XA({node:e,depth:t,selectedPath:i,onSelect:n}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>u.jsx(cU,{dirKey:r,node:o,depth:t,selectedPath:i,onSelect:n},r)),e.files.map(r=>u.jsx(uU,{entry:r,depth:t,selectedPath:i,onSelect:n},r.path))]})}function cU({dirKey:e,node:t,depth:i,selectedPath:n,onSelect:r}){const[o,c]=b.useState(!1),d=b.useCallback(()=>c(v=>!v),[]);let p=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const v=Object.keys(f.dirs)[0];p+="/"+v,f=f.dirs[v]}const g=i*16+12;return u.jsxs("div",{className:`diff-folder${o?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-folder-row",style:{paddingLeft:`${g}px`},onClick:d,"aria-expanded":!o,children:[u.jsx("svg",{className:"diff-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"diff-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-folder-name",children:p})]}),!o&&u.jsx(XA,{node:f,depth:i+1,selectedPath:n,onSelect:r})]})}function uU({entry:e,depth:t,selectedPath:i,onSelect:n}){const r=e.path===i,o=b.useCallback(()=>n(e),[e,n]),c=t*16+12,d=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`diff-file-row${r?" is-cur":""}`,style:{paddingLeft:`${c}px`},title:e.path,onClick:o,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:oU[e.status]??e.status}),u.jsx("span",{className:"diff-file-name",children:u.jsx("span",{className:"diff-file-fn",children:d})}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const ek="fleet-console.diff.changesCollapsed",hU={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function dU(e,t){const i=t.toLowerCase();return i?e.filter(n=>n.path.toLowerCase().includes(i)):e}function fU(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function pU({ctx:e,viewMode:t,selectedPath:i,subPath:n,onSelect:r,filterText:o}){const[c,d]=b.useState({kind:"loading"}),[p,f]=b.useState(0),[g,v]=b.useState(()=>fU(ek));b.useEffect(()=>{if(!e.theaterId){d({kind:"error",message:"no_theater"});return}let k=!1;return d({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:n})}).then(async R=>{if(!R.ok){const A=(await R.json()).error??"git_failed";k||d(A==="no_git_repo"||A==="git_unavailable"?{kind:"notice",reason:A}:{kind:"error",message:A});return}const O=await R.json();k||d({kind:"ok",files:O.files})}).catch(R=>{k||d({kind:"error",message:R instanceof Error?R.message:"unknown"})}),()=>{k=!0}},[e.theaterId,n,p]);const y=b.useCallback(()=>f(k=>k+1),[]),S=b.useCallback(()=>{v(k=>{const R=!k;try{localStorage.setItem(ek,R?"1":"0")}catch{}return R})},[]),w=b.useMemo(()=>c.kind==="ok"?dU(c.files,o):[],[o,c]);if(c.kind==="loading")return u.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(c.kind==="notice"){const k=c.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",R=c.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return u.jsxs("div",{className:"diff-sections-notice",children:[u.jsx("strong",{className:"diff-notice-title",children:k}),u.jsx("span",{className:"diff-notice-body",children:R}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:y,children:"Retry"})]})}if(c.kind==="error")return u.jsxs("div",{className:"diff-sections-error",children:[u.jsx("span",{children:c.message}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:y,children:"Retry"})]});const x=o?`${w.length}/${c.files.length}`:String(c.files.length);return u.jsx("div",{className:"diff-sections",children:u.jsxs("div",{className:`diff-section${g?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-section-head",onClick:S,children:[u.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-section-name",children:"Changes"}),u.jsx("span",{className:"diff-count-badge",children:x})]}),!g&&u.jsx("div",{className:"diff-section-rows",children:w.length===0?u.jsx("div",{className:"diff-empty-row",children:o?"No matching items":"No changes"}):t==="tree"?u.jsx(YA,{files:w,selectedPath:i,onSelect:r}):w.map(k=>u.jsx(ZA,{entry:k,isSelected:k.path===i,onSelect:r},k.path))})]})})}function ZA({entry:e,isSelected:t,onSelect:i}){const n=b.useCallback(()=>i(e),[e,i]),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:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:n,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":hU[e.status]??e.status,children:e.status}),u.jsxs("span",{className:"diff-file-name",children:[u.jsx("span",{className:"diff-file-fn",children:d}),c&&u.jsx("span",{className:"diff-file-dir",children:c})]}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}function JA(e,t){return JSON.stringify([e,t])}const Ny=12,gl=28,P_=3,mU=5,tk=["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 hu(e){return e*Ny+6}function ao(e){return tk[e%tk.length]??"var(--ink-fog)"}function gU({node:e,laneCount:t,collapsed:i=!1}){const n=Math.max(t,1),r=i?10:0,o=n*Ny+r,c=hu(e.lane),d=gl/2;return u.jsxs("svg",{width:o,height:gl,viewBox:`0 0 ${o} ${gl}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(p=>u.jsx("line",{x1:hu(p),y1:0,x2:hu(p),y2:gl,stroke:ao(p),strokeWidth:1.5},`pt-${p}`)),e.connectAbove&&u.jsx("line",{x1:c,y1:0,x2:c,y2:d-P_,stroke:ao(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:c,y1:d+P_,x2:c,y2:gl,stroke:ao(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(p=>u.jsx("line",{x1:hu(p),y1:0,x2:c,y2:d,stroke:ao(p),strokeWidth:1.5,strokeLinecap:"round"},`mf-${p}`)),e.branchToLanes.map(p=>u.jsx("line",{x1:c,y1:d,x2:hu(p),y2:gl,stroke:ao(p),strokeWidth:1.5,strokeLinecap:"round"},`bt-${p}`)),e.isHead&&u.jsx("circle",{cx:c,cy:d,r:mU,fill:"none",stroke:ao(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:c,cy:d,r:P_,fill:ao(e.lane)}),i&&u.jsx("text",{x:n*Ny+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const z_=8;function _U(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],i=[];let n=!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,v=!1;const y=[];if(f.length===0){const x=t.indexOf(null);x>=0?g=x:t.length<z_?(g=t.length,t.push(null)):(n=!0,g=z_-1,t[g]=null,v=!0)}else{g=Math.min(...f);for(const x of f)x!==g&&(y.push(x),t[x]=null)}const S=[];if(p.length===0)t[g]=null;else{t[g]=v?null:p[0]??null;for(const x of p.slice(1))if(!(t.indexOf(x)>=0)){const R=t.indexOf(null);if(R>=0)t[R]=x,S.push(R);else if(t.length<z_){const O=t.length;t.push(x),S.push(O)}else n=!0}}const w=t.map((x,k)=>({h:x,i:k})).filter(({h:x,i:k})=>x!==null&&k!==g).map(({i:x})=>x);r=Math.max(r,g,...S,...w),i.push({lane:g,isHead:c.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[g]===p[0],passThroughLanes:w,mergeFromLanes:y,branchToLanes:S})}return{nodes:i,activeLaneCount:r+1,collapsed:n}}const vU=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 yU(e){let t="",i=0;const n=(r,o)=>`<span class="diff-token-${r}">${o}</span>`;for(;i<e.length;){const r=e[i];if(r==="&"){const o=e.indexOf(";",i+1);if(o>=0){t+=e.slice(i,o+1),i=o+1;continue}}if(r==="/"&&e[i+1]==="/"||r==="#"){t+=n("comment",e.slice(i));break}if(r==='"'||r==="'"||r==="`"){const o=r,c=i++;for(;i<e.length;){if(e[i]==="\\"){i+=2;continue}if(e[i++]===o)break}t+=n("string",e.slice(c,i));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[i-1]??"")){const o=i;for(;i<e.length&&/[0-9.xXa-fA-F]/.test(e[i]);)i++;t+=n("number",e.slice(o,i));continue}if(/[A-Za-z_$]/.test(r)){const o=i;for(;i<e.length&&/[A-Za-z0-9_$]/.test(e[i]);)i++;const c=e.slice(o,i);t+=vU.has(c)?n("keyword",c):/^[A-Z]/.test(c)?n("type",c):c;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=n("punctuation",r),i++;continue}t+=r,i++}return t}const bU=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,SU=/^diff --git a\/(.+) b\/(.+)$/;function wU(e){if(!e)return[];const t=e.split(`
|
|
229
|
+
`);t[t.length-1]===""&&t.pop();const i=[];let n=0,r=0,o=!0;for(const c of t)if(!c.startsWith("\\")){if(c.startsWith("diff --git ")){const d=SU.exec(c),p=d?.[1],f=d?.[2]??c,g=p!==void 0&&p!==f?p:void 0;i.push({kind:"file-label",text:f,oldPath:g}),o=!0;continue}if(o){if(c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("rename from ")||c.startsWith("rename to ")||c.startsWith("similarity index")||c.startsWith("dissimilarity index")){i.push({kind:"meta",text:c});continue}if(c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ "))continue;if(!c.startsWith("@@")){c!==""&&i.push({kind:"ctx",text:` ${c}`});continue}}if(c.startsWith("@@")){o=!1;const d=bU.exec(c);if(d){n=parseInt(d[1]??"0",10),r=parseInt(d[2]??"0",10);const p=d[3]?.trimEnd()??"",f=`@@ -${d[1]??""} +${d[2]??""} @@${p?` ${p.trimStart()}`:""}`;i.push({kind:"hunk-label",text:f})}else i.push({kind:"hunk-label",text:c});continue}c.startsWith("+")?i.push({kind:"add",text:c,newLine:r++}):c.startsWith("-")?i.push({kind:"del",text:c,oldLine:n++}):i.push({kind:"ctx",text:c,oldLine:n++,newLine:r++})}return i}function Zd(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function QA({ctx:e,file:t,mode:i,subPath:n,commit:r}){const[o,c]=b.useState({kind:"loading"});if(b.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let g=!1;return c({kind:"loading"}),r?e.api.fetch("diff","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,ref:r.fullHash,filePath:t.path,...t.oldPath??r.oldPath?{oldPath:t.oldPath??r.oldPath}:{},subPath:r.subPath})}).then(async v=>{if(!v.ok)throw new Error((await v.json()).error??"git_failed");const y=await v.json();g||c({kind:"ok",result:y})}).catch(v=>{g||c({kind:"error",message:v instanceof Error?v.message:"unknown"})}):e.api.fetch("diff","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,filePath:t.path,mode:i,subPath:n})}).then(async v=>{if(!v.ok)throw new Error((await v.json()).error??"git_failed");const y=await v.json();g||c({kind:"ok",result:y})}).catch(v=>{g||c({kind:"error",message:v instanceof Error?v.message:"unknown"})}),()=>{g=!0}},[e.api,e.theaterId,t.oldPath,t.path,i,n,r]),o.kind==="loading")return u.jsx("div",{className:"diff-hunk-loading",children:"Loading…"});if(o.kind==="error")return u.jsx("div",{className:"diff-hunk-error",children:o.message});const{result:d}=o,f=wU(d.content).filter(g=>g.kind!=="file-label");return u.jsxs("div",{className:"diff-hunk-wrap",children:[d.truncated&&u.jsx("div",{className:"diff-truncated-badge",children:"Diff truncated"}),u.jsx("div",{className:"diff-hunk-scroll",children:u.jsx("table",{className:"diff-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:f.map((g,v)=>u.jsx("tr",{className:`diff-line diff-line-${g.kind}`,children:g.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:Zd(g.text)}}):g.kind==="meta"?u.jsx("td",{colSpan:4,className:"diff-line-meta",dangerouslySetInnerHTML:{__html:Zd(g.text)}}):g.kind==="file-label"?u.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:Zd(g.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"diff-gutter diff-gutter-old",children:g.oldLine??""}),u.jsx("td",{className:"diff-gutter diff-gutter-new",children:g.newLine??""}),u.jsx("td",{className:"diff-marker",children:g.kind==="add"?"+":g.kind==="del"?"−":""}),u.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:yU(Zd(g.text.length>0?g.text.slice(1):g.text))}})]})},v))})})})]})}function eR(e,t=new Date){const i=new Date(e*1e3);if(!Number.isFinite(i.getTime()))return"—";const n=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),c=Math.round((r-o)/864e5);return c===0?`Today ${n}`:c===1?`Yesterday ${n}`:`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function a0(e){const t=[];for(const i of e.refs)if(i==="HEAD")t.push({label:"HEAD",kind:"head"});else if(i.startsWith("HEAD -> refs/heads/"))t.push({label:i.slice(19),kind:"branch"});else if(i.startsWith("HEAD -> "))t.push({label:i.slice(8),kind:"branch"});else if(i.startsWith("tag: refs/tags/"))t.push({label:i.slice(15),kind:"tag"});else if(i.startsWith("tag: "))t.push({label:i.slice(5),kind:"tag"});else if(i.startsWith("refs/remotes/")){const n=i.slice(13);n.endsWith("/HEAD")||t.push({label:n,kind:"remote"})}else i.startsWith("refs/worktrees/")?t.push({label:i.slice(15),kind:"worktree"}):i.startsWith("refs/heads/")?t.push({label:i.slice(11),kind:"branch"}):t.push({label:i,kind:"branch"});return t}const tR=140,iR=140,Ur=4,nR=null;function xU({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:n,hunkPaneMinWidth:r,dividerWidth:o}){const c=i-r-o;return c<n?nR:Math.max(n,Math.min(c,e-t))}function CU(e){const t=tR+Ur;return`minmax(0, 1fr) ${Ur}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function kU(e){const t=iR+Ur;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Ur}px minmax(0, 1fr)`}function sR(e,t,i,n,r,o=Ur){const c=i-r-o;return c<n?nR:Math.max(n,Math.min(c,e+t))}function EU(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Ur}px minmax(120px, 1fr)`}function TU(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Ur}px minmax(140px, 1fr)`}function rR({documentTarget:e,windowTarget:t,onMove:i,onFinish:n}){let r=!0;const o=()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",c),t.removeEventListener("blur",c)},c=()=>{r&&(r=!1,o(),n())},d=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",i),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),t.addEventListener("blur",c),d}const AU=400,aR="fleet-console.history.listPaneWidth",ik="fleet-console.history.headerHeight",nk="fleet-console.history.fileListWidth",oR="fleet-console.history.filesView",RU=360,lR=220,NU=214,LU=180;function MU(e,t){return t.find(i=>i.branch===null&&i.sha===e.fullHash)??null}function OU(e,t){const i=t.toLowerCase();return i?e.filter(n=>n.subject.toLowerCase().includes(i)||n.authorName.toLowerCase().includes(i)||n.shortHash.toLowerCase().includes(i)||n.fullHash.toLowerCase().includes(i)||n.refs.some(r=>r.toLowerCase().includes(i))||a0(n).some(r=>r.label.toLowerCase().includes(i))):e}function DU(e){return e==="Escape"}function sk({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 jU({entry:e,checkouts:t,selected:i,graphNode:n,laneCount:r,layoutCollapsed:o,onSelect:c}){const d=a0(e),p=MU(e,t);return u.jsxs("button",{type:"button",className:`history-commit-row${i?" 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:eR(e.authorAt)}),u.jsxs("span",{className:"history-commit-badges",children:[d.map(f=>{const g=f.kind==="branch"?t.find(v=>v.branch===f.label):null;return u.jsxs("span",{className:`history-badge history-badge--${f.kind}`,children:[g&&u.jsx(sk,{current:g.isCurrent}),f.label]},`${f.kind}:${f.label}`)}),p&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(sk,{current:p.isCurrent}),"detached"]})]}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(gU,{node:n,laneCount:r,collapsed:o})})]})}function IU({ctx:e,target:t,onSelectCommit:i,onClose:n}){const[r,o]=b.useState({kind:"loading"}),[c,d]=b.useState("details"),[p,f]=b.useState(null),[g,v]=b.useState(!1),[y,S]=b.useState(()=>Ly(ik,NU)),[w,x]=b.useState(()=>Ly(nk,LU)),[k,R]=b.useState(HU),O=b.useRef(null),I=b.useRef(null),A=b.useRef(null),$=b.useRef(y),L=b.useRef(w),H=b.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??"",subPath:e.pathContext.relPath??""}),[t.fullHash,e.theaterId,e.pathContext.relPath]);b.useEffect(()=>{let fe=!1;return o({kind:"loading"}),e.api.fetch("diff","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,ref:t.fullHash,subPath:e.pathContext.relPath??""})}).then(async K=>{if(!K.ok)throw new Error((await K.json()).error??"git_failed");return K.json()}).then(K=>{fe||(o({kind:"ok",result:K}),f(K.files[0]?.path??null))}).catch(K=>{fe||o({kind:"error",message:K instanceof Error?K.message:"unknown"})}),()=>{fe=!0}},[e.api,e.pathContext.relPath,e.theaterId,t.fullHash]),b.useEffect(()=>()=>A.current?.(),[]);const U=b.useCallback((fe,K)=>{fe.preventDefault();const z=K==="y"?O.current:I.current;if(!z)return;const N=K==="y"?$.current:L.current,D=K==="y"?fe.clientY:fe.clientX,T=K==="y"?z.getBoundingClientRect().height:z.getBoundingClientRect().width;A.current?.(),A.current=rR({documentTarget:document,windowTarget:window,onMove:E=>{const j=E,P=sR(N,(K==="y"?j.clientY:j.clientX)-D,T,120,120);P!==null&&(K==="y"?($.current=P,S(P)):(L.current=P,x(P)))},onFinish:()=>{const E=K==="y"?$.current:L.current;try{localStorage.setItem(K==="y"?ik:nk,String(E))}catch{}A.current=null}})},[]),oe=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:fe,files:K}=r.result,z=K.find(V=>V.path===p)??K[0]??null,N=K.reduce((V,Q)=>V+Q.additions,0),D=K.reduce((V,Q)=>V+Q.deletions,0),T=t.entry,E=(V,Q)=>{f(V.path),Q&&d("changes")},j=V=>{R(V);try{localStorage.setItem(oR,V)}catch{}},P=()=>{const V=navigator.clipboard?.writeText(t.fullHash);V&&V.then(()=>{v(!0),window.setTimeout(()=>v(!1),1200)}).catch(()=>{})};return c==="details"?u.jsxs("div",{ref:O,className:"history-details-tab",style:{gridTemplateRows:EU(y)},children:[u.jsx(BU,{meta:fe,entry:T,fullHash:t.fullHash,copied:g,onCopy:P,onParent:V=>i({fullHash:V})}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:V=>U(V,"y")}),u.jsx(rk,{files:K,selectedPath:p,additions:N,deletions:D,viewMode:k,onViewMode:j,onSelect:V=>E(V,!0)})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:I,className:"history-changes-columns",style:{gridTemplateColumns:TU(w)},children:[u.jsx(rk,{files:K,selectedPath:p,additions:N,deletions:D,viewMode:k,onViewMode:j,onSelect:V=>E(V,!1)}),u.jsx("div",{className:"history-divider",onPointerDown:V=>U(V,"x")}),z?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-diff-head",children:[u.jsx("span",{title:z.path,children:z.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":"Previous file",disabled:K.indexOf(z)===0,onClick:()=>E(K[K.indexOf(z)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":"Next file",disabled:K.indexOf(z)===K.length-1,onClick:()=>E(K[K.indexOf(z)+1],!1),children:"›"})]})]}),u.jsx(QA,{ctx:e,file:z,mode:"unified",subPath:e.pathContext.relPath??"",commit:H})]}):u.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return u.jsxs("div",{className:"history-inspector",onKeyDown:fe=>{DU(fe.key)&&(fe.preventDefault(),n())},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:n,children:"✕"})]}),oe]})}function BU({meta:e,entry:t,fullHash:i,copied:n,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:FU(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??eR(e.authorAt)})]}),u.jsxs("div",{className:"history-inspector-ids",children:[u.jsxs("button",{type:"button",className:`history-sha-copy${n?" is-copied":""}`,onClick:r,children:[i,u.jsx("span",{children:n?"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:a0(t).map(c=>u.jsx("span",{className:`history-badge history-badge--${c.kind}`,children:c.label},`${c.kind}:${c.label}`))})]})}function rk({files:e,selectedPath:t,additions:i,deletions:n,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:["+",i]})," ",u.jsxs("em",{children:["−",n]})]}),u.jsxs("div",{className:"diff-view-toggle history-files-view-toggle",children:[u.jsx("button",{type:"button",className:`diff-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:`diff-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(YA,{files:e,selectedPath:t,onSelect:c}):e.map(d=>u.jsx(ZA,{entry:d,isSelected:d.path===t,onSelect:c},d.path))})]})}function PU({ctx:e}){return u.jsx(zU,{ctx:e},JA(e.theaterId,e.pathContext.relPath))}function zU({ctx:e}){const[t,i]=b.useState({kind:"loading"}),[n,r]=b.useState(null),[o,c]=b.useState(""),[d,p]=b.useState(0),[f,g]=b.useState($U),v=b.useRef(null),y=b.useRef(null),S=b.useRef(f),w=e.pathContext.relPath??"";b.useEffect(()=>{if(!e.theaterId){i({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let O=!1;return i({kind:"loading"}),e.api.fetch("diff","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:w})}).then(async I=>{if(!I.ok)throw new Error((await I.json()).error??"git_failed");return I.json()}).then(I=>{O||i({kind:"ok",commits:I.commits,checkouts:I.checkouts,truncated:I.truncated??!1})}).catch(I=>{O||i({kind:"error",message:I instanceof Error?I.message:"unknown"})}),()=>{O=!0}},[e.api,e.theaterId,d,w]),b.useLayoutEffect(()=>(e.requestExtraWidth?.(n?AU:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,n]),b.useEffect(()=>()=>y.current?.(),[]);const x=b.useCallback(O=>{O.preventDefault();const I=v.current;if(!I)return;const A=S.current,$=O.clientX,L=I.getBoundingClientRect().width;y.current?.(),y.current=rR({documentTarget:document,windowTarget:window,onMove:H=>{const U=sR(A,H.clientX-$,L,lR,iR,Ur);U!==null&&(S.current=U,g(U))},onFinish:()=>{try{localStorage.setItem(aR,String(S.current))}catch{}y.current=null}})},[]),k=b.useMemo(()=>t.kind==="ok"?OU(t.commits,o):[],[o,t]),R=t.kind==="ok"?_U(k):null;return u.jsxs("div",{ref:v,className:"history-root",style:n?{gridTemplateColumns:kU(f)}: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:o,onChange:O=>c(O.target.value)}),o&&u.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>c(""),children:"✕"})]}),t.kind==="ok"&&u.jsx("span",{className:"history-count",children:o?`${k.length}/${t.commits.length}`:t.commits.length})]}),u.jsxs("div",{className:"history-list",children:[t.kind==="loading"&&u.jsx("div",{className:"history-empty",children:"Loading…"}),t.kind==="error"&&u.jsxs("div",{className:"history-error",children:[t.message,u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:()=>p(O=>O+1),children:"Retry"})]}),t.kind==="ok"&&t.commits.length===0&&u.jsx("div",{className:"history-empty",children:"No history"}),t.kind==="ok"&&t.commits.length>0&&k.length===0&&u.jsx("div",{className:"history-empty",children:"No matching items"}),t.kind==="ok"&&R&&k.map((O,I)=>u.jsx(jU,{entry:O,checkouts:t.checkouts,selected:n?.fullHash===O.fullHash,graphNode:R.nodes[I],laneCount:R.activeLaneCount,layoutCollapsed:R.collapsed,onSelect:A=>r({fullHash:A.fullHash,entry:A})},O.fullHash)),t.kind==="ok"&&(t.truncated||t.commits.length>=200)&&u.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),n&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"history-divider",onPointerDown:x}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(IU,{ctx:e,target:n,onSelectCommit:r,onClose:()=>r(null)})})]})]})}function $U(){return Ly(aR,RU,lR)}function HU(){try{const e=localStorage.getItem(oR);if(e==="list"||e==="tree")return e}catch{}return"list"}function Ly(e,t,i=0){try{const n=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(n)&&n>=i)return n}catch{}return t}function FU(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}function UU(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M5 3v12M10 7v8M14 11v4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),u.jsx("path",{d:"M5 7c1.8 0 2.4 0 5 0M10 11c1.4 0 2.2 0 4 0",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}const WU={id:"history",title:"History",icon:()=>u.jsx(UU,{}),pathAware:!0,render:e=>u.jsx(PU,{ctx:e})},My=new Set;let o0={file:null};function cR(){for(const e of My)e()}function GU(e){return My.add(e),()=>{My.delete(e)}}function ak(){return o0}function qU(e,t){const i=b.useSyncExternalStore(GU,ak,ak);return!i.file||i.file.theaterId!==e||i.file.subPath!==t?null:i.file}function KU(e,t,i){o0={file:{entry:e,subPath:t,theaterId:i}},cR()}function ok(){o0={file:null},cR()}const uR="fleet-console.diff.viewMode",hR="fleet-console.diff.listPaneWidth",VU=400,YU=248,dR=220;function XU(){try{const e=localStorage.getItem(uR);if(e==="list"||e==="tree")return e}catch{}return"list"}function ZU(){try{const e=localStorage.getItem(hR),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(dR,t)}catch{}return YU}function JU(e){return e.entry.status==="U"?"untracked":"unified"}function QU({ctx:e}){const t=JA(e.theaterId,e.pathContext.relPath);return u.jsx(eW,{ctx:e},t)}function eW({ctx:e}){const[t,i]=b.useState(XU),[n,r]=b.useState(""),o=e.pathContext.relPath??"",c=qU(e.theaterId??null,o),[d,p]=b.useState(ZU),f=b.useRef(d),g=b.useRef(null),[v,y]=b.useState(!1);b.useLayoutEffect(()=>()=>ok(),[]);const S=b.useCallback(O=>{e.theaterId&&KU(O,o,e.theaterId)},[e.theaterId,o]),w=b.useCallback(()=>ok(),[]),x=b.useCallback(O=>{i(O);try{localStorage.setItem(uR,O)}catch{}},[]),k=b.useCallback(O=>{O.preventDefault();const I=g.current;if(!I)return;const A=I.getBoundingClientRect().width,$=O.clientX,L=f.current;y(!0);const H=oe=>{const fe=xU({startWidth:L,dx:oe.clientX-$,containerWidth:A,listPaneMinWidth:dR,hunkPaneMinWidth:tR,dividerWidth:Ur});fe!==null&&(f.current=fe,p(fe))},U=()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",U),y(!1);try{localStorage.setItem(hR,String(f.current))}catch{}};document.addEventListener("pointermove",H),document.addEventListener("pointerup",U)},[]);b.useLayoutEffect(()=>(e.requestExtraWidth?.(c?VU:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,c]);const R=c?JU(c):null;return u.jsxs("div",{ref:g,className:`diff-root${c?" has-hunk":""}${v?" is-dragging":""}`,style:c?{gridTemplateColumns:CU(d)}:void 0,children:[c&&R?u.jsxs("div",{className:"diff-hunk-pane",children:[u.jsxs("div",{className:"diff-hunk-head",children:[u.jsx("span",{children:c.entry.path}),u.jsx("button",{type:"button",onClick:w,children:"✕"})]}),u.jsx(QA,{ctx:e,file:c.entry,mode:R,subPath:c.subPath})]}):null,c?u.jsx("div",{className:"diff-divider",onPointerDown:k,"aria-hidden":"true"}):null,u.jsxs("div",{className:"diff-list-pane",children:[u.jsxs("div",{className:"diff-toolbar",children:[u.jsxs("div",{className:"diff-filter",children:[u.jsx("input",{type:"text",className:"diff-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:n,onChange:O=>r(O.target.value)}),n?u.jsx("button",{type:"button",className:"diff-filter-clear","aria-label":"Clear filter",onClick:()=>r(""),children:"✕"}):null]}),u.jsxs("div",{className:"diff-view-toggle",children:[u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="list"?" is-active":""}`,title:"List view","aria-pressed":t==="list",onClick:()=>x("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":t==="tree",onClick:()=>x("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(pU,{ctx:e,viewMode:t,selectedPath:c?.entry.path??null,subPath:o,onSelect:S,filterText:n})]})]})}function tW(){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 iW={id:"diff",title:"Diff",icon:()=>u.jsx(tW,{}),pathAware:!0,render:e=>u.jsx(QU,{ctx:e})},nW={id:"diff",railPanels:[iW,WU]},sW=[nW],Jd=["claude-code","codex","cursor","opencode"],rW={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},aW="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function oW({source:e,skill:t,theaterId:i,relPath:n,onCancel:r,onStarted:o,jobLog:c}){const[d,p]=b.useState(i?"project":"global"),[f,g]=b.useState(!0),[v,y]=b.useState(new Set(Jd)),{status:S,start:w}=c,x=S==="running",k=S==="done",R=S==="error",O=b.useCallback(()=>{g(!0),y(new Set(Jd))},[]),I=b.useCallback($=>{g(!1),y(L=>{const H=new Set(L);return H.has($)?H.delete($):H.add($),H})},[]),A=b.useCallback(()=>{const $=f?Jd:Array.from(v);if($.length===0)return;const L={source:e,skill:t,scope:d,agents:$};d==="project"&&i&&(L.theaterId=i,L.relPath=n),w("/plugins/skills/install",L),o(d)},[f,v,e,t,d,i,n,w,o]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${d==="project"?" is-active":""}`,onClick:()=>p("project"),disabled:!i||x||k,title:i?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${d==="global"?" is-active":""}`,onClick:()=>p("global"),disabled:x||k,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:O,disabled:x||k,children:"All agents"}),Jd.map($=>u.jsx("button",{type:"button",className:`skills-agent-chip${!f&&v.has($)?" is-active":""}`,onClick:()=>I($),disabled:x||k,children:rW[$]},$))]}),u.jsx("p",{className:"skills-permission-warning",children:aW}),!x&&!k&&!R&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:r,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:A,disabled:!f&&v.size===0,children:"Install now"})]})]})}const lW=4e3;function fR({status:e,lines:t,runningLabel:i,doneLabel:n,errorLabel:r,onDismiss:o,onRetry:c}){const[d,p]=b.useState(!1),f=b.useRef(null),g=b.useRef(null);b.useEffect(()=>{e==="running"&&p(!1)},[e]),b.useEffect(()=>{const k=f.current;k&&(k.scrollTop=k.scrollHeight)},[t]),b.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{p(!1),o()},lW),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,o]);const v=b.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),p(!1),o()},[o]),y=b.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"?i:e==="done"?n:r;return u.jsxs("div",{className:"skills-dock",children:[d&&u.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((k,R)=>u.jsx("div",{className:"skills-dock-log-line",children:k},R)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",n]}),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:y,onKeyDown:k=>{k.target===k.currentTarget&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),y())},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(),v()},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(),v()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const cW={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},Oy=new Set;let Vi=cW;function za(){for(const e of Oy)e()}function uW(e){return Oy.add(e),()=>{Oy.delete(e)}}function lk(){return Vi}function l0(){return b.useSyncExternalStore(uW,lk,lk)}function Qd(e){Vi={...Vi,activeTab:e},za()}function ck(e){Vi={...Vi,scope:e},za()}function hW(e){Vi={...Vi,filterText:e},za()}function dW(e){Vi={...Vi,searchQuery:e},za()}function wl(e,t){Vi={...Vi,searchResults:e,searchLoading:t},za()}function sp(e,t){return JSON.stringify([e,t])}function Dy(e,t){return e.installedContextKey===t}function $_(e,t,i){Vi.installedContextKey===e&&(Vi={...Vi,installedList:t,installedLoading:i},za())}function jy(e){Vi={...Vi,installFormOpenId:e},za()}function fW(e){Vi={...Vi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},za()}const uk=750;function pR(){const[e,t]=b.useState({status:"idle",lines:[]}),i=b.useRef(null),n=b.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);b.useEffect(()=>()=>n(),[n]);const r=b.useCallback(()=>{n(),t({status:"idle",lines:[]})},[n]),o=b.useCallback((c,d)=>{n(),t({status:"running",lines:[]}),(async()=>{const p=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).catch(()=>null);if(!p?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await p.json();let g=0;const v=async()=>{const y=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${g}`).catch(()=>null);if(!y?.ok){t(w=>({...w,status:"error"}));return}const S=await y.json();g=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?i.current=setTimeout(()=>{v()},uk):t(w=>({...w,status:S.status}))};i.current=setTimeout(()=>{v()},uk)})()},[n]);return{...e,start:o,reset:r}}const pW=300,wf=2;function mW(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function gW(e){if(e.length<wf){wl([],!1);return}wl([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){wl([],!1);return}const i=await t.json();wl(i.skills??[],!1)}catch{wl([],!1)}}function _W({result:e,theaterId:t,relPath:i,isFormOpen:n,onInstallClick:r,onReadMore:o,onInstallStarted:c,jobLog:d}){const p={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>o(p,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:mW(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:r,children:n?"Cancel":"Install"})}),n&&u.jsx(oW,{source:e.source,skill:e.name,theaterId:t,relPath:i,onCancel:r,onStarted:f=>c(e.name,f),jobLog:d})]})}function vW({theaterId:e,relPath:t,onReadMore:i,onInstallSuccess:n}){const{searchQuery:r,searchResults:o,searchLoading:c,installFormOpenId:d}=l0(),p=b.useRef(null),f=pR(),[g,v]=b.useState(null),y=b.useCallback(w=>{if(dW(w),p.current&&clearTimeout(p.current),w.length<wf){wl([],!1);return}p.current=setTimeout(()=>{gW(w)},pW)},[]);b.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),b.useEffect(()=>{f.status!=="done"||!g||(n(g.name,g.scope),jy(null),v(null))},[f.status,g,n]);const S=g?`Installing ${g.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:r,onChange:w=>y(w.target.value),"aria-label":"Search skills registry"}),c&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!c&&r.length>=wf&&o.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',r,'".']}),!c&&r.length>0&&r.length<wf&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:o.map(w=>u.jsx(_W,{result:w,theaterId:e,relPath:t,isFormOpen:d===w.id,onInstallClick:()=>jy(d===w.id?null:w.id),onReadMore:i,onInstallStarted:(x,k)=>v({name:x,scope:k}),jobLog:f},w.id))})]}),u.jsx(fR,{status:f.status,lines:f.lines,runningLabel:S,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const yW=2600;function bW({skill:e,onReadMore:t,onUpdate:i,onRemove:n,isUpdating:r}){const[o,c]=b.useState(!1),d=b.useRef(null),p=b.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),f=b.useCallback(()=>{o?(p(),c(!1),n?.(e.name,e.scope)):(c(!0),d.current=setTimeout(()=>c(!1),yW))},[o,p,n,e.name,e.scope]);return b.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:[i&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>i(e.scope),disabled:r,children:r?"Updating…":"Update all"}),n&&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 SW(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",n=await fetch(`/plugins/skills/list${i}`);return n.ok?(await n.json()).skills??[]:[]}function wW({theaterId:e,relPath:t,onReadMore:i,refreshKey:n}){const r=l0(),{scope:o,filterText:c}=r,d=sp(e,t),p=Dy(r,d)?r.installedList:[],f=Dy(r,d)&&r.installedLoading,g=pR(),v=b.useRef(null),y=b.useCallback((I,A)=>{const $=sp(I,A);$_($,[],!0),SW(I,A).then(L=>$_($,L,!1)).catch(()=>$_($,[],!1))},[]);b.useEffect(()=>{y(e,t)},[e,t,y,n]),b.useEffect(()=>{(g.status==="done"||g.status==="error")&&y(e,t)},[g.status,e,t,y]);const S=b.useCallback(I=>{const A=I;v.current=A;const $={scope:A};A==="project"&&e&&($.theaterId=e,$.relPath=t),g.start("/plugins/skills/update",$)},[e,t,g]),w=b.useCallback((I,A)=>{const $={scope:A,skill:I};A==="project"&&e&&($.theaterId=e,$.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}).then(()=>y(e,t)).catch(()=>null)},[e,t,y]),x=b.useCallback(()=>{v.current&&S(v.current)},[S]),k=o==="project"&&!e?"global":o,R=p.filter(I=>I.scope!==k?!1:c?I.name.toLowerCase().includes(c.toLowerCase()):!0),O=g.status==="running"&&v.current===k;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${k==="project"?" is-active":""}`,onClick:()=>ck("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${k==="global"?" is-active":""}`,onClick:()=>ck("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:c,onChange:I=>hW(I.target.value),"aria-label":"Filter installed skills"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&R.length===0&&u.jsx("div",{className:"skills-empty-state",children:c?"No skills match the filter.":`No ${k} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:R.map(I=>u.jsx(bW,{skill:I,onReadMore:i,onUpdate:S,onRemove:w,isUpdating:O},`${I.scope}:${I.name}`))})]}),u.jsx(fR,{status:g.status,lines:g.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:g.reset,onRetry:x})]})}function H_(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";i&&!/^(https?:|mailto:|#)/i.test(i)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function xW({content:e}){const t=b.useMemo(()=>{const r=Qu(e).html,o=new DOMParser().parseFromString(r,"text/html");return H_(o.body),o.body.innerHTML},[e]),i=b.useRef(null);b.useEffect(()=>{const r=i.current;if(!r)return;H_(r);const o=new MutationObserver(()=>H_(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const n=b.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:i,className:"markdown-body",onClick:n,dangerouslySetInnerHTML:{__html:t}})}const CW=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),kW="Skills run with full agent permissions. Review before use.";function EW(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(CW)),n=i[0],r=i[i.length-1];!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))}function TW({skill:e,isInstalled:t,theaterId:i,relPath:n,onClose:r,onInstall:o}){const[c,d]=b.useState(null),[p,f]=b.useState(!1),g=b.useRef(null),v=b.useRef(null),y=b.useRef(null);if(b.useEffect(()=>{e&&g.current===null&&(g.current=document.activeElement)},[e]),b.useEffect(()=>{if(!e){d(null);return}f(!0),d(null);let w=!1;return(async()=>{try{let k;if(t){const O={scope:e.scope,skill:e.name};e.scope==="project"&&i&&(O.theaterId=i,O.relPath=n),k=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})}else k=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:i,relPath:n})});if(w)return;if(!k.ok){f(!1);return}const R=await k.json();w||(d(R.markdown??""),f(!1))}catch{w||f(!1)}})(),()=>{w=!0}},[e,t,i,n]),b.useEffect(()=>{if(!e)return;const w=x=>{x.key==="Escape"?(x.preventDefault(),r()):x.key==="Tab"&&EW(x,y.current),x.stopImmediatePropagation()};return v.current?.focus(),window.addEventListener("keydown",w,!0),()=>{window.removeEventListener("keydown",w,!0);const x=g.current;g.current=null,x?.focus?.()}},[e,r]),b.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const S=e.displayPath||e.source||null;return Pa.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:r,"aria-hidden":"true",children:u.jsxs("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:w=>w.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&u.jsx("span",{className:"skills-overlay-meta",children:S}),u.jsx("button",{ref:v,type:"button",className:"skills-overlay-close",onClick:r,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[p&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!p&&c===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),c!==null&&u.jsx(xW,{content:c})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:kW}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{r(),o()},children:"Install"})]})]})}),document.body)}const AW=3200;function RW({message:e,onDismiss:t}){return b.useEffect(()=>{if(!e)return;const i=setTimeout(t,AW);return()=>clearTimeout(i)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function NW({ctx:e}){const t=sp(e.theaterId,e.pathContext.relPath);return u.jsx(LW,{ctx:e},t)}function LW({ctx:e}){const{theaterId:t}=e,i=l0(),{activeTab:n}=i,r=sp(e.theaterId,e.pathContext.relPath),[o,c]=b.useState(null),[d,p]=b.useState(null),[f,g]=b.useState(0),v=Dy(i,r)?i.installedList.length:0;b.useLayoutEffect(()=>{fW(r)},[r]);const y=b.useCallback(k=>{c({skill:k,isInstalled:!0})},[]),S=b.useCallback((k,R)=>{c({skill:k,isInstalled:!1,registryId:R})},[]),w=b.useCallback((k,R)=>{p(`Installed ${k} to ${R}`),g(O=>O+1),Qd("installed")},[]),x=b.useCallback(()=>{o?.registryId&&(jy(o.registryId),Qd("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":n==="installed",className:`skills-tab-btn${n==="installed"?" is-active":""}`,onClick:()=>Qd("installed"),children:["Installed",v>0?` ${v}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":n==="find",className:`skills-tab-btn${n==="find"?" is-active":""}`,onClick:()=>Qd("find"),children:"Find"})]}),n==="installed"?u.jsx(wW,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:y,refreshKey:f}):u.jsx(vW,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,onInstallSuccess:w}),u.jsx(RW,{message:d,onDismiss:()=>p(null)}),u.jsx(TW,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>c(null),onInstall:x})]})}function MW(){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 OW={id:"skills",title:"Skills",icon:MW,pathAware:!0,render:e=>u.jsx(NW,{ctx:e})},DW={id:"skills",railPanels:[OW]},jW=[DW],mR=[...Hz,...aU,...sW,...jW],IW=_R(mR),gR=b.createContext(IW),BW=gR.Provider;async function PW(){const e=[...mR],t=new Set(e.map(n=>n.id)),i=await zW();for(const n of i){if(t.has(n.id)){console.warn(`Skipping external plugin with duplicate id: ${n.id}`);continue}const r=await $W(n);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 _R(e)}function Jl(){return b.useContext(gR)}async function zW(){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(FW):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function $W(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return HW(i)?i:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function _R(e){const t=new Set,i=[];for(const n of e)for(const r of n.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),i.push(r)}return{plugins:e,operationKinds:e.flatMap(n=>n.operationKinds??[]),settingsSections:e.flatMap(n=>n.settingsSections??[]),notificationKinds:e.flatMap(n=>n.notificationKinds??[]),railPanels:i}}function HW(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function FW(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 UW=288,WW=520,du=12;function vR({anchor:e,viewportBounds:t,placement:i="cursor",catalog:n,canLaunch:r,renderKindIcon:o,onLaunchKind:c,onClose:d}){const p=b.useRef(null),f=b.useRef(null);return b.useEffect(()=>{const g=y=>{p.current?.contains(y.target)||d()},v=y=>{y.key==="Escape"&&d()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",v)}},[d]),b.useEffect(()=>{f.current?.focus()},[]),u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:p,style:qW(e,t,i),"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(GW,{})}),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"}),n.length>0?n.map((g,v)=>u.jsxs("div",{children:[v>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:g.title}),g.kinds.map(y=>{const S=y.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:y.disabledReason,onClick:()=>c(g.id,y),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(g.id,y)??u.jsx(KW,{})}),u.jsx("span",{className:"theater-menu-label",children:y.title}),y.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:y.disabledReason}):null]},`${g.id}:${y.id}`)})]},g.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function GW(){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 qW(e,t,i){const n=t?Math.max(du,Math.min(e.x,t.width-UW-du)):e.x;if(i==="above")return{left:n,bottom:Math.max(du,e.y)};const r=t?Math.max(du,Math.min(e.y,t.height-WW-du)):e.y;return{left:n,top:r}}function KW(){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 yR(e,t){const i=document.activeElement;e===null||!(i instanceof Node)||!e.contains(i)||document.querySelector(t)?.focus()}const ef="directory-browser-sectors";function bR({open:e,onCancel:t,onConfirm:i}){const[n,r]=b.useState(null),[o,c]=b.useState(null),[d,p]=b.useState(null),[f,g]=b.useState(""),[v,y]=b.useState(""),[S,w]=b.useState(0),x=b.useRef(null),k=b.useRef(null),R=async(T,E)=>{c(T),p(null),g(""),w(0);try{const j=await s4(T,E);r(j)}catch(j){if(j instanceof DOMException&&j.name==="AbortError")return;p(j instanceof gt?j.message:String(j))}finally{c(null)}};b.useEffect(()=>{if(!e)return;const T=new AbortController;return R(null,T.signal),()=>T.abort()},[e]),b.useEffect(()=>{e&&x.current?.focus()},[e,n?.path]);const O=n?.entries??[],I=b.useMemo(()=>{const T=f.trim().toLowerCase();return T===""?O:O.filter(E=>E.name.toLowerCase().includes(T))},[O,f]),A=b.useMemo(()=>n?VW(n):[],[n]),$=n?hk(n.path):null,L=n?.roots??[],H=L.length>1,U=I.length===0?-1:Math.min(S,I.length-1);if(b.useEffect(()=>{if(U<0)return;k.current?.querySelector(`[data-index="${U}"]`)?.scrollIntoView({block:"nearest"})},[U,n?.path]),!e)return null;const oe=T=>{T.accessible&&o===null&&R(T.path)},fe=()=>{n?.parentPath!=null&&o===null&&R(n.parentPath)},K=()=>{const T=v.trim();T!==""&&o===null&&R(T)},z=n?.path??null,N=U>=0?`${ef}-${U}`:void 0,D=T=>{switch(T.key){case"Escape":f!==""?g(""):t();return;case"ArrowDown":T.preventDefault(),w(E=>Math.min(E+1,Math.max(I.length-1,0)));return;case"ArrowUp":T.preventDefault(),w(E=>Math.max(E-1,0));return;case"Enter":{T.preventDefault();const E=I[U];E&&oe(E);return}case"Backspace":f===""&&(T.preventDefault(),fe());return;default:return}};return Pa.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:D,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(ZW,{})}),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:L.map(T=>{const E=$!=null&&hk(T)===$;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${E?"is-active":""}`,"aria-current":E?"location":void 0,disabled:o!==null,title:T,onClick:()=>{o===null&&R(T)},onKeyDown:j=>j.stopPropagation(),children:XW(T)},T)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:A.map((T,E)=>{const j=E===A.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[E>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${j?"is-current":""}`,"aria-current":j?"location":void 0,disabled:j||o!==null,title:T.path,onClick:()=>{R(T.path)},children:T.label})]},T.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(QW,{})}),u.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":ef,value:f,spellCheck:!1,autoComplete:"off",onChange:T=>{g(T.target.value),w(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:n?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:fe,children:[u.jsx(eG,{}),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:v,spellCheck:!1,autoComplete:"off",onChange:T=>y(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Enter"&&(T.preventDefault(),K())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:v.trim()===""||o!==null,onClick:K,onKeyDown:T=>T.stopPropagation(),children:"Go"})]}),d?u.jsx("p",{className:"directory-browser-error",role:"alert",children:d}):null,u.jsx("div",{className:"directory-browser-list",id:ef,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":N,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…"]}):I.length===0?u.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):I.map((T,E)=>u.jsxs("div",{id:`${ef}-${E}`,"data-index":E,role:"option","aria-selected":E===U,"aria-disabled":!T.accessible,className:`directory-browser-sector ${E===U?"is-active":""} ${T.accessible?"":"is-locked"}`,title:T.path,onClick:()=>{w(E),oe(T)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(JW,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:T.name}),T.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(tG,{})," Locked"]})]},T.path))}),n?.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:z??"",children:z??"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:z===null||o!==null,onClick:()=>z&&i(z),children:"Add Theater"})]})]})]})]}),document.body)}function VW(e){if(YW(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 i=/^([A-Za-z]:)\\?/.exec(e.path),n=i?`${i[1]}\\`:e.roots[0]??"C:\\",r=[{label:n,path:n}];let o=n.replace(/\\$/,"");for(const c of e.path.slice(n.length).split("\\").filter(Boolean))o+=`\\${c}`,r.push({label:c,path:o});return r}function YW(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function hk(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function XW(e){return e.replace(/[\\/]+$/,"")||e}function ZW(){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 JW(){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 QW(){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 eG(){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 tG(){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 Ep=[{key:"red",label:"Red",color:"oklch(70% 0.12 25)"},{key:"orange",label:"Orange",color:"oklch(73% 0.12 50)"},{key:"amber",label:"Amber",color:"oklch(78% 0.11 70)"},{key:"yellow",label:"Yellow",color:"oklch(84% 0.11 95)"},{key:"lime",label:"Lime",color:"oklch(81% 0.12 120)"},{key:"green",label:"Green",color:"oklch(74% 0.12 145)"},{key:"emerald",label:"Emerald",color:"oklch(73% 0.10 165)"},{key:"teal",label:"Teal",color:"oklch(74% 0.09 185)"},{key:"cyan",label:"Cyan",color:"oklch(76% 0.09 205)"},{key:"sky",label:"Sky",color:"oklch(74% 0.10 230)"},{key:"blue",label:"Blue",color:"oklch(70% 0.11 255)"},{key:"indigo",label:"Indigo",color:"oklch(68% 0.11 278)"},{key:"violet",label:"Violet",color:"oklch(70% 0.11 300)"},{key:"purple",label:"Purple",color:"oklch(70% 0.12 320)"},{key:"magenta",label:"Magenta",color:"oklch(71% 0.12 340)"},{key:"rose",label:"Rose",color:"oklch(72% 0.11 5)"}];function Hl(e){return Ep.find(t=>t.key===e)?.color??null}function dk(e){return typeof e.accent=="string"?e.accent:null}const fk=8,iG=260;function pk(e){const{anchor:t,onClose:i}=e,[n,r]=b.useState(void 0);return b.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),c=t.bottom+fk,d=c+iG>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+fk)}:{position:"fixed",left:o,top:Math.round(c)})},[t]),b.useEffect(()=>{const o=c=>{c.key==="Escape"&&(c.preventDefault(),i())};return window.addEventListener("keydown",o),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]),Pa.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:n?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:n,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?u.jsx(nG,{...e}):u.jsx(sG,{...e})}):null}),document.body)}function nG({operation:e,groups:t,accentKey:i,actions:n,onClose:r}){const[o,c]=b.useState(!1),[d,p]=b.useState(`Group ${t.length+1}`),f=b.useRef(!1),g=b.useRef(null);b.useEffect(()=>{o&&g.current?.select()},[o]);const v=()=>{const y=d.trim();y&&(n.onCreateGroup(y),r())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(y=>{const S=Hl(y.color),w=e.groupId===y.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{n.onSetGroupId(w?null:y.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:y.name}),w?u.jsx(rG,{}):null]},y.id)}),o?u.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:d,onChange:y=>p(y.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:y=>{y.key==="Enter"&&!f.current&&(y.preventDefault(),v()),y.key==="Escape"&&(y.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.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>{n.onSetAccent(null),r()},children:[u.jsx("span",{}),"None"]}),u.jsx("div",{className:"group-context-menu-swatches",children:Ep.map(y=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":y.label,"aria-pressed":i===y.key,onClick:()=>{n.onSetAccent(y.key),r()},children:u.jsx("span",{style:{background:y.color}})},y.key))})]})}function sG({group:e,actions:t,onClose:i}){const[n,r]=b.useState(e.name),[o,c]=b.useState(!1),d=b.useRef(!1),p=()=>{const f=n.trim();if(!f||f===e.name){i();return}t.onRename(f),i()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx("div",{className:"group-context-menu-swatches",children:Ep.map(f=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":f.label,"aria-pressed":e.color===f.key,onClick:()=>{t.onSetColor(f.key),i()},children:u.jsx("span",{style:{background:f.color}})},f.key))}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:n,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(),i())},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(),i()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function rG(){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 aG="fleet-console.canvas.",SR="fleet-console.formation-layout",oG=400,Iy=640,By=400,mk=40,lG=320,cG=200,uG=8,hG=0,gk=96,dG=.25,fG=1,F_=.2,_k=.5,pG=.001,Al={x:0,y:0,zoom:1},Il={viewport:Al,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Py=new Set,zy=new Set,$y=new Set,Hy=new Set,th=new Map,Tp=new Map;let Ii=null,Ia=null,Ve=Il,an=null,ar=!1,c0=IG(),Ma=Al,So=null,rp=0;function u0(e){return Py.add(e),()=>{Py.delete(e)}}function Fl(){return Ve}function Fy(){return an}function Uy(){return ar}function vk(){return c0}function mG(){return Ii}function wR(){return b.useSyncExternalStore(u0,Fl,Fl)}function xR(){return b.useSyncExternalStore(TG,bk,bk)}function Ap(){return b.useSyncExternalStore(kG,Uy,Uy)}function CR(){return b.useSyncExternalStore(EG,vk,vk)}function kR(){return b.useSyncExternalStore(u0,Sk,Sk)}function Un(e){Ve={viewport:e.viewport??Ve.viewport,operations:e.operations??Ve.operations,operationOrder:e.operationOrder??Ve.operationOrder,operationAccent:e.operationAccent??Ve.operationAccent,minimized:e.minimized??Ve.minimized,collapsedGroups:e.collapsedGroups??Ve.collapsedGroups},MG(),AR()}function gG(e){const t=Ve.collapsedGroups.includes(e)?Ve.collapsedGroups.filter(i=>i!==e):[...Ve.collapsedGroups,e];Un({collapsedGroups:t})}function _G(){return b.useSyncExternalStore(u0,wk,wk)}function Wy(e){f0();const t=p0(e);Ma=t,Un({viewport:t})}function ER(e){const t=p0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||LG()){Wy(t);return}Ma=t,So===null&&(So=window.requestAnimationFrame(NR))}function Gy(e,t){const i=To();Un({operations:{...Ve.operations,[e]:{...m0(t,i),zIndex:i}}})}function vG(e,t,i=lG,n=cG,r=uG,o=hG,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,R=Math.min(i,k),O=Math.min(Math.max(R,k),x),I=p,A=Math.min(n,I),$=Math.min(Math.max(A,I),p);return Array.from({length:t},(L,H)=>({x:e.x+o+H*(O+r),y:e.y+o,width:O,height:$}))}if(c==="rows"){const x=d,k=Math.min(i,x),R=Math.min(Math.max(k,x),d),O=Math.max(0,p-r*(t-1)),I=O/t,A=Math.min(n,I),$=Math.min(Math.max(A,I),O);return Array.from({length:t},(L,H)=>({x:e.x+o,y:e.y+o+H*($+r),width:R,height:$}))}const f=Math.ceil(Math.sqrt(t)),g=Math.ceil(t/f),v=Math.max(0,p-r*(g-1)),y=v/g,S=Math.min(n,y),w=Math.min(Math.max(S,y),v);return Array.from({length:t},(x,k)=>{const R=Math.floor(k/f),O=k%f,I=R===g-1?t-(g-1)*f:f,A=Math.max(0,d-r*(I-1)),$=A/I,L=Math.min(i,$),H=Math.min(Math.max(L,$),A);return{x:e.x+o+O*(H+r),y:e.y+o+R*(w+r),width:H,height:w}})}function TR(e){Ve.minimized.includes(e)||(an===e&&Wr(),Un({minimized:[...Ve.minimized,e]}))}function yG(e){const t=new Set,n=[...Ve.minimized.filter(r=>t.has(r)||!(r in Ve.operations)?!1:(t.add(r),!0)),...e.filter(r=>t.has(r)||!(r in Ve.operations)?!1:(t.add(r),!0))];RR(Ve.minimized,n)||(an&&n.includes(an)&&Wr(),Un({minimized:n}))}function tf(e){if(!Ve.minimized.includes(e))return;an===e&&Wr();const t=Ve.minimized.filter(r=>r!==e),i=Ve.operations[e];if(!i){Un({minimized:t});return}const n=To();Un({minimized:t,operations:{...Ve.operations,[e]:{...i,zIndex:n}}})}function U_(e){Un({operationOrder:OR(e)})}function To(){return rp+=1,rp}function bG(e){const t=Ve.operations[e];if(t)return t;const i=Object.keys(Ve.operations).length,n={x:i*mk,y:i*mk,width:Iy,height:By,zIndex:To()};return Un({operations:{...Ve.operations,[e]:n}}),n}function SG(e){const t=new Set(e),i={};let n=!1;for(const[g,v]of Object.entries(Ve.operations))t.has(g)?i[g]=v:n=!0;const r=Ve.minimized.filter(g=>t.has(g)),o=r.length!==Ve.minimized.length,c=Ve.operationOrder.filter(g=>t.has(g)),d=c.length!==Ve.operationOrder.length,p=Object.fromEntries(Object.entries(Ve.operationAccent).filter(([g])=>t.has(g))),f=Object.keys(p).length!==Object.keys(Ve.operationAccent).length;an&&(!t.has(an)||r.includes(an))&&Wr(),(n||o||d||f)&&Un({operations:i,minimized:r,operationOrder:c,operationAccent:p})}function wG(e){OG(),f0(),RG(),Ii=e,Ve=e?jG(e):Il;const t=e?th.get(e)??null:null,i=an!==t;an=t;const n=e?Tp.has(e):!1,r=ar!==n;ar=n,Ma=Ve.viewport,rp=Math.max(rp,DR(Ve.operations)),AR(),i&&d0(),r&&Rp()}function yk(e,t){const i=Ve.operations[e];if(!i)return;const n=Math.max(dG,Math.min(fG,Math.min((t.width-gk)/i.width,(t.height-gk)/i.height))),r={x:t.width/2-(i.x+i.width/2)*n,y:t.height/2-(i.y+i.height/2)*n,zoom:n};f0(),Ma=r;const o=To(),c=Ve.minimized.includes(e);Un({viewport:r,operations:{...Ve.operations,[e]:{...m0(i,o),zIndex:o}},...c?{minimized:Ve.minimized.filter(d=>d!==e)}:{}})}function Bu(e){h0(),Ii&&th.set(Ii,e);const t=NG(e),i=!RR(Ve.minimized,t),n=an!==e;n&&(an=e),i&&Un({minimized:t}),n&&d0()}function Wr(){Ii&&th.delete(Ii),an!==null&&(an=null,d0())}function xG(){if(Ii){if(ar){h0();return}Wr(),Tp.set(Ii,!0),ar=!0,Rp()}}function W_(e){if(Ii){if(ar&&c0===e){h0();return}CG(e),ar||(Wr(),Tp.set(Ii,!0),ar=!0,Rp())}}function h0(){Ii&&Tp.delete(Ii),ar&&(ar=!1,Rp())}function CG(e){c0=e,BG(e),AG()}function kG(e){return $y.add(e),()=>{$y.delete(e)}}function EG(e){return Hy.add(e),()=>{Hy.delete(e)}}function AR(){for(const e of Py)e()}function TG(e){return zy.add(e),()=>{zy.delete(e)}}function bk(){return an}function Rp(){for(const e of $y)e()}function AG(){for(const e of Hy)e()}function Sk(){return Ve.minimized}function wk(){return Ve.collapsedGroups}function d0(){for(const e of zy)e()}function RG(){Ii&&(an?th.set(Ii,an):th.delete(Ii))}function NG(e){return Object.keys(Ve.operations).filter(t=>t!==e)}function RR(e,t){return e.length===t.length&&e.every((i,n)=>i===t[n])}function NR(){const e=Ve.viewport,t=Ma.x-e.x,i=Ma.y-e.y,n=Ma.zoom-e.zoom;if(Math.abs(t)<_k&&Math.abs(i)<_k&&Math.abs(n)<pG){So=null,Un({viewport:Ma});return}Un({viewport:{x:e.x+t*F_,y:e.y+i*F_,zoom:e.zoom+n*F_}}),So=typeof window<"u"?window.requestAnimationFrame(NR):null}function f0(){So===null||typeof window>"u"||(window.cancelAnimationFrame(So),So=null)}function LG(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function MG(){!Ii||typeof window>"u"||(DG(),Ia=window.setTimeout(()=>{Ia=null,LR(Ii,Ve)},oG))}function OG(){!Ia||!Ii||typeof window>"u"||(window.clearTimeout(Ia),Ia=null,LR(Ii,Ve))}function DG(){!Ia||typeof window>"u"||(window.clearTimeout(Ia),Ia=null)}function jG(e){if(typeof window>"u")return Il;try{const t=window.localStorage.getItem(MR(e));if(!t)return Il;const i=JSON.parse(t);return PG(i)}catch{return Il}}function LR(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(MR(e),JSON.stringify(t))}catch{}}function IG(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(SR);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function BG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SR,e)}catch{}}function MR(e){return`${aG}${e}`}function PG(e){if(!Ul(e))return Il;const t=HG(e.operations);return{viewport:p0(e.viewport),operations:t,operationOrder:OR(e.operationOrder),operationAccent:zG(e.operationAccent),minimized:$G(e.minimized,t),collapsedGroups:UG(e.collapsedGroups)}}function OR(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const n of e)typeof n!="string"||t.has(n)||(t.add(n),i.push(n));return i}function zG(e){if(!Ul(e))return{};const t={};for(const[i,n]of Object.entries(e))typeof n=="string"&&(t[i]=n);return t}function $G(e,t){if(!Array.isArray(e))return[];const i=new Set,n=[];for(const r of e)typeof r!="string"||i.has(r)||!(r in t)||(i.add(r),n.push(r));return n}function p0(e){if(!Ul(e))return Al;const t=Pu(e.x,Al.x),i=Pu(e.y,Al.y),n=qy(e.zoom,Al.zoom);return{x:t,y:i,zoom:n}}function HG(e){if(!Ul(e))return{};const t={};for(const[i,n]of Object.entries(e))Ul(n)&&(t[i]=m0(n,FG(t)));return t}function m0(e,t){return Ul(e)?{x:Pu(e.x,0),y:Pu(e.y,0),width:qy(e.width,Iy),height:qy(e.height,By),zIndex:Pu(e.zIndex,t)}:{x:0,y:0,width:Iy,height:By,zIndex:t}}function FG(e){return DR(e)+1}function DR(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Pu(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function qy(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ul(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function UG(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const n of e)typeof n!="string"||t.has(n)||(t.add(n),i.push(n));return i}function WG(e,t,i,n){if(!i)return{groupId:null,index:0};for(const o of t){const c=o.groupId??"__ungrouped__",d=i.querySelector(`[data-drop-zone-group-id="${c}"]`);if(!d)continue;const p=d.getBoundingClientRect();if(e<p.top||e>p.bottom)continue;const f=d.querySelector(`[data-group-section-id="${c}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const g=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const v of g){const y=v.dataset.sideBarChipId;if(!y||y===n)continue;const S=v.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(y))}}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 GG(e,t,i,n){if(!i)return 0;const r=Array.from(i.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const c=o.dataset.dropZoneGroupId;if(!c||c==="__ungrouped__"||c===n)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 qG(e,t,i,n){const r=e.filter(g=>g!==t),o=new Set(n),c=r.filter(g=>o.has(g)),d=Math.max(0,Math.min(i,c.length));if(c.length===0)return[...r,t];if(d<c.length){const g=r.indexOf(c[d]),v=[...r];return v.splice(g,0,t),v}const p=r.indexOf(c[c.length-1]),f=[...r];return f.splice(p+1,0,t),f}function KG(e,t,i,n){const r=new Set(n),o=e.filter(v=>r.has(v)),c=o.indexOf(t),d=o.filter(v=>v!==t),p=i>c?i-1:i,f=Math.max(0,Math.min(p,d.length));d.splice(f,0,t);let g=0;return e.map(v=>r.has(v)?d[g++]??v:v)}function VG(e,t,i){if(i.length!==t.length)return[...e];const n=new Set(t);let r=0;return e.map(o=>n.has(o)?i[r++]??o:o)}function YG(e,t,i){const n=e.indexOf(t);if(n===-1)return[...e];const r=e.filter(d=>d!==t),o=i>n?i-1:i,c=Math.max(0,Math.min(o,r.length));return r.splice(c,0,t),r}function XG(e,t,i){if(e.indexOf(t)===-1)return[...e];const r=e.filter(c=>c!==t),o=Math.max(0,Math.min(i,r.length));return r.splice(o,0,t),r}function Np(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function ZG(e){const t=Np(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function g0(e){const{currentTitle:t,onCommit:i,onBegin:n}=e,r=b.useRef(null),o=b.useRef(!1),c=b.useRef(!1),[d,p]=b.useState(!1),[f,g]=b.useState("");b.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const v=()=>{n?.(),c.current=!1,g(t),p(!0)},y=()=>{c.current=!0,p(!1),g("")},S=()=>{if(!o.current){o.current=!0;try{i(f)}finally{o.current=!1,c.current=!0,p(!1)}}};return{renaming:d,draftTitle:f,inputRef:r,begin:v,cancel:y,commit:S,setDraftTitle:g,handleKeyDown:k=>{if(k.key==="Enter"){k.preventDefault(),S();return}k.key==="Escape"&&(k.preventDefault(),y())},handleBlur:()=>{if(c.current){c.current=!1;return}S()}}}function jR({entry:e,index:t,isCloseArmed:i,accentValue:n,dragging:r,dragOffsetY:o,dropTarget:c,preview:d=!1,onArmClose:p,onDisarmClose:f,onClose:g,onMinimize:v,onFocus:y,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:k}){const R=b.useRef(!1),{operation:O,active:I,minimized:A,notificationCount:$,status:L}=e,H=JG(O),U=g0({currentTitle:H,onCommit:E=>k(O.id,E),onBegin:f}),oe=["side-bar-chip",I?"side-bar-chip--active":"",A?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",c?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),fe=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),K={"--i":t,...n?{"--user-accent":n}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},z=()=>{if(f(),R.current){R.current=!1;return}y(O.id)},N=E=>{E.stopPropagation()},D=E=>{if(E.stopPropagation(),!i){p(O.id);return}f(),g(O.id)},T=E=>{E.preventDefault(),f(),x(O.id,E.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":O.id,className:oe,role:"button",tabIndex:0,"aria-label":I?`${H} (focused)`:`Focus operation ${H}`,"aria-current":I?"true":void 0,title:d?"Click to open in its Theater":I?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:K,onClick:z,onContextMenu:d?void 0:T,onFocus:()=>{i||f()},onPointerDown:E=>w(E,O.id),onPointerUp:()=>{r&&(R.current=!0)},onKeyDown:E=>{if(E.target===E.currentTarget){if(!d&&E.altKey&&E.shiftKey&&(E.key==="ArrowUp"||E.key==="ArrowDown")){E.preventDefault(),S(O.id,E.key==="ArrowUp"?-1:1);return}(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),z())}},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(iq,{})})}),U.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:U.inputRef,value:U.draftTitle,"aria-label":`Rename operation ${H}`,onChange:E=>U.setDraftTitle(E.target.value),onKeyDown:U.handleKeyDown,onBlur:U.handleBlur,onPointerDown:E=>E.stopPropagation(),onClick:E=>E.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:U.begin,children:H}),$>0?u.jsx("span",{className:"side-bar-chip-count",children:$}):null,u.jsx("span",{className:`side-bar-chip-status ${QG(L)}`,role:"img","aria-label":xk(L),title:xk(L)}),!d&&!A?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:N,onClick:E=>{E.stopPropagation(),f(),v(O.id)},"aria-label":`Minimize operation ${H}`,title:"Minimize operation",children:u.jsx(tq,{})}):null,d?null:u.jsx("button",{type:"button",className:fe,onPointerDown:N,onClick:D,"aria-label":i?`Confirm close operation ${H}`:`Close operation ${H}`,title:i?"Confirm close":"Close operation",children:i?"Close?":u.jsx(eq,{})})]})}function JG(e){return e.title}function QG(e){const t=Np(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function xk(e){return ZG(e)}function eq(){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 tq(){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 iq(){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 nq({group:e,count:t,collapsed:i,dragging:n,dropTarget:r,dragOffsetY:o,onToggle:c,onContextMenu:d,onPointerDragStart:p}){const f=b.useRef(!1),g=Hl(e.color),v=["side-bar-group-header",n?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),y={...g?{"--grp-color":g}:{},...n?{"--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=()=>{n&&(f.current=!0)};return u.jsxs("div",{className:v,style:y,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":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:u.jsx(sq,{collapsed:i})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function sq({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 IR="fleet-console.operations.side-width",BR="fleet-console.operations.side-collapsed",PR="fleet-console.operations.theater-collapsed",Lp=280,Ck=Lp,Ky=new Set,Vy=new Set;let wo={width:lq(),collapsed:cq()},xf=uq();function zR(){return b.useSyncExternalStore(hq,Yy,Yy)}function rq(){return b.useSyncExternalStore(fq,kk,kk)}function aq(e){const t=Math.max(Lp,Math.min($R(),e));if(wo.width!==t){wo={...wo,width:t};try{typeof window<"u"&&localStorage.setItem(IR,String(t))}catch{}HR()}}function _0(e){if(wo.collapsed!==e){wo={...wo,collapsed:e};try{typeof window<"u"&&localStorage.setItem(BR,e?"1":"0")}catch{}HR()}}function oq(e,t){const i=new Set(xf);t?i.add(e):i.delete(e);const n=Array.from(i);if(n.join("\0")!==xf.join("\0")){xf=n;try{typeof window<"u"&&localStorage.setItem(PR,JSON.stringify(n))}catch{}dq()}}function $R(){return typeof window<"u"?Math.max(Lp,window.innerWidth-480):800}function lq(){try{if(typeof window>"u")return Ck;const e=localStorage.getItem(IR);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Lp,Math.min($R(),t))}}catch{}return Ck}function cq(){try{return typeof window<"u"&&localStorage.getItem(BR)==="1"}catch{return!1}}function uq(){try{if(typeof window>"u")return[];const e=localStorage.getItem(PR),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}function HR(){for(const e of Ky)e()}function Yy(){return wo}function hq(e){return Ky.add(e),()=>Ky.delete(e)}function dq(){for(const e of Vy)e()}function kk(){return xf}function fq(e){return Vy.add(e),()=>Vy.delete(e)}function FR(e,t){const i=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],n=t.payload.launchKindId;if(typeof n=="string"){const r=i.find(o=>o.id===n);if(r)return r}return i.length===1?i[0]:null}const pq=1500,mq=6,Ek=34,Tk=18,gq=4;function _q({theaters:e,activeTheaterId:t,operations:i,groups:n,minimized:r,activeOperationId:o,operationNotifications:c,catalog:d,canLaunch:p,addingTheater:f,theaterError:g,renderKindIcon:v,onLaunchKind:y,onResetView:S,onClose:w,onMinimize:x,onFocus:k,onSetAccent:R,onRename:O,onSetGroupId:I,onCreateGroup:A,onSetGroupColor:$,onRenameGroup:L,onReorderGroups:H,onUngroupAll:U,onSelectTheater:oe,onAddTheater:fe,onCancelAddTheater:K,onForgetTheater:z}){const N=b.useRef(null),D=b.useRef(null),T=zR(),{width:E,collapsed:j}=T,P=b.useRef(j),V=wR(),Q=CR(),B=Ap(),Z=b.useRef(null),[W,re]=b.useState(null),[ie,ve]=b.useState(null),xe=b.useRef(null),Te=b.useRef([]),Ie=b.useRef([]),_t=b.useRef([]),qe=b.useRef([]),Re=b.useRef(I),Se=b.useRef(H),[Ue,Ye]=b.useState(null),[pt,nt]=b.useState(null),[ge,Le]=b.useState(!1),[Gt,Wn]=b.useState(!1),Ks=_G(),Vs=rq(),{operationStatus:Mt}=Gs();b.useLayoutEffect(()=>{!P.current&&j&&yR(N.current,".command-band-sidebar-toggle"),P.current=j},[j]);const us=i.filter(ue=>ue.theaterId===t),Pi=n.filter(ue=>ue.theaterId===t),_i=new Set(r),An=new Set(Ks),gn=bb(us,V.operationOrder).map(ue=>{const ut=FR(d,ue),St=ut?v(ue.pluginId,ut):null;return{operation:ue,active:o===ue.id,minimized:_i.has(ue.id),notificationCount:c[ue.id]?1:0,status:Mt[ue.id],icon:St}}),Gn=UR(gn,Pi,V.operationOrder),dr=Gn.some(ue=>ue.group!==null),qn=Gn.flatMap(ue=>ue.groupId?[ue.groupId]:[]),ln=Gn.flatMap(ue=>An.has(ue.groupId??"")?[]:ue.entries),qt=gn.map(ue=>ue.operation.id),Ot=b.useCallback(()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[]),Dt=b.useCallback(()=>{Ot(),re(null)},[Ot]),fr=b.useCallback(ue=>{Ot(),re(ue),Z.current=window.setTimeout(()=>{Z.current=null,re(null)},pq)},[Ot]);b.useEffect(()=>Ot,[Ot]),b.useEffect(()=>{W!==null&&(gn.some(ue=>ue.operation.id===W)||Dt())},[W,gn,Dt]);const Li=Ue?.kind==="chip"?gn.find(ue=>ue.operation.id===Ue.operationId)?.operation??null:null,hs=Ue?.kind==="group"?n.find(ue=>ue.id===Ue.groupId)??null:null,Xi=Ue?.kind==="theater"?e.find(ue=>ue.id===Ue.theaterId)??null:null,ds=(ue,ut)=>{const St=ln.findIndex(Qt=>Qt.operation.id===ue);if(St===-1)return;const He=Math.max(0,Math.min(ln.length-1,St+ut));if(He===St)return;const ye=ln.map(Qt=>Qt.operation.id),vt=XG(ye,ue,He);U_(VG(qt,ye,vt))},Ms=Gn.map(ue=>({groupId:ue.groupId,entryIds:ue.entries.map(ut=>ut.operation.id)}));b.useEffect(()=>{Te.current=gn,Ie.current=qt,_t.current=Ms,qe.current=qn,Re.current=I,Se.current=H});const jt=ue=>{xe.current=ue,ve(ue)},G=ie?.pointerId??null;b.useEffect(()=>{if(G===null)return;const ue=He=>{if(He.pointerId!==G)return;const ye=xe.current;if(!ye)return;if(He.buttons===0){jt(null);return}const vt=Math.hypot(He.clientX-ye.startX,He.clientY-ye.startY);if(!ye.dragging&&vt<mq)return;if(ye.dragging&&He.preventDefault(),kq(He.clientY,D.current),ye.kind==="chip"){const _n=WG(He.clientY,_t.current,D.current,ye.sourceId);jt({...ye,currentY:He.clientY,dragging:!0,dropIndex:_n.index,dropGroupId:_n.groupId});return}const Qt=GG(He.clientY,qe.current,D.current,ye.sourceGroupId);jt({...ye,currentY:He.clientY,dragging:!0,dropIndex:Qt})},ut=He=>{if(He.pointerId!==G)return;const ye=xe.current;if(jt(null),!ye?.dragging)return;if(ye.kind==="group"){const Ze=YG(qe.current,ye.sourceGroupId,ye.dropIndex);if(Ze.join("\0")===qe.current.join("\0"))return;Se.current(Ze);return}const{sourceId:vt,sourceGroupId:Qt,dropIndex:_n,dropGroupId:cn}=ye,Kn=_t.current,un=Ie.current;if(cn!==Qt){const Qe=Kn.find(At=>At.groupId===cn)?.entryIds??[];U_(qG(un,vt,_n,Qe)),Re.current(vt,cn);return}const F=Kn.find(Ze=>Ze.groupId===Qt)?.entryIds??[],ae=F.indexOf(vt);if(ae===-1||_n===ae)return;const Ce=KG(un,vt,_n,F);U_(Ce)},St=He=>{He.pointerId===G&&jt(null)};return window.addEventListener("pointermove",ue),window.addEventListener("pointerup",ut),window.addEventListener("pointercancel",St),()=>{window.removeEventListener("pointermove",ue),window.removeEventListener("pointerup",ut),window.removeEventListener("pointercancel",St)}},[G]);const ce=(ue,ut)=>{if(ue.button!==0||ue.target instanceof Element&&ue.target.closest("button"))return;Ye(null),Dt();const He=gn.find(ye=>ye.operation.id===ut)?.operation.groupId??null;jt({kind:"chip",sourceId:ut,sourceGroupId:He,pointerId:ue.pointerId,startX:ue.clientX,startY:ue.clientY,currentY:ue.clientY,dragging:!1,dropIndex:qt.indexOf(ut),dropGroupId:He})},_e=(ue,ut)=>{ue.button===0&&(ue.target instanceof Element&&ue.target.closest("button")||qn.includes(ut)&&(Ye(null),Dt(),jt({kind:"group",sourceGroupId:ut,pointerId:ue.pointerId,startX:ue.clientX,startY:ue.clientY,currentY:ue.clientY,dragging:!1,dropIndex:qn.indexOf(ut)})))},Pe=b.useCallback(ue=>{ue.preventDefault();const ut=ue.clientX,St=T.width;Wn(!0);const He=vt=>{const Qt=vt.clientX-ut;aq(St+Qt)},ye=()=>{Wn(!1),document.removeEventListener("pointermove",He),document.removeEventListener("pointerup",ye),document.removeEventListener("pointercancel",ye)};document.addEventListener("pointermove",He),document.addEventListener("pointerup",ye),document.addEventListener("pointercancel",ye)},[T.width]),Tt=()=>{_0(!j)},bt=()=>{nt(null),Ye(null),Le(!0)},Ae=()=>{Le(!1),K()},ke=ue=>{Le(!1),fe(ue)},$e=ue=>{ue.defaultPrevented||(ue.preventDefault(),Ye(null),nt({anchor:{x:ue.clientX,y:ue.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Ft=b.useCallback(()=>{const ue=Ue?.kind==="theater"?Ue.returnFocus:null;Ye(null),ue?.focus()},[Ue]),st=(ue,ut)=>{ue.stopPropagation(),ut!==t&&oe(ut),Ye(null);const St=ue.currentTarget.getBoundingClientRect();nt({anchor:{x:St.right+8,y:St.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Si=ue=>{oq(ue,!Vs.includes(ue))};return u.jsxs("aside",{className:`operations-side-bar ${j?"is-closed":"is-expanded"}`,ref:N,"data-sidebar-state":j?"closed":"expanded","data-resizing":Gt?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${E}px`},inert:j,onContextMenu:$e,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:bt,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[u.jsx(v0,{}),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(yq,{})}),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:()=>W_("grid"),disabled:t===null,"aria-pressed":B&&Q==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:u.jsx(vq,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>W_("columns"),disabled:t===null,"aria-pressed":B&&Q==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:u.jsx(bq,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>W_("rows"),disabled:t===null,"aria-pressed":B&&Q==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:u.jsx(Sq,{})})]})]}),!j&&g?u.jsx("p",{className:"side-bar-theater-error",children:g}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:D,"aria-label":"Operations",children:e.map(ue=>{const ut=ue.id===t,St=i.filter(ye=>ye.theaterId===ue.id).length,He=Vs.includes(ue.id);if(!ut){const ye=wq({theaterId:ue.id,operations:i,operationOrder:V.operationOrder,minimizedSet:_i,activeOperationId:null,operationNotifications:c,operationStatus:Mt,catalog:d,renderKindIcon:v});return u.jsx(xq,{theater:ue,entries:He?[]:ye,groups:n.filter(vt=>vt.theaterId===ue.id),operationCount:St,collapsed:He,onSelectTheater:oe,onFocus:k,onToggleCollapsed:Si,onOpenActions:(vt,Qt)=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:vt,returnFocus:Qt})},onOpenLaunch:st,onContextMenu:vt=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:vt})}},ue.id)}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":ue.id,children:[u.jsx(WR,{theater:ue,operationCount:St,active:!0,collapsed:He,onSelectTheater:oe,onToggleCollapsed:Si,onOpenActions:(ye,vt)=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:ye,returnFocus:vt})},onOpenLaunch:st,onContextMenu:ye=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:ye})}}),He?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${ue.label} operations`,children:Gn.map(ye=>{const vt=ye.groupId!==null&&An.has(ye.groupId),Qt=ye.group?Hl(ye.group.color):null,_n=Qt?{"--grp-color":Qt}:void 0,cn=ye.groupId?qn.indexOf(ye.groupId):-1,Kn=ie?.kind==="group"&&ie.sourceGroupId===ye.groupId&&ie.dragging,un=ie?.kind==="group"&&ie.dragging&&ye.groupId!==null&&ie.sourceGroupId!==ye.groupId&&ie.dropIndex===cn,Me=ie?.kind==="group"&&ie.dragging&&ye.groupId!==null&&ie.sourceGroupId!==ye.groupId&&cn===qn.length-1&&ie.dropIndex===qn.length,F=[ye.groupId?"side-bar-group-section":"side-bar-ungrouped-section",un?"side-bar-group-section--drop-before":"",Me?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":ye.groupId??"__ungrouped__",className:F,style:_n,children:[ye.group?u.jsx(nq,{group:ye.group,count:ye.entries.length,collapsed:vt,dragging:Kn,dragOffsetY:Kn?ie.currentY-ie.startY:0,dropTarget:un,onToggle:gG,onContextMenu:(ae,Ce)=>Ye({kind:"group",groupId:ae,anchor:Ce}),onPointerDragStart:_e}):dr&&ye.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,vt?null:u.jsx("ol",{className:["side-bar-group-chips",ie?.kind==="chip"&&ie.dragging&&ie.dropGroupId===ye.groupId&&ie.dropGroupId!==ie.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":ye.groupId??"__ungrouped__","aria-label":ye.group?ye.group.name:"Ungrouped",children:ye.entries.map(ae=>{const Ce=gn.indexOf(ae),Ze=ye.entries.indexOf(ae),Qe=V.operationAccent[ae.operation.id]??dk(ae.operation),At=Qe?Hl(Qe):null;return u.jsx(jR,{entry:ae,index:Ce,isCloseArmed:W===ae.operation.id,accentValue:At,dragging:ie?.kind==="chip"&&ie.sourceId===ae.operation.id&&ie.dragging,dragOffsetY:ie?.kind==="chip"&&ie.sourceId===ae.operation.id&&ie.dragging?ie.currentY-ie.startY:0,dropTarget:ie?.kind==="chip"&&ie.dragging===!0&&ie.dropGroupId===ye.groupId&&ie.dropGroupId===ie.sourceGroupId&&ie.dropIndex===Ze&&ie.sourceId!==ae.operation.id,onArmClose:fr,onDisarmClose:Dt,onClose:w,onMinimize:x,onFocus:k,onKeyboardMove:ds,onPointerDragStart:ce,onOpenAccent:(ei,ti)=>Ye({kind:"chip",operationId:ei,anchor:ti}),onRename:O},ae.operation.id)})})]},ye.groupId??"__ungrouped__")})})]},ue.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Pe,onDoubleClick:Tt,"aria-hidden":"true"}),pt?Pa.createPortal(u.jsx(vR,{anchor:pt.anchor,viewportBounds:pt.viewportBounds,placement:"cursor",catalog:d,canLaunch:p,renderKindIcon:v,onLaunchKind:(ue,ut)=>{nt(null),y(ue,ut)},onClose:()=>nt(null)},`${pt.anchor.x}:${pt.anchor.y}`),document.body):null,Ue?.kind==="chip"&&Li?u.jsx(pk,{kind:"chip",operation:Li,groups:n.filter(ue=>ue.theaterId===Li.theaterId),accentKey:V.operationAccent[Li.id]??dk(Li),anchor:Ue.anchor,actions:{onSetAccent:ue=>R(Li.id,ue),onSetGroupId:ue=>I(Li.id,ue),onCreateGroup:ue=>A(Li.theaterId,ue,Li.id)},onClose:()=>Ye(null)}):Ue?.kind==="group"&&hs?u.jsx(pk,{kind:"group-header",group:hs,anchor:Ue.anchor,actions:{onSetColor:ue=>$(hs.id,ue),onRename:ue=>L(hs.id,ue),onUngroupAll:()=>U(hs.id)},onClose:()=>Ye(null)}):Ue?.kind==="theater"&&Xi?u.jsx(Cq,{theater:Xi,groupCount:n.filter(ue=>ue.theaterId===Xi.id).length,anchor:Ue.anchor,onCreateGroup:ue=>{A(Xi.id,ue),Ft()},onForgetTheater:()=>{z(Xi.id),Ft()},onClose:Ft}):null,u.jsx(bR,{open:ge,onCancel:Ae,onConfirm:ke}),j?null:u.jsx(TO,{})]})}function vq(){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 yq(){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 bq(){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 Sq(){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 UR(e,t,i){const n=[...t].sort((d,p)=>d.order-p.order||d.createdAt-p.createdAt),r=n.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},c=new Map(n.map(d=>[d.id,d]));for(const d of e){const p=d.operation.groupId??null;p!==null&&c.has(p)?r.find(g=>g.groupId===p)?.entries.push(d):o.entries.push(d)}return[...r,o]}function wq({theaterId:e,operations:t,operationOrder:i,minimizedSet:n,activeOperationId:r,operationNotifications:o,operationStatus:c,catalog:d,renderKindIcon:p}){return bb(t.filter(f=>f.theaterId===e),i).map(f=>{const g=FR(d,f),v=g?p(f.pluginId,g):null;return{operation:f,active:r===f.id,minimized:n.has(f.id),notificationCount:o[f.id]?1:0,status:c[f.id],icon:v}})}function WR({theater:e,operationCount:t,active:i,collapsed:n,onSelectTheater:r,onToggleCollapsed:o,onOpenActions:c,onOpenLaunch:d,onContextMenu:p}){const f=v=>{v.preventDefault(),p(v.currentTarget.getBoundingClientRect())},g=v=>{v.target===v.currentTarget&&(v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),r(e.id)))};return u.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${i?" is-active":""}`,onClick:()=>r(e.id),onKeyDown:g,onContextMenu:f,"aria-current":i?"true":void 0,"aria-expanded":!n,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:GR(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":n?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!n,title:n?"Expand":"Collapse",onClick:v=>{v.stopPropagation(),o(e.id)},children:u.jsx(Eq,{collapsed:n})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:v=>{v.stopPropagation(),c(v.currentTarget.getBoundingClientRect(),v.currentTarget)},children:u.jsx(Tq,{})}),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:v=>d(v,e.id),children:u.jsx(v0,{})})]})]})}function xq({theater:e,entries:t,groups:i,operationCount:n,collapsed:r,onSelectTheater:o,onFocus:c,onToggleCollapsed:d,onOpenActions:p,onOpenLaunch:f,onContextMenu:g}){const v=UR(t,i);let y=gq,S=0;const w=[];for(const x of v){if(x.entries.length===0)continue;const k=x.entries.slice(0,Math.max(0,y));S+=x.entries.length-k.length,y-=k.length,k.length>0&&w.push({...x,entries:k})}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--peek","data-theater-id":e.id,children:[u.jsx(WR,{theater:e,operationCount:n,active:!1,collapsed:r,onSelectTheater:o,onToggleCollapsed:d,onOpenActions:p,onOpenLaunch:f,onContextMenu:g}),w.length>0?u.jsxs("ol",{className:"side-bar-peek-chips","aria-label":`${e.label} preview operations`,children:[w.map(x=>{const k=x.group?Hl(x.group.color):null;return u.jsxs("li",{className:x.groupId?"side-bar-group-section side-bar-group-section--peek":"side-bar-ungrouped-section",style:k?{"--grp-color":k}:void 0,children:[x.group?u.jsxs("div",{className:"side-bar-peek-group-label","aria-label":`Group ${x.group.name}`,children:[u.jsx("span",{children:x.group.name}),u.jsx("span",{className:"side-bar-peek-group-count",children:x.entries.length})]}):null,u.jsx("ol",{className:"side-bar-group-chips","aria-label":x.group?x.group.name:"Ungrouped",children:x.entries.map((R,O)=>u.jsx(jR,{entry:R,index:O,isCloseArmed:!1,accentValue:null,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:c,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},R.operation.id))})]},x.groupId??"__ungrouped__")}),S>0?u.jsxs("li",{className:"side-bar-peek-more",children:["+",S," more"]}):null]}):null]})}function Cq({theater:e,groupCount:t,anchor:i,onCreateGroup:n,onForgetTheater:r,onClose:o}){const[c,d]=b.useState(!1),[p,f]=b.useState(`Group ${t+1}`),g=b.useRef(!1),v=b.useRef(null),y=b.useRef(null),[S,w]=b.useState(i.bottom+6);b.useLayoutEffect(()=>{const k=y.current?.getBoundingClientRect().height??0,R=window.innerHeight-k-8;w(Math.max(8,Math.min(i.bottom+6,R)))},[i,c]),b.useEffect(()=>{c&&v.current?.select()},[c]),b.useEffect(()=>{const k=R=>{R.key==="Escape"&&(R.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&&n(k)};return Pa.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:u.jsxs("div",{ref:y,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:i.left,top:S},onPointerDown:k=>k.stopPropagation(),children:[c?u.jsx("input",{ref:v,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:k=>f(k.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:k=>{k.key==="Enter"&&!g.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(v0,{})}),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(Rq,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function kq(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+Ek?t.scrollTop-=Tk:e>i.bottom-Ek&&(t.scrollTop+=Tk)}function Eq({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 Tq(){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 v0(){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 GR(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(n=>Aq(n)):qR(e).filter(n=>/[\p{L}\p{N}]/u.test(n))).slice(0,2).join("").toUpperCase()||"--"}function Aq(e){return qR(e).slice(0,1)}function qR(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function Rq(){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"})]})}function Nq({operationsViewVisible:e}){const t=Gs(),i=Jl(),n=zR(),r=o5(),o=oD(),c=Lq(),d=`${c}${c==="⌘"?"":"+"}B`,p=`${c}${c==="⌘"?"⌥":"+Alt+"}B`,f=t.theaters.find(K=>K.id===t.activeTheaterId)??null,g=t.operations.find(K=>K.id===t.activeOperationId)??null,v=g?i.plugins.find(K=>K.id===g.pluginId):null,y=typeof g?.payload.cliId=="string"?g.payload.cliId:null,S=typeof g?.payload.cliLabel=="string"?g.payload.cliLabel:y,w=g?v?.operationKinds?.find(K=>K.type===g.type)??null:null,x=g&&v?.renderLaunchIcon?v.renderLaunchIcon({id:y??g.type,type:g.type,title:w?.title??g.type}):null,k=l5(),R=b.useRef(null),O=b.useRef(null),I=b.useRef(null),[A,$]=b.useState(!1),L=g0({currentTitle:g?.title??"",onCommit:K=>{const z=vx(I.current,t.activeOperationId);I.current=null,z&&TE(z,K).then(()=>Hn(null)).then(os).catch(()=>{})}});b.useEffect(()=>{!L.renaming||vx(I.current,t.activeOperationId)||(I.current=null,L.cancel())},[L,t.activeOperationId]),b.useEffect(()=>{if(!A)return;const K=z=>{const N=z.target;!(N instanceof Node)||R.current?.contains(N)||O.current?.contains(N)||$(!1)};return document.addEventListener("pointerdown",K),()=>document.removeEventListener("pointerdown",K)},[A]),b.useEffect(()=>{y4(A,k.isPathContextDeckOpen)&&$(!1)},[A,k.isPathContextDeckOpen]);const H=()=>{$(!1),R.current?.focus()},U=()=>{const K=!A;$(K),cf(b4(K,k.isPathContextDeckOpen))},oe=K=>{f&&r5(f.id,z=>XE(f.id,K,z))},fe=()=>{g&&(I.current=g.id,L.begin())};return u.jsxs("header",{className:`command-band${e?" is-operations":" is-utility"}`,style:{"--command-band-left-width":`${n.width}px`,"--command-band-right-width":`${o}px`},children:[u.jsxs("div",{className:`command-band-left${e&&n.collapsed?" is-collapsed":""}`,children:[u.jsx(AO,{className:"command-band-brand"}),e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>_0(!n.collapsed),"aria-label":`${n.collapsed?"Expand sidebar":"Collapse sidebar"} (${d})`,title:`${n.collapsed?"Expand sidebar":"Collapse sidebar"} (${d})`,children:u.jsx(Ak,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:FE,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(Mq,{})})]}),u.jsxs("div",{className:"command-band-center",children:[e&&f?u.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${f.label}`,children:[u.jsxs("span",{className:"command-band-theater-segment",children:[u.jsx("span",{className:"command-band-theater-mark",children:GR(f.label)}),f.label]}),g?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),L.renaming?u.jsx("input",{ref:L.inputRef,className:"command-band-rename-input",value:L.draftTitle,"aria-label":`${g.title} 이름 변경`,onChange:K=>L.setDraftTitle(K.target.value),onKeyDown:L.handleKeyDown,onBlur:L.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:fe,title:"Double-click to rename",children:g.title}),S?u.jsxs("span",{className:"command-band-operation-attribute",title:w?.title??S,children:[x?u.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:x}):null,S]}):null]}):null]}):null,e&&f&&k.pathContextHydrated&&k.pathContext?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-context-separator","aria-hidden":"true"}),u.jsxs("div",{className:"command-band-context",children:[u.jsxs("button",{ref:R,type:"button",className:"command-band-context-trigger",onClick:U,"aria-expanded":A,"aria-haspopup":"dialog",title:k.pathContextError??"Path context — shared with the Activity Rail",children:[u.jsx(Oq,{}),k.pathContext.label,u.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),A?u.jsx(t5,{ref:O,className:"command-band-context-deck",theaterId:f.id,theaterLabel:f.label,context:k.pathContext,isMutating:k.pathContextMutationInProgress,onSelect:oe,onClose:H}):null]})]}):null]}),u.jsx("div",{className:"command-band-right",children:e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:n5,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${p})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${p})`,children:u.jsx(Ak,{side:"right"})}):null})]})}function Lq(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function Mq(){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 Ak({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 Oq(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 4.5a1 1 0 0 1 1-1h3l1.5 1.7h4.5a1 1 0 0 1 1 1v6.3a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}const Dq=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function jq({state:e}){const[t,i]=b.useState(!1),n=b.useRef(null),r=b.useRef(null),o=b.useRef(null),c=e.theaters.length>0;if(b.useEffect(()=>{if(e.onboardingOpen)return n.current=document.activeElement,r.current?.focus(),()=>{const g=n.current;n.current=null,g?.focus?.()}},[e.onboardingOpen]),b.useEffect(()=>{if(!e.onboardingOpen)return;const g=v=>{t||(v.key==="Escape"?(v.preventDefault(),Vc()):v.key==="Tab"&&Iq(v,o.current),v.stopImmediatePropagation())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const d=()=>{i(!0)},p=()=>{i(!1)},f=async g=>{i(!1),zE();try{const v=await EE(g),y=await kE(v);$E(y)}catch(v){gv(v instanceof Error?v.message:String(v))}};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:Vc,"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($u,{ref:g=>{r.current=g},className:"commissioning-primary-action",to:"/operations",onClick:Vc,children:"Go to Operations →"}):u.jsx("button",{ref:g=>{r.current=g},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:d,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Open an Operation"}),u.jsx("p",{children:"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session."}),u.jsx($u,{className:"commissioning-secondary-link",to:"/operations",onClick:Vc,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:Vc,children:"Skip for now"})]})]}),u.jsx(bR,{open:t,onCancel:p,onConfirm:f})]})}function Iq(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(Dq)),n=i[0],r=i[i.length-1];!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))}const Bq="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",Rk="operation-search-listbox",KR="__unassigned__";function Pq({state:e}){const t=oh(),[i,n]=b.useState(""),[r,o]=b.useState(0),c=b.useRef(null),d=b.useRef(null),p=b.useRef(null),f=b.useRef(new Map),g=b.useMemo(()=>oO(e),[e]),v=b.useMemo(()=>x4(g,i),[g,i]),y=b.useMemo(()=>C4(v),[v]),S=b.useMemo(()=>NE(i),[i]),w=Nk(r,v.length),x=v[w]?Lk(v[w].operationId):void 0;if(b.useEffect(()=>{if(!e.operationSearchOpen)return;p.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const O=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>c.current?.focus(),0),()=>{document.body.style.overflow=O,p.current?.focus()}},[e.operationSearchOpen]),b.useEffect(()=>{if(!e.operationSearchOpen){n(""),o(0);return}o(0)},[e.operationSearchOpen,i]),b.useEffect(()=>{if(!e.operationSearchOpen)return;const O=v[w];O&&f.current.get(O.operationId)?.scrollIntoView({block:"nearest"})},[w,v,e.operationSearchOpen]),!e.operationSearchOpen)return null;const k=O=>{Uu(O),t("/operations"),qg()},R=O=>{if(O.key==="Escape"){O.preventDefault(),qg();return}if(O.key==="ArrowDown"||O.key==="ArrowUp"){O.preventDefault(),o(I=>Nk(I+(O.key==="ArrowDown"?1:-1),v.length));return}if(O.key==="Enter"){const I=v[w];if(!I)return;O.preventDefault(),k(I.operationId);return}O.key==="Tab"&&Fq(O,d.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:O=>{O.target===O.currentTarget&&qg()},children:u.jsxs("section",{ref:d,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:R,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(Uq,{}),u.jsx("input",{ref:c,id:"operation-search-input",type:"search",value:i,onChange:O=>n(O.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":Rk,"aria-activedescendant":x,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:Rk,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:y.length>0?y.map(O=>{const I=$q(O.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":I,children:[u.jsx("h2",{id:I,className:"operation-search-section-heading",children:G_(O.theaterLabel,S)}),O.entries.map(A=>{const $=v.indexOf(A),L=$===w;return u.jsxs("button",{id:Lk(A.operationId),ref:H=>{H?f.current.set(A.operationId,H):f.current.delete(A.operationId)},type:"button",className:`operation-search-result ${L?"is-active":""}`,role:"option","aria-selected":L,onMouseEnter:()=>o($),onClick:()=>k(A.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:G_(A.operationName,S)}),u.jsx("small",{children:zq(A)})]}),u.jsx("span",{className:"operation-search-theater",children:G_(A.theaterLabel,S)})]},A.operationId)})]},O.theaterId??KR)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function Nk(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function zq(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function $q(e){return`operation-search-heading-${VR(e??KR)}`}function Lk(e){return`operation-search-option-${VR(e)}`}function VR(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function G_(e,t){if(t.length===0)return e;const i=[];let n=0;for(;n<e.length;){const r=Hq(e,t,n);if(!r){i.push(e.slice(n));break}r.start>n&&i.push(e.slice(n,r.start)),i.push(u.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),n=r.end}return i}function Hq(e,t,i){const n=e.toLocaleLowerCase();let r=null;for(const o of t){const c=n.indexOf(o,i);c!==-1&&(!r||c<r.start)&&(r={start:c,end:c+o.length})}return r}function Fq(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(Bq)).filter(o=>o.offsetParent!==null);if(i.length===0)return;const n=i[0],r=i[i.length-1];if(e.shiftKey&&document.activeElement===n){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}function Uq(){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 Wq({open:e,title:t,message:i,tone:n="info",onDismiss:r}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${n}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),i?u.jsx("p",{className:"app-toast-message",children:i}):null]}),r?u.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function YR(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await XR(t),ZR(await t.json(),t.status)}async function Gq(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await XR(i);const n=await i.json();if(!n||typeof n!="object"||!("state"in n))throw new gt(i.status,"Invalid global settings mutation response");return{state:ZR(n.state,i.status)}}async function XR(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new gt(e.status,t)}function ZR(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!qq(i.consoleStaticPort)||i.theme!=="instrument"&&i.theme!=="maritime"&&i.theme!=="carbon"||!Kq(i.language))throw new gt(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme,uiFont:O4(i.uiFont),language:i.language}}function qq(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function Kq(e){return e==="auto"||e==="en"||e==="ko"}const Xy=new Set;let ih={loading:!1,state:null,savingField:null,error:null};function y0(){return b.useSyncExternalStore(Yq,ap,ap)}function ap(){return ih}function Vq(e){xo({loading:!1,state:e,error:null})}function Yq(e){return Xy.add(e),()=>{Xy.delete(e)}}async function Xq(e){xo({loading:!0,error:null});try{const t=await YR(e);xo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;xo({loading:!1,error:JR(t)})}}async function Wl(e,t){if(ih.savingField!==null)return!1;const i=ih.state,n=i?{...i,[e]:t}:null;xo({state:n,savingField:e,error:null});try{const r=await Gq({[e]:t});return xo({state:r.state,savingField:null,error:null}),!0}catch(r){return xo({state:i,savingField:null,error:JR(r)}),!1}}function xo(e){ih={...ih,...e};for(const t of Xy)t()}function JR(e){return e instanceof Error?e.message:String(e)}let Bl=null,Au=0;function QR(e){Bl?.abort();const t=new AbortController,i=++Au;return Bl=t,$4(),i4({...e,signal:t.signal}).then(n=>{i===Au&&H4(n)}).catch(n=>{t.signal.aborted||i!==Au||F4(n instanceof Error?n.message:String(n))}).finally(()=>{i===Au&&(Bl=null)})}function Zq(){Bl!==null&&(Bl.abort(),Bl=null,Au+=1)}function eN(e,t=Jq()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function Jq(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const tN=[{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"}],q_={id:"overview",label:"Overview"},Qq={id:"all-updates",label:"All updates"},eK={id:"other-updates",label:"Other updates"};function iN(e){const t=e.sections.some(n=>n.items.some(r=>r.product===void 0)),i=tN.filter(n=>e.sections.some(r=>r.items.some(o=>o.product===n.id)));return i.length===0?[q_,Qq]:t?[q_,...i,eK]:[q_,...i]}function tK(e,t){return t==="overview"?[]:e.sections.map(i=>({...i,items:i.items.filter(n=>t==="all-updates"||t==="other-updates"?n.product===void 0:n.product===t)})).filter(i=>i.items.length>0)}function iK(e){const t=tN.flatMap(n=>{const r=e.sections.flatMap(o=>o.items.filter(c=>c.product===n.id));return r.length===0?[]:[{id:n.id,label:n.label,count:r.length,summary:r[0].text}]}),i=e.sections.flatMap(n=>n.items.filter(r=>r.product===void 0));return i.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:i.length,summary:i[0].text}]}function nK(e,t){return iN(e).some(i=>i.id===t)}const sK=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),fu=10;function rK({state:e}){const t=b.useRef(null),i=b.useRef([]),n=b.useRef(null),r=b.useRef(null),o=b.useRef(new Map),[c,d]=b.useState("overview"),p=y0(),f=eN(p.state?.language??"auto"),g=e.selectedReleaseNoteKey??_l(e.releaseNotes[0]?.version??"",0),v=e.releaseNotes.findIndex((U,oe)=>_l(U.version,oe)===g),y=e.releaseNotes[v]??e.releaseNotes[0],S=y?_l(y.version,v>=0?v:0):"",w=y?iN(y):[];b.useEffect(()=>{d("overview")},[S]),b.useEffect(()=>{y&&!nK(y,c)&&d("overview")},[c,y]),b.useEffect(()=>{const U=oe=>{const fe=oe.target instanceof HTMLElement?oe.target:null;if(!fe||fe.closest(".whatsnew-card"))return;const K=i.current.filter(z=>z!==fe&&z.isConnected);i.current=[...K.slice(-4),fe]};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),b.useEffect(()=>{if(!e.whatsNewOpen||x)return;const U=oe=>{oe.key==="Escape"?(oe.preventDefault(),Nd()):cK(oe,r.current,d)?oe.preventDefault():oe.key==="Tab"&&lK(oe,r.current),oe.stopImmediatePropagation()};return n.current?.focus(),window.addEventListener("keydown",U,!0),()=>{window.removeEventListener("keydown",U,!0);const oe=t.current?.isConnected?t.current:[...i.current].reverse().find(fe=>fe.isConnected);t.current=null,oe?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||y===void 0)return null;const k=()=>{QR({force:!0,locale:f})},R=async U=>{await Wl("language",U)},O=Math.max(1,Math.ceil(e.releaseNotes.length/fu)),I=Math.min(O-1,Math.floor((v>=0?v:0)/fu)),A=I*fu,$=e.releaseNotes.slice(A,A+fu),L=U=>{const oe=I+U;if(oe<0||oe>=O)return;const fe=oe*fu,K=e.releaseNotes[fe];K&&Sx(_l(K.version,fe))},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:Nd,"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",y.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[y.date?u.jsxs("time",{className:"whatsnew-date",dateTime:y.date,children:["Released ",y.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:n,type:"button",className:"whatsnew-close",onClick:Nd,"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=>Sx(U.currentTarget.value),children:$.map((U,oe)=>{const fe=A+oe;return u.jsxs("option",{value:_l(U.version,fe),children:[U.version==="Unreleased"?"Unreleased":`v${U.version}`,U.date?` · ${U.date}`:""]},_l(U.version,fe))})}),O>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>L(-1),disabled:I===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[I+1," / ",O]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>L(1),disabled:I>=O-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:()=>{R(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:oe=>{oe?o.current.set(U.id,oe):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:iK(y).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))}):tK(y,c).map((U,oe)=>u.jsx(aK,{section:U,index:oe},U.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Nd,children:"Close"})})]})]})}function aK({section:e,index:t}){const i=e.heading.toLowerCase().replaceAll(" ","-"),n={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${i}`,style:n,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(oK,{item:r})},`${r.text}:${o}`))})]})}function oK({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,i)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${i}`)),u.jsx("span",{children:e.text})]})}function _l(e,t){return`${e}:${t}`}function lK(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(sK)),n=i[0],r=i[i.length-1];!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))}function cK(e,t,i){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const n=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!n||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(n);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?(i(p),d.focus(),!0):!1}function uK(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function hK(e,t=window){const i=n=>{if(!(VE()||uK(t.document))){if((n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="k"){n.preventDefault(),n.stopImmediatePropagation(),e.toggleOperationSearch();return}if((n.metaKey||n.ctrlKey)&&n.code==="KeyB"&&n.altKey&&!n.shiftKey&&(n.metaKey||n.key.toLowerCase()==="b")){n.preventDefault(),n.stopImmediatePropagation(),e.toggleRailChrome();return}(n.metaKey||n.ctrlKey)&&n.code==="KeyB"&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),n.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",i,!0),()=>t.removeEventListener("keydown",i,!0)}function Mp(e=()=>{}){return{...sE(e),notifications:{emit:i=>J4(i),dismiss:i=>nO(i)},status:{set:(i,n)=>Z4(i,n),clear:i=>PE(i)}}}const dK=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function nN(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await S0(t),sN(await t.json(),t.status)}async function fK(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await S0(t),gK(await t.json(),t.status)}async function K_(e,t,i){return b0(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function pK(e,t,i,n){return b0(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,n)}async function mK(e,t,i){return b0(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function b0(e,t,i,n){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:n});await S0(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new gt(r.status,"Invalid carrier settings mutation response");return{state:sN(o.state,r.status)}}async function S0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new gt(e.status,t)}function sN(e,t){rN(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new gt(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(n=>_K(n,t))}}function gK(e,t){rN(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new gt(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(n=>vK(n,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function _K(e,t){const i=e;if(!i||typeof i.carrierId!="string"||typeof i.displayName!="string"||typeof i.sourceDisplayName!="string"||typeof i.role!="string"||typeof i.roleDescription!="string"||typeof i.slot!="number"||typeof i.cliType!="string"||typeof i.defaultCliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string"||typeof i.taskForceBackendCount!="number"||!i.taskforce||!Array.isArray(i.taskforce.backends))throw new gt(t,"Invalid carrier settings carrier response");return{carrierId:i.carrierId,displayName:i.displayName,sourceDisplayName:i.sourceDisplayName,role:i.role,roleDescription:i.roleDescription,...i.category?{category:i.category}:{},slot:i.slot,cliType:i.cliType,defaultCliType:i.defaultCliType,model:i.model,...i.effort?{effort:i.effort}:{},taskForceBackendCount:i.taskForceBackendCount,taskforce:{backends:i.taskforce.backends.map(n=>bK(n,t))}}}function vK(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.displayName!="string"||!Array.isArray(i.models)||typeof i.defaultModel!="string")throw new gt(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(n=>yK(n,t)),defaultModel:i.defaultModel}}function yK(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new gt(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new gt(t,"Invalid carrier settings effort option");return{modelId:i.modelId,name:i.name,...i.effort?{effort:{levels:i.effort.levels.filter(n=>typeof n=="string"),default:i.effort.default}}:{}}}function bK(e,t){const i=e;if(!i||typeof i.cliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string")throw new gt(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function rN(e,t){const i=[e];for(;i.length>0;){const n=i.pop();if(!(!n||typeof n!="object"))for(const[r,o]of Object.entries(n)){if(dK.has(r))throw new gt(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&i.push(o)}}}const SK={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Zy=new Set;let on={loading:!1,state:null,options:null,activeCarrierId:null,draft:SK,savingActionId:null,error:null};function aN(){return b.useSyncExternalStore(wK,Mk,Mk)}function Mk(){return on}function wK(e){return Zy.add(e),()=>{Zy.delete(e)}}async function Ok(e){or({loading:!0,error:null});try{const[t,i]=await Promise.all([nN(e),fK(e)]);oN(t,i)}catch(t){if(e?.aborted)return;or({loading:!1,error:cN(t)})}}function xK(e){const t=on.state?.carriers.find(i=>i.carrierId===e);or({activeCarrierId:e,draft:t?w0(t,on.options):on.draft,error:null})}function Rl(e){or({draft:{...on.draft,...e},error:null})}function Jy(e,t){const i=on.draft.taskforce[e]??{model:"",effort:""};or({draft:{...on.draft,taskforce:{...on.draft.taskforce,[e]:{...i,...t}}},error:null})}function CK(){const e=lN();e&&or({draft:w0(e,on.options),error:null})}async function kK(e){const t=lN();return t?EK("save-all",async()=>{const i=on.draft;let n=null;i.displayName!==t.displayName&&(n=(await K_(t.carrierId,{displayName:i.displayName})).state);const r=i.cliType!==t.cliType;return r&&(n=(await K_(t.carrierId,{cli:i.cliType})).state),(r||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(n=(await K_(t.carrierId,{model:AK(i)})).state),n=await RK(t,e,n),{state:n??await nN()}}):!1}function oN(e,t){const i=NK(e,on.activeCarrierId),n=e.carriers.find(r=>r.carrierId===i)??null;or({loading:!1,state:e,options:t,activeCarrierId:i,draft:n?w0(n,t):on.draft,error:null})}async function EK(e,t){or({savingActionId:e,error:null});try{const i=await t();return oN(i.state,on.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),or({savingActionId:null}),!0}catch(i){return or({savingActionId:null,error:cN(i)}),!1}}function w0(e,t){const i=Object.fromEntries((t?.cliTypes??[]).map(n=>{const r=e.taskforce.backends.find(o=>o.cliType===n.id);return[n.id,{model:r?.model??n.defaultModel,effort:r?.effort??TK(n.id,r?.model??n.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function TK(e,t,i){return i?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function AK(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function lN(){return on.state?.carriers.find(e=>e.carrierId===on.activeCarrierId)??null}async function RK(e,t,i){const n=new Set(t.map(r=>r.cliType));for(const r of e.taskforce.backends)n.has(r.cliType)||(i=(await mK(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||"")||(i=(await pK(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return i}function NK(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function or(e){on={...on,...e};for(const t of Zy)t()}function cN(e){return e instanceof Error?e.message:String(e)}const LK=50,MK=2400,OK={nimitz:"var(--captain-nimitz)",kirov:"var(--captain-kirov)",genesis:"var(--captain-genesis)",ohio:"var(--captain-ohio)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)",tempest:"var(--captain-tempest)",chronicle:"var(--captain-chronicle)"};function DK(){const e=aN(),t=e.state?.carriers.find(x=>x.carrierId===e.activeCarrierId)??null,i=e.options?.cliTypes.find(x=>x.id===e.draft.cliType)??null,n=i?.models.find(x=>x.modelId===e.draft.model)??null,[r,o]=b.useState(!1),[c,d]=b.useState([]),[p,f]=b.useState("idle"),g=e.savingActionId==="save-all",v=t?$K(t,e.draft,c):!1,y=t?.taskforce.backends.map(x=>`${x.cliType}:${x.model}:${x.effort??""}`).join("|")??"";b.useEffect(()=>{const x=new AbortController;return Ok(x.signal),()=>x.abort()},[]),b.useEffect(()=>{o(!1),d(t?.taskforce.backends.map(x=>x.cliType)??[]),f("idle")},[t?.carrierId,y]),b.useEffect(()=>{if(p!=="saved")return;const x=window.setTimeout(()=>f("idle"),MK);return()=>window.clearTimeout(x)},[p]);function S(){t&&(CK(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),f("idle"))}async function w(){if(!t)return;if(f("saving"),!await kK(FK(c,e.draft.taskforce))){f("idle");return}o(!1),f("saved")}return u.jsxs("main",{className:"carrier-settings-page",children:[u.jsxs("section",{className:"carrier-settings-hero","aria-labelledby":"carrier-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Configure Carrier settings"}),u.jsx("h2",{id:"carrier-settings-title",children:"Carrier Settings"})]}),u.jsxs("div",{className:"carrier-settings-hero-actions",children:[u.jsx("div",{className:`carrier-settings-save-status ${p==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:p==="saving"||g?"Saving…":p==="saved"?"Saved ✓":""}),t?u.jsxs("div",{className:"carrier-settings-save-actions",children:[u.jsx("button",{type:"button",className:`carrier-settings-action-button ${v?"is-dirty":""}`,disabled:!v||g,onClick:()=>{w()},children:"Save"}),u.jsx("button",{type:"button",className:`carrier-settings-action-button ${v?"is-dirty":""}`,disabled:!v||g,onClick:S,children:"Discard"})]}):null,u.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{Ok()},children:"Refresh"})]})]}),e.error?u.jsx("p",{className:"carrier-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"carrier-settings-grid",children:[u.jsxs("div",{className:"carrier-settings-list","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"carrier-settings-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"carrier-settings-empty",children:"No carriers registered."}):null,e.state?.carriers.map(x=>u.jsx(jK,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>xK(x.carrierId)},x.carrierId))]}),t&&e.options&&i?u.jsxs("div",{className:"carrier-settings-detail",style:dN(t.carrierId),children:[u.jsxs("div",{className:"carrier-settings-detail-head",children:[u.jsxs("div",{className:"carrier-settings-detail-title-block",children:[u.jsxs("div",{className:"carrier-settings-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`carrier-settings-name-line ${r?"is-editing":""}`,children:r?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"carrier-settings-input carrier-settings-name-input",value:e.draft.displayName,maxLength:LK,onChange:x=>Rl({displayName:x.target.value})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:g,onClick:()=>{o(!1)},children:u.jsx(WK,{})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{Rl({displayName:t.displayName}),o(!1)},children:u.jsx(GK,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"carrier-settings-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Edit display name",onClick:()=>{Rl({displayName:t.displayName}),o(!0)},children:u.jsx(UK,{})})]})}),u.jsx("div",{className:"carrier-settings-captain-role",children:t.role})]}),u.jsxs("div",{className:"carrier-settings-cli-badge",children:[u.jsx("span",{className:"ind","aria-hidden":"true"}),t.cliType]})]}),u.jsxs("div",{className:"carrier-settings-body",children:[u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Identity"}),u.jsx("div",{className:"carrier-settings-mission",children:t.roleDescription})]}),u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Runtime"}),u.jsxs("div",{className:"carrier-settings-runtime",children:[u.jsx("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--cli",children:u.jsxs("div",{className:"carrier-settings-field carrier-settings-field--wide",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"carrier-settings-select",value:e.draft.cliType,onChange:x=>BK(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:"carrier-settings-runtime-row carrier-settings-runtime-row--model",children:[u.jsx(uN,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:x=>PK(i,x)}),u.jsx(hN,{id:"carrier-effort",model:n,value:e.draft.effort,onChange:x=>Rl({effort:x})})]})]})]}),u.jsx(IK,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:c,onRowsChange:d})]})]},t.carrierId):u.jsx("div",{className:"carrier-settings-detail",children:u.jsx("p",{className:"carrier-settings-empty",children:"Select a carrier."})})]})]})}function jK({carrier:e,active:t,minBackends:i,onSelect:n}){const r=e.taskForceBackendCount>=i;return u.jsxs("button",{type:"button",className:`carrier-settings-row ${t?"is-active":""}`,style:dN(e.carrierId),onClick:n,children:[u.jsx("span",{className:"carrier-settings-captain-dot","aria-hidden":"true"}),u.jsxs("span",{className:"carrier-settings-row-text",children:[u.jsx("span",{className:"carrier-settings-row-name",children:e.displayName}),u.jsx("span",{className:"carrier-settings-row-role",children:e.role})]}),u.jsx("span",{className:"carrier-settings-row-live","aria-hidden":"true",children:u.jsx("span",{className:`carrier-settings-live-dot ${r?"is-live":""}`})})]})}function uN({id:e,label:t,models:i,value:n,disabled:r=!1,onChange:o}){return u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"carrier-settings-select",value:n,disabled:r,onChange:c=>o(c.target.value),children:i.map(c=>u.jsx("option",{value:c.modelId,children:c.name},c.modelId))})]})}function hN({id:e,model:t,value:i,disabled:n=!1,onChange:r}){return t?.effort?u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"carrier-settings-select",value:i||t.effort.default,disabled:n,onChange:o=>r(o.target.value),children:t.effort.levels.map(o=>u.jsx("option",{value:o,children:o},o))})]}):u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("span",{className:"carrier-settings-label",children:"Effort"}),u.jsx("p",{className:"carrier-settings-help",children:"Not supported for this model."})]})}function IK({carrier:e,cliOptions:t,minBackends:i,savingActionId:n,rows:r,onRowsChange:o}){const c=aN(),d=e.taskforce.backends.length,[p,f]=b.useState(d>0),[g,v]=b.useState(!1),[y,S]=b.useState(""),w=e.taskForceBackendCount>=i,x=t.filter(R=>!r.includes(R.id)),k=y||x[0]?.id||"";return u.jsxs("div",{className:`carrier-settings-control-group carrier-settings-control-group--taskforce ${p?"is-expanded":""}`,children:[u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"carrier-settings-resp-title",children:"Task Force"}),u.jsx("p",{className:"carrier-settings-help",children:d>0?`${d} backend${d===1?"":"s"} configured${w?" · active":` · needs ${i}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${i} to activate.`})]}),u.jsx("div",{className:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":p,onClick:()=>f(R=>!R),children:p?"Hide":"Configure"})})]}),p?u.jsxs("div",{className:"carrier-settings-tf-list",children:[r.length===0?u.jsx("p",{className:"carrier-settings-tf-empty",children:"No Task Force backend drafted."}):null,r.map(R=>{const O=t.find(L=>L.id===R);if(!O)return null;const I=c.draft.taskforce[O.id]??{model:O.defaultModel,effort:""},A=O.models.find(L=>L.modelId===I.model)??O.models[0]??null,$=e.taskforce.backends.some(L=>L.cliType===O.id);return u.jsxs("div",{className:`carrier-settings-tf-item ${$?"is-active":""}`,children:[u.jsxs("div",{className:"carrier-settings-tf-title",children:[u.jsx("span",{className:`carrier-settings-live-dot ${$?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:O.displayName})]}),u.jsx(uN,{id:`tf-${O.id}-model`,label:"Model",models:O.models,value:I.model,onChange:L=>zK(O,L)}),u.jsx(hN,{id:`tf-${O.id}-effort`,model:A,value:I.effort,onChange:L=>Jy(O.id,{effort:L})}),u.jsx("div",{className:"carrier-settings-tf-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:n==="save-all",onClick:()=>o(r.filter(L=>L!==O.id)),children:"Remove"})})]},O.id)}),u.jsxs("div",{className:"carrier-settings-tf-add-row",children:[g&&x.length>0?u.jsx("select",{className:"carrier-settings-select carrier-settings-tf-add-select",value:k,onChange:R=>S(R.target.value),"aria-label":"Task Force CLI to add",children:x.map(R=>u.jsx("option",{value:R.id,children:R.displayName},R.id))}):null,u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:x.length===0||n==="save-all",onClick:()=>{if(!g){v(!0);return}const R=k,O=t.find(A=>A.id===R),I=O?.models.find(A=>A.modelId===O.defaultModel)??O?.models[0]??null;!O||!I||(Jy(O.id,{model:I.modelId,effort:I.effort?.default??""}),o(r.includes(O.id)?r:[...r,O.id]),S(""),v(!1))},children:"Add"})]})]}):null]})}function BK(e,t){const i=t.find(r=>r.id===e),n=i?.models.find(r=>r.modelId===i.defaultModel)??i?.models[0]??null;Rl({cliType:e,model:n?.modelId??"",effort:n?.effort?.default??""})}function PK(e,t){const i=e.models.find(n=>n.modelId===t);Rl({model:t,effort:i?.effort?.default??""})}function zK(e,t){const i=e.models.find(n=>n.modelId===t);Jy(e.id,{model:t,effort:i?.effort?.default??""})}function $K(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:HK(e,i,t.taskforce)}function HK(e,t,i){if(t.length!==e.taskforce.backends.length)return!0;const n=new Set(t);for(const r of e.taskforce.backends){if(!n.has(r.cliType))return!0;const o=i[r.cliType];if(!o||o.model!==r.model||(o.effort||"")!==(r.effort||""))return!0}return!1}function FK(e,t){return e.map(i=>{const n=t[i];return n?{cliType:i,model:n.model,...n.effort?{effort:n.effort}:{}}:null}).filter(i=>i!==null)}function dN(e){return{"--cap-color":OK[e]??"var(--brass)"}}function UK(){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 WK(){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 GK(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}async function qK(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await KK(t),VK(await t.json(),t.status).routes}async function KK(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new gt(e.status,t)}function VK(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new gt(t,"Invalid backend API catalog response");return{routes:i.routes.map(n=>YK(n,t))}}function YK(e,t){const i=e;if(!i||typeof i!="object"||typeof i.method!="string"||typeof i.path!="string"||typeof i.summary!="string"||typeof i.category!="string"||typeof i.gate!="string")throw new gt(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const Qy=new Set;let eb={loading:!1,state:null,error:null};function XK(){return b.useSyncExternalStore(ZK,Dk,Dk)}function Dk(){return eb}function ZK(e){return Qy.add(e),()=>{Qy.delete(e)}}async function JK(e){V_({loading:!0,error:null});try{const t=await qK(e);V_({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;V_({loading:!1,error:QK(t)})}}function V_(e){eb={...eb,...e};for(const t of Qy)t()}function QK(e){return e instanceof Error?e.message:String(e)}function eV(){const e=XK(),[t,i]=b.useState(!0),n=b.useMemo(()=>nV(e.state??[]),[e.state]),r=e.state?.length??0,o=n.length;return b.useEffect(()=>{const c=new AbortController;return JK(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 carrier-settings-control-group--taskforce ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children: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:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":t,onClick:()=>i(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:[n.length>0?n.map(c=>u.jsx(tV,{group:c},c.category)):null,e.state&&n.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 tV({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(iV,{entry:t},`${t.method}:${t.path}`))})]})}function iV({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 nV(e){const t=new Map;for(const i of e){const n=i.category.trim()||"Uncategorized",r=t.get(n);r?r.push(i):t.set(n,[i])}return Array.from(t.entries()).map(([i,n])=>({category:i,entries:n}))}const sV=[{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)"]}],rV=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],aV=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],oV=1024,lV=65535,cV=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function uV(){const e=y0(),t=e.state,i=e.savingField!==null,[n,r]=b.useState("general"),o=Jl(),c=dV(o.plugins),d=fV(c);return b.useEffect(()=>{const p=new AbortController;return Xq(p.signal),()=>p.abort()},[]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Console"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:i?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),cV.map(p=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${p.id===n?"is-active":""}`,"aria-pressed":p.id===n,onClick:()=>r(p.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:p.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:p.eyebrow})]},p.id)),c.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),d.map(p=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:p.pluginLabel}),p.sections.map(f=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${f.id===n?"is-active":""}`,"aria-pressed":f.id===n,onClick:()=>r(f.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:f.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:f.pluginLabel})]},f.id))]},p.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:hV(n,t,i,c)},n)]})]})}function hV(e,t,i,n){if(e.includes(":")){const r=n.find(o=>o.id===e);return r?.render?u.jsx(ub,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children: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(mV,{state:t,saving:i}),u.jsx(gV,{state:t,saving:i}),u.jsx(_V,{state:t,saving:i})]});case"backend-api":return u.jsx(eV,{})}}function dV(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:pV(t.id),sectionTitle:i.title,render:i.render})))}function fV(e){const t=[];for(const i of e){const n=t.at(-1);if(n?.pluginId===i.pluginId){t[t.length-1]={...n,sections:[...n.sections,i]};continue}t.push({pluginId:i.pluginId,pluginLabel:i.pluginLabel,sections:[i]})}return t}function pV(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function mV({state:e,saving:t}){const i=e?.theme??"instrument",n=r=>{if(ap().savingField!==null)return;const o=i;Of(r),Wl("theme",r).then(c=>{c||Of(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:sV.map(r=>{const o=r.id===i;return u.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>n(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(bV,{}):null})]},r.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function gV({state:e,saving:t}){const i=e?.uiFont??Nu,[n,r]=b.useState([]),[o,c]=b.useState(!0),[d,p]=b.useState(null);b.useEffect(()=>{const v=new AbortController;return f5({signal:v.signal}).then(y=>{r(y.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(y=>{v.signal.aborted||(r([]),p(y instanceof Error?y.message:"Installed fonts could not be loaded."))}).finally(()=>{v.signal.aborted||c(!1)}),()=>v.abort()},[]);const f=v=>{if(ap().savingField!==null)return;const y=i;mv(v),Wl("uiFont",v).then(S=>{S||mv(y)})},g=v=>{const y=v.source==="builtin"?{source:"builtin",id:v.id,size:i.size}:{source:"system",familyName:v.familyName,size:i.size};f(y)};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||i.source==="builtin"&&i.id==="manrope"&&i.size===Nl.defaultValue,onClick:()=>f(Nu),children:"Reset to Fleet default"})]}),u.jsx(h5,{builtIns:Mf.map(({id:v,label:y,family:S,aliases:w,description:x})=>({id:v,label:y,family:S,aliases:w,description:x})),installedFonts:n,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:ME(Nu),previewText:"Fleet typography keeps operations readable.",size:i.size,sizeRange:Nl,loading:o,error:d,disabled:!e||t,onSelectionChange:g,onSizeCommit:v=>f({...i,size:v})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function _V({state:e,saving:t}){const i=Gs();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(yV,{state:e,saving:t,consoleState:i}),u.jsx(vV,{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 vV({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:aV.map(i=>{const n=e.language===i.id;return u.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,disabled:t,onClick:()=>{Wl("language",i.id)},children:i.label},i.id)})}),u.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function yV({state:e,saving:t,consoleState:i}){const[n,r]=b.useState(e.consoleStaticPort?.toString()??""),o=i.effectivePort,c=i.portMode==="static"&&!i.portHonored,d=i.requestedPort,p=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=n.trim(),g=Number(f),v=f.length>0,y=v&&jk(g),S=e.consolePortMode==="static"&&v&&!y;return b.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:rV.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:()=>{Wl("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:n,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());jk(k)&&Wl("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 jk(e){return Number.isInteger(e)&&e>=oV&&e<=lV}function bV(){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 SV(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function nh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function wV(e,t){return{...SV(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const Ik=256,Bk=176,Y_=12,nf=220,fN="fleet-console.map.radarCollapsed";function xV({operations:e,pluginOperations:t,viewport:i,canvasSize:n,onJump:r}){const o=b.useRef(null),c=b.useRef(!1),d=b.useRef(null),[p,f]=b.useState(CV),g=Ap();if(b.useEffect(()=>{if(g){d.current===null&&(d.current=p,f(!0));return}d.current!==null&&(f(d.current),d.current=null)},[p,g]),n.width<=0||n.height<=0||i.zoom<=0)return null;const v=[...Object.entries(e).map(([T,E])=>({id:T,x:E.x,y:E.y,width:E.width,height:E.height})),...Object.entries(t).map(([T,E])=>({id:T,x:E.geometry.x,y:E.geometry.y,width:E.geometry.width,height:E.geometry.height}))];if(v.length===0)return null;const y=()=>{f(T=>{const E=!T;return g||kV(E),E})};if(p)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:y,"aria-label":"Open Map",title:"Open Map",children:u.jsx(TV,{})});const S=Ik-Y_*2,w=Bk-Y_*2,x={x:-i.x/i.zoom,y:-i.y/i.zoom,width:n.width/i.zoom,height:n.height/i.zoom};let k=Math.min(x.x,...v.map(T=>T.x)),R=Math.min(x.y,...v.map(T=>T.y)),O=Math.max(x.x+x.width,...v.map(T=>T.x+T.width)),I=Math.max(x.y+x.height,...v.map(T=>T.y+T.height));k-=nf,R-=nf,O+=nf,I+=nf;const A=O-k,$=I-R,L=Math.min(S/A,w/$),H=(S-A*L)/2,U=(w-$*L)/2,oe=T=>H+(T-k)*L,fe=T=>U+(T-R)*L,K=T=>{const E=o.current?.getBoundingClientRect();if(!E)return;const j=T.clientX-E.left,P=T.clientY-E.top;r({x:k+(j-H)/L,y:R+(P-U)/L})},z=T=>{T.stopPropagation(),c.current=!0,T.currentTarget.setPointerCapture(T.pointerId),K(T)},N=T=>{c.current&&(T.stopPropagation(),K(T))},D=T=>{c.current=!1;try{T.currentTarget.releasePointerCapture(T.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:Ik,height:Bk},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:y,"aria-label":"Collapse Map",title:"Collapse Map",children:u.jsx(EV,{})}),u.jsxs("div",{ref:o,className:"canvas-minimap-inner",style:{inset:Y_},onPointerDown:z,onPointerMove:N,onPointerUp:D,onPointerCancel:D,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[v.map(T=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:oe(T.x),top:fe(T.y),width:Math.max(2,T.width*L),height:Math.max(2,T.height*L)}},T.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:oe(x.x),top:fe(x.y),width:x.width*L,height:x.height*L}})]})]})}function CV(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(fN)==="true"}catch{return!1}}function kV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fN,String(e))}catch{}}function EV(){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 TV(){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 AV({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 Pk=8,RV=120;function NV({anchor:e,accentKey:t,onSelect:i,onClose:n}){const[r,o]=b.useState(void 0);b.useLayoutEffect(()=>{const d=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+Pk,f=p+RV>window.innerHeight;o(f?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+Pk)}:{position:"fixed",left:d,top:Math.round(p)})},[e]),b.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),n())};return window.addEventListener("keydown",d),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]);const c=d=>{i(d),n()};return Pa.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:n,children:r?u.jsxs("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:d=>d.stopPropagation(),children:[u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":t===null,onClick:()=>c(null),children:[u.jsx("span",{}),"None"]}),Ep.map(d=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":d.label,"aria-pressed":t===d.key,onClick:()=>c(d.key),children:u.jsx("span",{style:{background:d.color}})},d.key))]}):null}),document.body)}const LV=["n","ne","e","se","s","sw","w","nw"],X_=320,Z_=200,MV=1500;function OV({operation:e,active:t,geometry:i,zoom:n,status:r,minimized:o=!1,maximized:c=!1,interactionDisabled:d=!1,accentKey:p=null,children:f,onActivate:g,onClose:v,onMinimize:y,onMaximize:S,onRename:w,onSetAccent:x,onGeometryChange:k,onGeometryCommit:R}){const O=b.useRef(null),I=b.useRef(null),A=b.useRef(null),$=b.useRef(null),L=b.useRef(null),H=b.useRef(!1),[U,oe]=b.useState(null),[fe,K]=b.useState(!1),z=e.title,N=g0({currentTitle:e.title,onBegin:()=>{j()},onCommit:ge=>{w(ge),H.current=!0}}),D=p?Hl(p):null,T=["canvas-operation",t?"is-active":"",o?"is-minimized":"",c?"is-maximized":"",jV(r)].filter(Boolean).join(" ");b.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current)},[]),b.useEffect(()=>{if(N.renaming||!H.current)return;H.current=!1;const ge=window.requestAnimationFrame(()=>I.current?.focus());return()=>window.cancelAnimationFrame(ge)},[N.renaming]);const E=()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},j=()=>{E(),K(!1)},P=()=>{E(),K(!0),L.current=window.setTimeout(()=>{L.current=null,K(!1)},MV)},V=ge=>{j(),!(c||d)&&ge.button===0&&(ge.preventDefault(),ge.stopPropagation(),g(),A.current={pointerId:ge.pointerId,startX:ge.clientX,startY:ge.clientY,geometry:i,latest:i},ge.currentTarget.setPointerCapture(ge.pointerId))},Q=ge=>{if(c||d)return;const Le=A.current;if(!Le||Le.pointerId!==ge.pointerId)return;ge.preventDefault(),ge.stopPropagation();const Gt={...Le.geometry,x:Le.geometry.x+(ge.clientX-Le.startX)/n,y:Le.geometry.y+(ge.clientY-Le.startY)/n};Le.latest=Gt,k(Gt)},B=ge=>{if(c||d){A.current=null;return}const Le=A.current;!Le||Le.pointerId!==ge.pointerId||(ge.preventDefault(),ge.stopPropagation(),A.current=null,ge.currentTarget.releasePointerCapture(ge.pointerId),R(Le.latest))},Z=(ge,Le)=>{c||d||(Le.preventDefault(),Le.stopPropagation(),g(),$.current={direction:ge,pointerId:Le.pointerId,startX:Le.clientX,startY:Le.clientY,geometry:i,latest:i},Le.currentTarget.setPointerCapture(Le.pointerId))},W=ge=>{if(c||d)return;const Le=$.current;if(!Le||Le.pointerId!==ge.pointerId)return;ge.preventDefault(),ge.stopPropagation();const Gt=DV(Le.geometry,Le.direction,(ge.clientX-Le.startX)/n,(ge.clientY-Le.startY)/n);Le.latest=Gt,k(Gt)},re=ge=>{if(c||d){$.current=null;return}const Le=$.current;!Le||Le.pointerId!==ge.pointerId||(ge.preventDefault(),ge.stopPropagation(),$.current=null,ge.currentTarget.releasePointerCapture(ge.pointerId),R(Le.latest))},ie=ge=>{ge.stopPropagation()},ve=ge=>{ge.stopPropagation(),j()},xe=ge=>{ge.stopPropagation(),g()},Te=ge=>{ge.stopPropagation()},Ie=()=>{j();const ge=typeof document<"u"?document.activeElement:null;ge instanceof HTMLElement&&O.current?.contains(ge)&&ge.blur(),y()},_t=()=>{j(),S?.()},qe=ge=>{j(),g(),oe(ge)},Re=ge=>{ge.stopPropagation(),j(),g()},Se=()=>{if(!fe){P();return}j(),v()},Ue=ge=>{ge.stopPropagation(),N.begin()},Ye=ge=>{ge.key!=="Enter"&&ge.key!=="F2"||(ge.preventDefault(),ge.stopPropagation(),N.begin())},pt=ge=>{ge.key==="Escape"&&(H.current=!0),N.handleKeyDown(ge)},nt={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...D?{"--user-accent":D}:{}};return u.jsxs("article",{ref:O,className:T,style:nt,onPointerDown:g,"data-canvas-operation":!0,"aria-label":`Operation ${z}`,inert:o?!0:void 0,children:[!c&&!d?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:V,onPointerMove:Q,onPointerUp:B,onPointerCancel:B,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:V,onPointerMove:Q,onPointerUp:B,onPointerCancel:B,"data-canvas-blocker":!0,children:[!t&&N.renaming?u.jsx("input",{ref:N.inputRef,className:"canvas-operation-identity-input",value:N.draftTitle,"aria-label":`Rename operation ${z}`,onChange:ge=>N.setDraftTitle(ge.target.value),onKeyDown:pt,onBlur:N.handleBlur,onPointerDown:ve}):t?null:u.jsx("button",{ref:I,type:"button",className:"canvas-operation-identity-name",onPointerDown:ve,onDoubleClick:Ue,onKeyDown:Ye,"aria-label":`Rename operation ${z}`,title:`${z} — Double-click, Enter, or F2 to rename`,children:z}),x?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:ie,onClick:ge=>qe(ge.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${z}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:zk(r),"aria-hidden":"true"})}):u.jsx("span",{className:zk(r),onPointerDown:Re,"aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:ie,onClick:Ie,"aria-label":`Minimize operation ${z}`,title:"Minimize operation",children:u.jsx(IV,{})}),S?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:ie,onClick:_t,"aria-label":c?`Restore operation ${z}`:`Maximize operation ${z}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(PV,{}):u.jsx(BV,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${fe?"is-armed-close":""}`,onPointerDown:ie,onClick:Se,"aria-label":fe?`Confirm close operation ${z}`:`Close operation ${z}`,title:fe?"Confirm close":"Close operation",children:fe?"Close?":u.jsx(zV,{})})]}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:xe,onWheel:Te,"data-canvas-blocker":!0,children:f}),!c&&!d&&LV.map(ge=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${ge}`,onPointerDown:Le=>Z(ge,Le),onPointerMove:W,onPointerUp:re,onPointerCancel:re,"data-canvas-blocker":!0,"aria-hidden":"true"},ge)),U&&x?u.jsx(NV,{anchor:U,accentKey:p,onSelect:x,onClose:()=>oe(null)}):null]})}function DV(e,t,i,n){let{x:r,y:o,width:c,height:d}=e;return t.includes("e")&&(c+=i),t.includes("s")&&(d+=n),t.includes("w")&&(r+=i,c-=i),t.includes("n")&&(o+=n,d-=n),c<X_&&(t.includes("w")&&(r-=X_-c),c=X_),d<Z_&&(t.includes("n")&&(o-=Z_-d),d=Z_),{...e,x:r,y:o,width:c,height:d}}function jV(e){const t=Np(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function zk(e){const t=Np(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 IV(){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 BV(){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 PV(){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 zV(){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 $V({rect:e,viewport:t}){const i=wV(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:i.x,top:i.y,width:i.width,height:i.height},"aria-hidden":"true"})}const HV=.25,FV=2,UV=200,WV=150,$k=5,GV=.0018;function qV({viewport:e,disabled:t=!1,consumePointerDown:i=!1,onViewportChange:n,onZoom:r,onCreate:o,onConsumePointerDown:c,onClick:d}){const p=b.useRef(null),f=b.useRef(e),[g,v]=b.useState(null),[y,S]=b.useState(!1),[w,x]=b.useState(!1);b.useEffect(()=>{f.current=e},[e]),b.useEffect(()=>{const L=U=>{U.key==="Shift"&&x(!0),!KV(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",L),window.addEventListener("keyup",H),()=>{window.removeEventListener("keydown",L),window.removeEventListener("keyup",H)}},[]);const k=L=>{if(t||Hk(L.target)||L.button!==0&&L.button!==1)return;if(L.preventDefault(),i){c?.();return}const H=Q_(L),U=L.shiftKey&&L.button===0&&!y?"create":"pan";p.current={pointerId:L.pointerId,mode:U,startScreen:H,currentScreen:H,startViewport:f.current},L.currentTarget.setPointerCapture(L.pointerId),U==="create"&&v(J_(H,H,f.current))},R=L=>{const H=p.current;if(!H||H.pointerId!==L.pointerId)return;L.preventDefault();const U=Q_(L);if(p.current={...H,currentScreen:U},H.mode==="pan"){n({...H.startViewport,x:H.startViewport.x+U.x-H.startScreen.x,y:H.startViewport.y+U.y-H.startScreen.y});return}v(J_(H.startScreen,U,f.current))},O=L=>{$(L,!0)},I=L=>{$(L,!1)},A=L=>{if(t||Hk(L.target))return;L.preventDefault();const H=Q_(L),U=f.current,oe=VV(U.zoom*Math.exp(-L.deltaY*GV),HV,FV),fe=nh(H,U);r({x:H.x-fe.x*oe,y:H.y-fe.y*oe,zoom:oe})},$=(L,H)=>{const U=p.current;if(!U||U.pointerId!==L.pointerId||(p.current=null,L.currentTarget.releasePointerCapture(L.pointerId),v(null),!H))return;const oe=Math.abs(U.currentScreen.x-U.startScreen.x),fe=Math.abs(U.currentScreen.y-U.startScreen.y);if(oe<$k&&fe<$k){d?.();return}if(U.mode!=="create")return;const K=J_(U.startScreen,U.currentScreen,f.current),z={x:K.x,y:K.y,width:Math.max(K.width,UV),height:Math.max(K.height,WV)};o(z,U.currentScreen)};return{rubberBand:g,spaceActive:y,shiftActive:w,onPointerDown:k,onPointerMove:R,onPointerUp:O,onPointerCancel:I,onWheel:A}}function J_(e,t,i){const n=nh(e,i),r=nh(t,i),o=Math.min(n.x,r.x),c=Math.min(n.y,r.y);return{x:o,y:c,width:Math.abs(n.x-r.x),height:Math.abs(n.y-r.y)}}function Q_(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function Hk(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function KV(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function VV(e,t,i){return Math.min(i,Math.max(t,e))}const YV="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",XV=560,ZV=360;function JV({state:e,catalog:t,canLaunch:i,renderKindIcon:n,onLaunchKind:r,onLaunchAtGeometry:o,onClose:c,onFocus:d,onRename:p,onSetAccent:f}){const g=b.useRef(null),v=wR(),y=CR(),S=Ap(),w=xR(),x=kR(),k=e.activeOperationId,[R,O]=b.useState(null),I=Jl(),[A,$]=b.useState({width:0,height:0}),L=!e.activeTheaterId||e.addingTheater;b.useEffect(()=>{const W=g.current;if(!W||typeof ResizeObserver>"u")return;const re=()=>$({width:W.clientWidth,height:W.clientHeight});re();const ie=new ResizeObserver(re);return ie.observe(W),()=>ie.disconnect()},[]);const H=qV({viewport:v.viewport,disabled:L||S,onViewportChange:Wy,onZoom:ER,onCreate:W=>{if(O(null),e.activeTheaterId&&i){const re=sY(t);if(!re)return;const ie={...tY(W),zIndex:To()};o(re.pluginId,re.kind,ie)}},consumePointerDown:R!==null,onConsumePointerDown:()=>{O(null)},onClick:eY}),U=(W,re)=>{const ie=R?.canvasPoint;O(null),ie&&r(W,re,ie)},oe=W=>{if(W.target instanceof Element&&W.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;W.preventDefault();const re=g.current?.getBoundingClientRect();if(!re)return;const ie={x:W.clientX-re.left,y:W.clientY-re.top};O({anchor:ie,canvasPoint:nh(ie,v.viewport)})},fe=new Set(x);b.useEffect(()=>{e.activeOperationId&&fe.has(e.activeOperationId)&&$n(null)},[x,e.activeOperationId]);const K=Object.fromEntries(Object.entries(v.operations).filter(([W])=>!fe.has(W))),z=(e.operations??[]).filter(W=>W.theaterId===e.activeTheaterId),N=z,D=z.length>0,T=I.operationKinds,j=w!==null&&z.some(W=>W.id===w&&!fe.has(W.id))?w:null,P=HE(z,e.groups.filter(W=>W.theaterId===e.activeTheaterId),v.operationOrder,[]).filter(W=>!fe.has(W.id)).map(W=>W.id),V=S?vG({x:0,y:0,width:A.width,height:A.height},P.length,void 0,void 0,void 0,void 0,y):[],Q=new Map(P.map((W,re)=>[W,V[re]])),B=j||S?1:v.viewport.zoom,Z=nY(v.operations)+1;return u.jsxs("main",{className:`operations-canvas ${H.spaceActive?"is-panning":""} ${H.shiftActive?"is-creating":""} ${j?"is-panel-maximized":""} ${S?"is-formation-view":""}`,onPointerDown:H.onPointerDown,onPointerMove:H.onPointerMove,onPointerUp:H.onPointerUp,onPointerCancel:H.onPointerCancel,onWheel:H.onWheel,onContextMenu:oe,ref:g,children:[u.jsx(AV,{viewport:v.viewport}),u.jsx("div",{style:{transform:j||S?"none":`translate(${Math.round(v.viewport.x)}px, ${Math.round(v.viewport.y)}px) scale(${v.viewport.zoom})`},className:"operations-canvas-world",children:N.map(W=>{const re=v.operations[W.id]??W.geometry??ev(W),ie=j===W.id,ve=Q.get(W.id),xe=ie?iY(A,Z):ve?{...re,...ve}:re;return aY(W,{active:k===W.id,geometry:xe,operationKindRegistry:T,status:e.operationStatus[W.id],theme:e.activeTheme,viewportZoom:B,minimized:fe.has(W.id),maximized:ie,formation:S,accentKey:v.operationAccent[W.id]??rY(W),onActivate:()=>{$n(W.id),!ie&&!S&&Gy(W.id,v.operations[W.id]??W.geometry??ev(W))},onClose:()=>{e.activeOperationId===W.id&&$n(null),j===W.id&&Wr(),c(W.id)},onMinimize:()=>{e.activeOperationId===W.id&&$n(null),TR(W.id)},onMaximize:()=>{ie?Wr():($n(W.id),Bu(W.id))},onRename:Te=>{p(W.id,Te)},onSetAccent:Te=>{f(W.id,Te)},onGeometryChange:Te=>{!ie&&!S&&Gy(W.id,Te)},onGeometryCommit:Te=>{!ie&&!S&&lY(W.id,Fl().operations[W.id]??Te)}})})}),D?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?YV:"Add a Theater from the top bar to start operations."})]}),H.rubberBand?u.jsx($V,{rect:H.rubberBand,viewport:v.viewport}):null,R?u.jsx(vR,{anchor:R.anchor,viewportBounds:QV(g.current),placement:"cursor",catalog:t,canLaunch:i&&!S,renderKindIcon:n,onLaunchKind:U,onClose:()=>O(null)},`${R.anchor.x}:${R.anchor.y}`):null,u.jsx(xV,{operations:K,pluginOperations:Object.fromEntries(z.filter(W=>!fe.has(W.id)).map(W=>[W.id,{theaterId:W.theaterId,geometry:v.operations[W.id]??W.geometry??ev(W)}])),viewport:v.viewport,canvasSize:A,onJump:W=>Wy({x:A.width/2-W.x*v.viewport.zoom,y:A.height/2-W.y*v.viewport.zoom,zoom:v.viewport.zoom})})]})}function QV(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function eY(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}$n(null)}function tY(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function ev(e){return e.geometry??{x:0,y:0,width:XV,height:ZV,zIndex:0}}function iY(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function nY(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function sY(e){const t=e.flatMap(i=>i.kinds.filter(n=>n.disabled!==!0).map(n=>({pluginId:i.id,kind:n})));return t.find(({kind:i})=>i.type==="shell")??t[0]??null}function rY(e){return typeof e.accent=="string"?e.accent:null}function aY(e,t){const i=t.operationKindRegistry.find(o=>o.pluginId===e.pluginId&&o.type===e.type),n=t.geometry;if(!i?.render)return null;const r=Mp(()=>{Hn(null).then(os).catch(()=>{})});return u.jsx(OV,{operation:e,active:t.active,geometry:n,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,interactionDisabled:t.formation,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,children:u.jsx(ub,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(oY,{active:t.active,capabilities:r,descriptor:i,geometry:n,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function oY({active:e,capabilities:t,descriptor:i,geometry:n,operation:r,theme:o,viewportZoom:c,onActivate:d,onClose:p,onGeometryChange:f}){return i.render?i.render({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:n,active:e,zoom:c,theme:o,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:d,onClose:p,onGeometryChange:f}):null}async function lY(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function pN(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(i=>i.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function mN(e,t){const i=new Set(t.map(n=>n.id));return e.filter(n=>i.has(n.operationId))}function gN(e,t){const i=[],n=[];for(const r of e)t.has(r.operationId)?n.push(r):i.push(r);return{hidden:i,visible:n}}function tb(e){const t=new Map;for(const i of[...e].sort((n,r)=>r.lastRaisedSeq-n.lastRaisedSeq)){const n=i.theaterId??"__unknown__",r=t.get(n)??{theaterId:i.theaterId,theaterLabel:i.theaterLabel,notifications:[]};r.notifications.push(i),t.set(n,r)}return[...t.values()].sort((i,n)=>{const r=i.notifications[0]?.lastRaisedSeq??0;return(n.notifications[0]?.lastRaisedSeq??0)-r})}function _N(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const cY={ended:"Ended","input-waiting":"Waiting for input"},uY={id:"alerts",title:"Alerts",icon:()=>u.jsx(dY,{}),render:()=>u.jsx(hY,{})};function hY(){const e=Gs(),t=oh(),[i,n]=b.useState(!1),r=b.useMemo(()=>mN(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=pN(e),c=gN(r,o).hidden,d=_N(c,e.notificationPreferences),p=tb(d),f=tb(c),g=ib(p,"input-waiting"),v=ib(p,"ended"),y=p.length===0,S=b.useCallback(w=>{Uu(w.operationId),t("/operations")},[t]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[g>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:g}):null,v>0?u.jsx("span",{className:"notification-tally is-ended",children:v}):null,y?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${i?" is-active":""}`,onClick:()=>n(w=>!w),"aria-expanded":i,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(gY,{})})]}),i?u.jsx(fY,{groups:f}):null,y?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:cY[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 dY(){const e=Gs();a5();const t=b.useMemo(()=>mN(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),i=pN(e),n=gN(t,i).hidden,r=_N(n,e.notificationPreferences),o=tb(r),c=o.reduce((f,g)=>f+g.notifications.length,0),d=ib(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(mY,{}),c>0?u.jsx("span",{className:"alerts-icon-badge",children:c}):null]})}function fY({groups:e}){const t=Gs(),i=pY(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:n=>sO(n.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:n=>rO(n.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),i.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,i.map(n=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:n.theaterId?t.notificationPreferences.mutedTheaterIds[n.theaterId]===!0:!1,onChange:()=>{n.theaterId&&aO(n.theaterId)}}),u.jsx("span",{children:n.theaterLabel})]},n.theaterId))]})}function pY(e,t,i){const n=new Map;for(const r of e)r.theaterId&&n.set(r.theaterId,r);for(const r of Object.keys(t))n.has(r)||n.set(r,{theaterId:r,theaterLabel:i.find(o=>o.id===r)?.label??r,notifications:[]});return[...n.values()]}function ib(e,t){let i=0;for(const n of e)for(const r of n.notifications)r.kind===t&&(i+=1);return i}function mY(){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 gY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}async function _Y(e,t){const n=new URLSearchParams().toString();return Ql(No(e,`/search${n?`?${n}`:""}`))}async function vY(e,t,i){return Ql(No(e,`/entry/${encodeURIComponent(t)}`))}async function vN(e,t="pending"){return Ql(No(e,`/drydock?status=${encodeURIComponent(t)}`))}async function yY(e,t){return Ql(No(e,`/drydock/${encodeURIComponent(t)}`))}async function bY(e,t,i,n){const r={action:i};return n!==void 0&&(r.reason=n),xY(No(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function SY(e){return Ql(No(e,"/conflicts"))}async function wY(e,t){return Ql(No(e,`/conflicts/${encodeURIComponent(t)}`))}function No(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function Ql(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await yN(e,t));return t.json()}async function xY(e,t){const i=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(await yN(e,i));return i.json()}async function yN(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const nb=new Set,op={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function Ru(){return op}function bN(e){return nb.add(e),()=>nb.delete(e)}function Fk(e){Cf({currentWorkspaceId:e})}async function lp(){Cf({loading:!0,error:null});try{const e=op.currentWorkspaceId,[t,i]=await Promise.all([_Y(e),vN(e,"pending").catch(()=>null)]);Cf({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){Cf({loading:!1,error:CY(e)})}}function Cf(e){Object.assign(op,e);for(const t of nb)t(op)}function CY(e){return e instanceof Error?e.message:String(e)}const kY=120;function zs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function EY(e,t){if(!t)return zs(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?zs(e):zs(e.slice(0,i))+`<mark>${zs(e.slice(i,i+t.length))}</mark>`+zs(e.slice(i+t.length))}function TY(e){return`<span class="codex-nav-tag">${zs(e)}</span>`}function AY(e,t,i){const n=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(TY).join(""),o=zs(e.status??"current"),c=zs(e.updated??"");return`<button
|
|
230
|
+
class="codex-nav-entry${i?" is-current":""}"
|
|
231
|
+
data-entry-id="${zs(e.id)}"
|
|
232
|
+
type="button"
|
|
233
|
+
${i?'aria-current="page"':""}
|
|
234
|
+
title="${zs(e.title)}"
|
|
235
|
+
>
|
|
236
|
+
<span class="t">${EY(e.title,n?"":t)}</span>
|
|
237
|
+
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
+
<span class="meta">${o} · ${c}</span>
|
|
239
|
+
</button>`}function RY(e,t){if(!t)return e;const i=t.toLowerCase();return e.filter(n=>n.title.toLowerCase().includes(i)||n.tags.some(r=>r.toLowerCase().includes(i)))}function NY(e,t){let i="",n=null,r=null;e.innerHTML=`
|
|
240
|
+
<div class="codex-navigator">
|
|
241
|
+
<div class="codex-nav-search">
|
|
242
|
+
<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>
|
|
243
|
+
<input
|
|
244
|
+
class="codex-nav-search-input"
|
|
245
|
+
type="search"
|
|
246
|
+
placeholder="Search entries"
|
|
247
|
+
autocomplete="off"
|
|
248
|
+
spellcheck="false"
|
|
249
|
+
aria-label="Search Codex entries"
|
|
250
|
+
/>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="codex-nav-quick-row">
|
|
253
|
+
<button class="codex-nav-quick" data-action="drydock" type="button">
|
|
254
|
+
Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
|
|
255
|
+
</button>
|
|
256
|
+
<button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
|
|
257
|
+
</div>
|
|
258
|
+
<div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
|
|
259
|
+
<div class="codex-navigator-scroll">
|
|
260
|
+
<div class="codex-nav-list" id="codex-nav-list"></div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
`;const o=e.querySelector(".codex-nav-search-input"),c=e.querySelector("#codex-nav-list"),d=e.querySelector("#codex-nav-eyebrow"),p=e.querySelector("#codex-nav-drydock-badge");function f(S){const w=RY(S.index,i);if(d.textContent=`Entries · ${w.length}`,p.textContent=String(S.pendingPatchCount),p.hidden=S.pendingPatchCount===0,S.loading&&S.index.length===0){c.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(S.error){c.innerHTML=`<div class="codex-nav-error" role="alert">${zs(S.error)}</div>`;return}if(w.length===0){c.innerHTML=`<div class="codex-nav-empty">${i?"No entries match.":"No entries."}</div>`;return}c.innerHTML=w.map(x=>AY(x,i,x.id===n)).join("")}function g(S){const w=S.target;if(!(w instanceof Element))return;const x=w.closest("[data-entry-id]");if(x?.dataset.entryId){n=x.dataset.entryId,f(Ru()),t.onRequest({kind:"entry",id:n});return}const k=w.closest("[data-action]");if(k?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(k?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function v(){r!==null&&clearTimeout(r),r=setTimeout(()=>{i=o.value,f(Ru())},kY)}e.addEventListener("click",g),o.addEventListener("input",v);const y=bN(S=>f(S));return f(Ru()),{destroy(){y(),e.removeEventListener("click",g),o.removeEventListener("input",v),r!==null&&clearTimeout(r),e.innerHTML=""},setTheater(S){i="",n=null,o&&(o.value=""),f(Ru())}}}function LY(e,t){t.initialTheaterId&&Fk(t.initialTheaterId);const i=NY(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),n=bN(()=>{});lp();const r=i.destroy.bind(i);return{destroy(){n(),r()},setTheater(o){Fk(o),lp(),i.setTheater(o)}}}function Ht(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Gl(e){return Ht(e).replace(/"/g,""")}function MY(e){const t=e.tags.map(n=>`<span class="chip chip-tag">${Ht(n)}</span>`).join(""),i=DY(e);return`
|
|
264
|
+
<div class="meta-chips">
|
|
265
|
+
${t}
|
|
266
|
+
${i}
|
|
267
|
+
<span class="chip">Updated ${Ht(OY(e.updated))}</span>
|
|
268
|
+
</div>
|
|
269
|
+
`}function SN(e){return e.map(t=>`<span class="chip chip-muted">${Ht(t)}</span>`).join("")}function OY(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function DY(e){const t=jY(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Gl(t.title)}">${Ht(t.label)}</span>`:""}function jY(e,t=new Date){const i=e.status,n=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return i==="deprecated"||i==="superseded"?{label:i,tone:"deprecated",title:n?`${i} · stale`:i}:n?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:i==="current"||i==="draft"?{label:i,tone:"neutral",title:i}:null}const IY="active";function Uk(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Gl(t.id)}" data-toc-id="${Gl(t.id)}">${Ht(t.text)}</a>`).join("")}function Wk(e,t,i){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const n=[...i.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(n.length===0||o.length===0)return()=>{};const c=e.closest(".codex-reading-sheet-read"),d=new Set,p=new IntersectionObserver(f=>{for(const v of f){const y=v.target instanceof HTMLElement?v.target.id:"";y&&(v.isIntersecting?d.add(y):d.delete(y))}const g=BY(o,d)??PY(o,c)??o[0]?.id??null;Gk(n,g)},{root:c,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return Gk(n,o[0]?.id??null),()=>p.disconnect()}function BY(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function PY(e,t){const i=t?t.getBoundingClientRect().top:0;let n=null;for(const r of e)if(r.getBoundingClientRect().top-i<=80)n=r.id;else break;return n}function Gk(e,t){for(const i of e){const n=!!(t&&i.dataset.tocId===t);i.classList.toggle(IY,n),n?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function qk(e){return`/entry/${encodeURIComponent(e)}`}const wN={create_wiki:"+",update_wiki:"↻"},xN={create_wiki:"Create",update_wiki:"Update"};function zY(e,t){let i=!1,n=null,r=t,o="idle",c=null,d=null,p=null;i0(e);function f(R){const O=R.target;if(!(O instanceof Element))return;const I=O.closest("[data-patch-id]");if(I){R.preventDefault();const L=I.dataset.patchId||void 0;r.onPatchOpen?.(L);return}const A=O.closest("[data-entry-id]");if(A?.dataset.entryId){R.preventDefault(),r.onRelatedClick(A.dataset.entryId);return}const $=O.closest("[data-drydock-action]");if($){R.preventDefault(),g($.dataset.drydockAction);return}}function g(R){if(R){if(R==="back"){r.onPatchOpen?.(void 0);return}if(R==="approve"){o="approving",c=null,y();return}if(R==="approve-confirm"){v("approve",void 0);return}if(R==="reject"){o="rejecting",c=null,y();return}if(R==="reject-submit"){const O=e.querySelector("#queue-reject-reason")?.value.trim();if(!O){c="Rejection reason is required.",y();return}v("reject",O);return}if(R==="cancel"){o="idle",c=null,y();return}}}async function v(R,O){if(p){o="submitting",c=null,y();try{await bY(r.theaterId,p,R,O),r.onDecided?.()}catch(I){o=R==="approve"?"approving":"rejecting",c=I instanceof Error?I.message:String(I),y()}}}function y(){const R=e.querySelector("[data-decision-bar-wrap]");R&&(R.innerHTML=CN(o,c))}e.addEventListener("click",f);function S(){n?.(),n=null}async function w(R){if(!i){tv(e,t.tocContainer),S();try{const O=await vY(r.theaterId,R);if(i)return;const{index:I}=Ru(),{html:A,toc:$}=Qu(O.body,{omitDuplicateTitle:O.frontmatter.title,resolveWikiLink:H=>qk(H)});e.innerHTML=`
|
|
270
|
+
<article class="document">
|
|
271
|
+
<header class="document-header">
|
|
272
|
+
${$Y(O.frontmatter.title)}
|
|
273
|
+
<h1>${Ht(O.frontmatter.title)}</h1>
|
|
274
|
+
${MY(O.frontmatter)}
|
|
275
|
+
</header>
|
|
276
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
277
|
+
${A}
|
|
278
|
+
</div>
|
|
279
|
+
${HY(O.frontmatter.id,O.frontmatter.tags,I)}
|
|
280
|
+
</article>
|
|
281
|
+
`,t.tocContainer.innerHTML=Uk($);const L=e.querySelector("article");L&&$.length>0&&(n=Wk(L,$,t.tocContainer))}catch(O){i||iv(e,t.tocContainer,O)}}}async function x(R){if(!i){tv(e,t.tocContainer),S(),d=null,p=null,o="idle",c=null;try{if(R){const O=await yY(r.theaterId,R);if(i)return;d=O.meta,p=R;const{html:I,toc:A}=Qu(O.wikiEntry.body,{omitDuplicateTitle:O.wikiEntry.title,resolveWikiLink:L=>qk(L)});e.innerHTML=WY(O,I),t.tocContainer.innerHTML=Uk(A);const $=e.querySelector("article");$&&A.length>0&&(n=Wk($,A,t.tocContainer))}else{const O=await vN(r.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=FY(O.items,"Review queue — Pending patches")}}catch(O){i||iv(e,t.tocContainer,O)}}}async function k(R){if(!i){tv(e,t.tocContainer),S();try{if(R){const O=await wY(r.theaterId,R);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=KY(O)}else{const O=await SY(r.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=VY(O)}}catch(O){i||iv(e,t.tocContainer,O)}}}return t.kind==="entry"&&t.initialEntryId?w(t.initialEntryId):t.kind==="drydock"?x(t.subId):t.kind==="conflicts"&&k(t.subId),{destroy(){i=!0,e.removeEventListener("click",f),S()},async setEntry(R){await w(R)},async navigateSub(R){t.kind==="drydock"?await x(R):t.kind==="conflicts"&&await k(R)},refreshCallbacks(R){r={...r,...R}}}}function tv(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function iv(e,t,i){const n=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${Ht(n)}</div>`,t.innerHTML=""}function $Y(e){return`
|
|
282
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
283
|
+
<ol>
|
|
284
|
+
<li><span>Codex</span></li>
|
|
285
|
+
<li><span aria-current="page">${Ht(e)}</span></li>
|
|
286
|
+
</ol>
|
|
287
|
+
</nav>
|
|
288
|
+
`}function HY(e,t,i){const n=new Set(t),r=i.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(c=>n.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?"":`
|
|
289
|
+
<section class="related-list">
|
|
290
|
+
<h2>Related entries</h2>
|
|
291
|
+
<div class="related-items">
|
|
292
|
+
${r.map(o=>`<button class="related-card" type="button" data-entry-id="${Gl(o.entry.id)}">
|
|
293
|
+
<strong>${Ht(o.entry.title)}</strong>
|
|
294
|
+
<span>${SN(o.matchingTags)}</span>
|
|
295
|
+
</button>`).join("")}
|
|
296
|
+
</div>
|
|
297
|
+
</section>
|
|
298
|
+
`}function FY(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
299
|
+
<article class="document">
|
|
300
|
+
<header class="document-header">
|
|
301
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
302
|
+
<ol>
|
|
303
|
+
<li><span>Codex</span></li>
|
|
304
|
+
<li><span aria-current="page">Review queue</span></li>
|
|
305
|
+
</ol>
|
|
306
|
+
</nav>
|
|
307
|
+
<h1>${Ht(t)}</h1>
|
|
308
|
+
</header>
|
|
309
|
+
<div class="queue-row-list">
|
|
310
|
+
${e.map(UY).join("")}
|
|
311
|
+
</div>
|
|
312
|
+
</article>
|
|
313
|
+
`}function UY(e){const t=e.op??"create_wiki",i=wN[t]??"?",n=xN[t]??"Patch",r=e.target??e.id,c=[YY(e.meta.createdAt)].filter(Boolean);return`
|
|
314
|
+
<button class="queue-row" type="button" data-patch-id="${Gl(e.id)}" aria-label="${Gl(n+": "+r)}">
|
|
315
|
+
<span class="queue-row-badge" aria-hidden="true">
|
|
316
|
+
<span class="op-badge">${i}</span>
|
|
317
|
+
</span>
|
|
318
|
+
<span class="queue-row-body">
|
|
319
|
+
<span class="queue-row-target">${Ht(r)}</span>
|
|
320
|
+
${e.summary?`<span class="queue-row-summary">${Ht(e.summary)}</span>`:""}
|
|
321
|
+
${c.length>0?`<span class="queue-row-meta">${c.map(Ht).join(" · ")}</span>`:""}
|
|
322
|
+
</span>
|
|
323
|
+
</button>
|
|
324
|
+
`}function WY(e,t){const{patch:i,meta:n,wikiEntry:r,targetExists:o}=e,c=i.frontmatter.op,d=wN[c]??"?",p=xN[c]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",g=n.status==="pending";return`
|
|
325
|
+
<article class="document">
|
|
326
|
+
<header class="document-header">
|
|
327
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
328
|
+
<ol>
|
|
329
|
+
<li><span>Codex</span></li>
|
|
330
|
+
<li><span>Review queue</span></li>
|
|
331
|
+
<li><span aria-current="page">${Ht(p)}</span></li>
|
|
332
|
+
</ol>
|
|
333
|
+
</nav>
|
|
334
|
+
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
335
|
+
<h1><span class="op-badge">${d}</span> ${Ht(r.title)}</h1>
|
|
336
|
+
<p class="eyebrow">${Ht(i.frontmatter.target)} · v${r.version} · ${Ht(f)}</p>
|
|
337
|
+
${GY(i.frontmatter.proposer,r.tags)}
|
|
338
|
+
</header>
|
|
339
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
340
|
+
${t}
|
|
341
|
+
</div>
|
|
342
|
+
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
343
|
+
${g?CN("idle",null):qY(n)}
|
|
344
|
+
</div>
|
|
345
|
+
</article>
|
|
346
|
+
`}function GY(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${Ht(e)}</span>`),t.length>0&&i.push(SN(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function CN(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
347
|
+
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
348
|
+
<div class="queue-action-buttons">
|
|
349
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
350
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
351
|
+
</div>
|
|
352
|
+
${t?`<p class="queue-action-error">${Ht(t)}</p>`:""}
|
|
353
|
+
`:e==="rejecting"?`
|
|
354
|
+
<div class="queue-reject-form">
|
|
355
|
+
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
356
|
+
<div class="queue-action-buttons">
|
|
357
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
358
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
359
|
+
</div>
|
|
360
|
+
${t?`<p class="queue-action-error">${Ht(t)}</p>`:""}
|
|
361
|
+
</div>
|
|
362
|
+
`:`
|
|
363
|
+
<div class="queue-action-buttons">
|
|
364
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
365
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
366
|
+
</div>
|
|
367
|
+
`}function qY(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",n=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${Ht(e.reason)}`:"";return`<p class="queue-decision-decided ${n}">${i}${r}</p>`}function KY(e){return`
|
|
368
|
+
<article class="document">
|
|
369
|
+
<header class="document-header">
|
|
370
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
371
|
+
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
372
|
+
</nav>
|
|
373
|
+
<h1>${Ht(e.id)}</h1>
|
|
374
|
+
<p class="eyebrow">Conflict · ${Ht(e.meta?.status??"open")}</p>
|
|
375
|
+
</header>
|
|
376
|
+
<div class="markdown-body">
|
|
377
|
+
${e.current?`<h2>Current</h2><pre><code>${Ht(e.current)}</code></pre>`:""}
|
|
378
|
+
${e.proposed?`<h2>Proposed</h2><pre><code>${Ht(e.proposed)}</code></pre>`:""}
|
|
379
|
+
</div>
|
|
380
|
+
</article>
|
|
381
|
+
`}function VY(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
382
|
+
<article class="document">
|
|
383
|
+
<header class="document-header">
|
|
384
|
+
<h1>Conflicts</h1>
|
|
385
|
+
</header>
|
|
386
|
+
<div class="markdown-body">
|
|
387
|
+
<ul class="queue-list">
|
|
388
|
+
${e.map(t=>`<li class="queue-item">
|
|
389
|
+
<strong>${Ht(t.title||t.id)}</strong>
|
|
390
|
+
<span class="eyebrow">${Ht(t.status)}</span>
|
|
391
|
+
</li>`).join("")}
|
|
392
|
+
</ul>
|
|
393
|
+
</div>
|
|
394
|
+
</article>
|
|
395
|
+
`}function YY(e){try{const i=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(i<1)return"< 1h ago";if(i<24)return`${Math.floor(i)}h ago`;const n=i/24;return n<7?`${Math.floor(n)}d ago`:n<30?`${Math.floor(n/7)}w ago`:`${Math.floor(n/30)}mo ago`}catch{return""}}let po=null,sh=null,kN=null,Oa=null,mo=null,Na=null,kf=null,nv=null,Ef,sb=0;function Kk(e){kN=e}function XY(e,t){const i=QY();i.parentElement!==e&&e.appendChild(i),sh||(sh=LY(i,{initialTheaterId:t,onRequest:n=>kN?.(n)}))}function ZY(e){sh?.setTheater(e)}function EN(e,t,i){const n=eX(),r=tX(),o=n.parentElement,c=i.kind==="entry"&&kf==="entry"&&i.initialEntryId===nv;o&&o!==e&&(sb=o.scrollTop),n.parentElement!==e&&e.appendChild(n),r.parentElement!==t&&t.appendChild(r),!Na||kf!==i.kind?(Na?.destroy(),Na=zY(n,{...i,tocContainer:r}),kf=i.kind,Ef=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==nv?Na.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==Ef&&(Ef=i.subId,Na.navigateSub(i.subId)),nv=i.kind==="entry"?i.initialEntryId??null:null,Na.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const d=c?sb:0;requestAnimationFrame(()=>{e.scrollTop=d})}function JY(){const e=Oa?.parentElement;e&&(sb=e.scrollTop)}function TN(){Na?.destroy(),Na=null,kf=null,Ef=void 0,Oa?.parentElement&&Oa.parentElement.removeChild(Oa),mo?.parentElement&&mo.parentElement.removeChild(mo)}function Vk(){TN(),sh?.destroy(),sh=null,po?.parentElement&&po.parentElement.removeChild(po)}function QY(){return po||(po=document.createElement("div"),po.className="codex-host"),po}function eX(){return Oa||(Oa=document.createElement("div"),Oa.className="codex-reader-host"),Oa}function tX(){return mo||(mo=document.createElement("div"),mo.className="codex-toc-host"),mo}const iX={id:"codex",title:"Codex",icon:()=>u.jsx(oX,{}),pathAware:!0,render:e=>u.jsx(nX,{theaterId:e.theaterId,pathContext:e.pathContext})};function nX({theaterId:e,pathContext:t}){const i=Gs(),n=b.useRef(null),r=b.useRef(null),o=b.useRef(null),c=b.useRef(""),[d,p]=b.useState(null),f=i.codexReader,g=f!==null,v=i.codexReaderExpanded,y=i.theaters.find(O=>O.id===i.activeTheaterId)??null,S=i.theaters.length>0,w=`${e??""}\0${t.relPath??""}`,x=d?.contextKey===w&&d.hasWiki?d.id:null,k=x!==null,R=f?`${f.kind}:${f.kind==="entry"?f.entryId:f.kind==="drydock"?f.patchId??"":f.id??""}`:null;return b.useEffect(()=>{if(c.current=w,Kg(),!e){p({contextKey:w,hasWiki:!1,id:null});return}rX(e,t.relPath).then(O=>{c.current===w&&p({contextKey:w,...O})}).catch(()=>{c.current===w&&p({contextKey:w,hasWiki:!1,id:null})})},[w,t.relPath,e]),b.useEffect(()=>{d?.contextKey===w&&!d.hasWiki&&Vk()},[w,d]),b.useEffect(()=>()=>Vk(),[]),b.useEffect(()=>{if(!k||!x)return;const O=n.current;if(O)return XY(O,x),Kk(I=>{I.kind==="entry"?zr({kind:"entry",entryId:I.id}):I.kind==="drydock"?zr({kind:"drydock",patchId:I.patchId}):I.kind==="conflicts"&&zr({kind:"conflicts",id:I.id})}),()=>{Kk(null)}},[k,x,g]),b.useEffect(()=>{k&&x&&ZY(x)},[k,x]),b.useEffect(()=>{if(!k||!x||!g||v||!r.current||!o.current||!f)return;const O=f.kind,I=O==="drydock"?f.patchId:O==="conflicts"?f.id:void 0;EN(r.current,o.current,{initialEntryId:O==="entry"?f.entryId:"",kind:O,subId:I,theaterId:x,onRelatedClick:A=>zr({kind:"entry",entryId:A}),onClose:()=>Kg(),onPatchOpen:A=>zr({kind:"drydock",patchId:A}),onDecided:()=>{lp(),zr({kind:"drydock",patchId:void 0})}})},[k,x,g,v,R]),b.useEffect(()=>{g||TN()},[g]),k?g?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:lf,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:Kg,children:"✕"})]}),u.jsx("div",{ref:r,className:"codex-doc-scroll"}),u.jsx("div",{ref:o,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(sX,{activeTheater:y,contextLabel:t.label,hasTheaters:S})}function sX({activeTheater:e,contextLabel:t,hasTheaters:i}){return i?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:t||e?.label||"This context"}),u.jsx("p",{children:"This selected context does not have Fleet Wiki data mounted."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function rX(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t})});if(!i.ok)throw new Error("codex_workspace_unavailable");return aX(await i.json())}function aX(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 oX(){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 AN(e,t=Date.now()){const i=Date.parse(e);if(!Number.isFinite(i))return"Unknown";const n=Math.max(0,Math.floor((t-i)/1e3));if(n<60)return"just now";const r=Math.floor(n/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 lX(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 cX(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function uX(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function hX(e,t,i){return i.tasksTotal<=0?"none":i.tasksDone>=i.tasksTotal?"complete":e.slice(0,t).every(uX)?"ready":"blocked"}const dX=360,fX={id:"plans",title:"Plans",icon:yX,pathAware:!0,render:e=>u.jsx(pX,{...e})};function pX(e){const t=JSON.stringify([e.theaterId,e.pathContext.relPath]);return u.jsx(mX,{...e},t)}function mX(e){const{pathContext:t,requestExtraWidth:i,theaterId:n}=e,r=t.relPath,[o,c]=b.useState({kind:"no-theater"}),[d,p]=b.useState({kind:"loading"}),[f,g]=b.useState(null),[v,y]=b.useState(0),[S,w]=b.useState(0),x=f?.theaterId===n&&f.relPath===r?f.name:null;b.useEffect(()=>{let A=!1;return g(null),p({kind:"loading"}),n?(c({kind:"loading"}),r4(n,r).then($=>{A||c({kind:"ready",plans:$.plans})}).catch(()=>{A||c({kind:"error"})}),()=>{A=!0}):(c({kind:"no-theater"}),()=>{A=!0})},[r,n,v]),b.useEffect(()=>{let A=!1;return!n||!x?()=>{A=!0}:(p({kind:"loading"}),a4(n,r,x).then($=>{A||p({kind:"ready",plan:$})}).catch(()=>{A||p({kind:"error"})}),()=>{A=!0})},[S,r,x,n]),b.useLayoutEffect(()=>(i?.(x?dX:null),()=>i?.(null)),[i,x]);const k=b.useCallback(A=>{n&&g({theaterId:n,relPath:r,name:A})},[r,n]),R=b.useCallback(()=>g(null),[]),O=b.useCallback(()=>y(A=>A+1),[]),I=b.useCallback(()=>w(A=>A+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${x?" is-reader-open":""}`,children:[x&&u.jsx(_X,{state:d,onClose:R,onRetry:I}),x&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(gX,{selectedName:x,state:o,onRetry:O,onSelect:k})]})})}function gX({selectedName:e,state:t,onRetry:i,onSelect:n}){return t.kind==="no-theater"?u.jsx("div",{className:"plans-list-pane",children:u.jsx(Yk,{children:"Select a Theater to browse plans."})}):t.kind==="loading"?u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-loading",children:"Loading plans…"})}):t.kind==="error"?u.jsx("div",{className:"plans-list-pane",children:u.jsx(RN,{message:"Unable to load plans.",onRetry:i})}):t.plans.length===0?u.jsx("div",{className:"plans-list-pane",children:u.jsx(Yk,{detail:"Execution plans in .fleet/plans/ appear here.",children:"No plans yet."})}):u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-list","aria-label":"Plans",children:t.plans.map(r=>{const o=lX(r.tasksDone,r.tasksTotal),c=o===100;return u.jsxs("button",{type:"button",className:`plans-row${e===r.name?" is-selected":""}`,onClick:()=>n(r.name),children:[u.jsx("span",{className:"plans-row-name",children:r.name}),u.jsxs("span",{className:"plans-row-meta",children:[r.waveCount," waves · ",r.tasksDone,"/",r.tasksTotal," tasks · ",AN(r.updatedAt),r.executionMode==="parallel"?" · parallel":""]}),o!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":`${o}% complete`,children:u.jsx("span",{className:`plans-progress-fill${c?" is-complete":""}`,style:{width:`${o}%`}})})]},r.name)})})})}function _X({state:e,onClose:t,onRetry:i}){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(rb,{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(rb,{onClose:t})]}),u.jsx(RN,{message:"Unable to load plan.",onRetry:i})]}):u.jsx(vX,{plan:e.plan,onClose:t})}function vX({plan:e,onClose:t}){const i=b.useMemo(()=>{const o=new DOMParser().parseFromString(Qu(e.content).html,"text/html");return sv(o.body),o.body.innerHTML},[e.content]),n=b.useRef(null),r=b.useCallback(o=>{const c=o.target.closest('[data-action="copy-code"]');if(!c)return;const d=c.closest("pre")?.getAttribute("data-code");if(!d)return;navigator.clipboard?.writeText(d);const p=c.textContent;c.textContent="Copied",window.setTimeout(()=>{c.textContent=p},1200)},[]);return b.useEffect(()=>{const o=n.current;if(!o)return;i0(o),sv(o);const c=new MutationObserver(()=>sv(o));return c.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>c.disconnect()},[i]),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 ",AN(e.updatedAt)]})]}),u.jsx(rb,{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((o,c)=>{const d=cX(o.tasksDone,o.tasksTotal);return u.jsxs("span",{className:`plans-wave is-${d}`,children:[u.jsx("span",{className:"plans-wave-heading",children:o.heading}),o.tasksTotal>0&&u.jsxs("span",{className:"plans-wave-count",children:[o.tasksDone,"/",o.tasksTotal]}),o.lanes.length>0&&u.jsx("span",{className:"plans-lane-list",children:o.lanes.map((p,f)=>{const g=hX(e.waves,c,p);return u.jsxs("span",{className:`plans-lane is-${g}`,children:[u.jsx("span",{className:"plans-lane-id",children:p.id??p.heading}),p.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[p.tasksDone,"/",p.tasksTotal]}),g==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:"READY"})]},p.id??`${o.index}-${f}`)})})]},o.index)})}),u.jsx("div",{ref:n,className:"plans-markdown markdown-body",onClick:r,dangerouslySetInnerHTML:{__html:i}})]})]})}function rb({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Yk({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 RN({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 i=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(i)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const i=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),n=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=i?`${n} blocked: ${i}`:`${n} 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 i=t.getAttribute("href")??t.getAttribute("xlink:href")??"";i!==""&&!i.startsWith("#")&&t.remove()}}function yX(){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 bX=[uY,iX,fX];function SX(e="right"){const{railPanels:t}=Jl();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const wX=360;function xX(e){const{codexReader:t}=Gs();return e==="codex"&&t!==null?wX:0}const NN=240,CX=312,LN="fleet-console.rail.panelWidth",kX={kind:"root",relPath:null,label:"Theater-wide"};function EX(){try{const e=localStorage.getItem(LN);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=NN)return t}}catch{}return CX}function TX({theaterId:e,api:t}){const i=b.useRef(null),n=a5(),r=o5(),o=b.useRef(r),c=SX(),d=bX,f=[...d,...c].find(N=>N.id===n)??null,g=f!==null,{pathContextTheaterId:v,pathContext:y,pathContextHydrated:S,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:k,isPathContextDeckOpen:R}=l5(),O=e!==null&&v===e&&S&&y!==null,I=xX(n)+(f?.preferredExtraWidth??0)+lD(),A=b.useRef(I);A.current=I;const[$,L]=b.useState(EX),H=b.useRef($),[U,oe]=b.useState(!1);b.useLayoutEffect(()=>{const N=i.current;if(!N)return;const D=()=>Ex(N.getBoundingClientRect().width);D();const T=new ResizeObserver(D);return T.observe(N),()=>{T.disconnect(),Ex(0)}},[]),b.useLayoutEffect(()=>{o.current&&!r&&yR(i.current,".command-band-rail-toggle"),o.current=r},[r]),b.useEffect(()=>{s5(e),e&&aD(e,N=>YO(e,N))},[e]);const fe=b.useCallback(N=>{N.preventDefault();const D=N.clientX,T=H.current;oe(!0);const E=P=>{const V=D-P.clientX,Q=window.innerWidth-148-A.current,B=Math.max(NN,Math.min(Q,T+V));H.current=B,L(B)},j=()=>{document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",j),oe(!1);try{localStorage.setItem(LN,String(H.current))}catch{}};document.addEventListener("pointermove",E),document.addEventListener("pointerup",j)},[]),K=b.useMemo(()=>({theaterId:e,pathContext:y??kX,api:t,requestExtraWidth:N=>{n!==null&&rD(n,N)}}),[e,y,t,n]),z=b.useCallback(N=>{e&&r5(e,D=>XE(e,N,D))},[e]);return u.jsxs("div",{ref:i,className:`right-rail${g?" is-open":""}${r?" is-expanded":" is-closed"}${U?" is-dragging":""}${R?" is-context-deck-open":""}`,"data-rail-chrome":r?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!r,style:{"--right-rail-panel-width":`${g?$+I:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:$+I}:void 0,children:[g&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:fe,"aria-hidden":"true"}),f&&u.jsx(AX,{activePanel:f,activeId:n,ctx:K,theaterId:e,hasHydratedPathContext:O,isPathContextDeckOpen:R,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:k,onSelectPathContext:z})]}),u.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[d.map(N=>u.jsx(Xk,{panel:N,isActive:n===N.id},N.id)),d.length>0&&c.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,c.map(N=>u.jsx(Xk,{panel:N,isActive:n===N.id},N.id))]})})]})}const AX=b.memo(function({activePanel:t,activeId:i,ctx:n,theaterId:r,hasHydratedPathContext:o,isPathContextDeckOpen:c,pathContextLoading:d,pathContextMutationInProgress:p,pathContextError:f,onSelectPathContext:g}){const v=b.useRef(null),y=b.useRef(null),S=b.useRef(!1),w=t.pathAware===!0,x=b.useSyncExternalStore(BE,()=>Fu().theaters.find(I=>I.id===r)?.label??"Theater"),k=tD(w,r,o);b.useEffect(()=>{if(S.current&&!c){const I=requestAnimationFrame(()=>v.current?.focus());return S.current=c,()=>cancelAnimationFrame(I)}S.current=c},[c]),b.useEffect(()=>{if(!c)return;const I=A=>{const $=A.target;!($ instanceof Node)||v.current?.contains($)||y.current?.contains($)||cf(!1)};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[c]);const R=b.useCallback(()=>cf(!1),[]),O=b.useCallback(I=>{g(I)},[g]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[w?u.jsxs("button",{ref:v,className:`rail-context-title-trigger${c?" is-open":""}`,type:"button",disabled:!o||d||p,"aria-expanded":c,"aria-haspopup":"dialog",title:f??t.title,onClick:()=>cf(!c),children:[u.jsx("span",{className:"rail-context-title-text",children:t.title}),u.jsx("span",{className:"rail-context-label",title:r===null?"Theater-wide":o?n.pathContext.label:"Loading…",children:r===null?"Theater-wide":o?n.pathContext.label:"Loading…"}),u.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:nD,children:"✕"}),w&&o&&c&&r?u.jsx(t5,{ref:y,theaterId:r,theaterLabel:x,context:n.pathContext,isMutating:p,onSelect:O,onClose:R}):null]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:k?t.render(n):u.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function Xk({panel:e,isActive:t}){const i=b.useCallback(()=>iD(e.id),[e.id]),n=typeof e.icon=="function"?e.icon():e.icon;return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:i,children:n})}const RX='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function NX(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=Gs(),n=b.useRef(null),r=b.useRef(null),o=b.useRef(null),c=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,d=e!==null&&t,p=b.useCallback(()=>{JY(),iO()},[]);return b.useEffect(()=>{if(!d)return;const f=e;document.body.setAttribute("data-codex-reading","true");const g=document.querySelector(".operations-canvas"),v=document.querySelector(".operations-side-bar");g?.setAttribute("inert",""),v?.setAttribute("inert","");const y=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&LX(n.current,S)};return window.addEventListener("keydown",y,!0),()=>{window.removeEventListener("keydown",y,!0),document.body.removeAttribute("data-codex-reading"),g?.removeAttribute("inert"),v?.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]),b.useEffect(()=>{if(!d||!r.current||!o.current||!e)return;const f=e.kind,g=f==="drydock"?e.patchId:f==="conflicts"?e.id:void 0;EN(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:g,theaterId:i,onRelatedClick:v=>{zr({kind:"entry",entryId:v}),lf()},onClose:p,onPatchOpen:v=>{zr({kind:"drydock",patchId:v}),lf()},onDecided:()=>{lp(),zr({kind:"drydock",patchId:void 0}),lf()}}),requestAnimationFrame(()=>{n.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[d,c]),d?Pa.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),u.jsxs("div",{ref:n,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 LX(e,t){if(!e)return;const i=[...e.querySelectorAll(RX)].filter(o=>!o.closest("[inert]"));if(i.length===0)return;const n=i[0],r=i[i.length-1];t.shiftKey?document.activeElement===n&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),n.focus())}const MX=Mp().api,ab=560,ob=360,rv=new Set;function OX({state:e,claimBootPanelMinimization:t}){const i=b.useRef(null),n=xR(),r=Ap(),o=kR(),c=Jl(),[d,p]=b.useState([]),f=b.useMemo(()=>DX(e).map(D=>D.id),[e.operations,e.activeTheaterId]),g=b.useRef(e);g.current=e,b.useEffect(()=>{wG(e.activeTheaterId)},[e.activeTheaterId]),b.useEffect(()=>{if(!e.activeTheaterId){p([]);return}tE().then(p).catch(()=>{})},[e.activeTheaterId]),b.useEffect(()=>{const D={current:n},T={current:r},E=j=>{if(!bO()||!j.altKey||j.metaKey||j.ctrlKey)return;const P=document.activeElement;if(P instanceof HTMLElement&&P.matches("input, textarea, [contenteditable='true']")&&!P.closest(".xterm"))return;if(j.code==="KeyF"&&!j.shiftKey){j.preventDefault(),j.stopImmediatePropagation(),xG();return}if(j.shiftKey||j.key!=="ArrowLeft"&&j.key!=="ArrowRight")return;const V=g.current,Q=Fl(),B=HE(V.operations.filter(re=>re.theaterId===V.activeTheaterId),V.groups.filter(re=>re.theaterId===V.activeTheaterId),Q.operationOrder,Q.collapsedGroups).map(re=>re.id);if(B.length===0)return;j.preventDefault(),j.stopImmediatePropagation();const Z=D.current??g.current.activeOperationId,W=eO(B,Z,j.key==="ArrowRight"?1:-1);if(W){if(T.current){tf(W),$n(W);return}if(D.current){$n(W),Bu(W);return}Uu(W)}};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[r,n]),b.useEffect(()=>{for(const E of f)bG(E);if(!e.operationsHydrated||(SG(f),!e.activeTheaterId))return;const D=t(e.activeTheaterId);if(D===null)return;const T=g.current.pendingOperationFocus;yG(T?D.filter(E=>E!==T):D)},[t,f,e.activeTheaterId,e.operationsHydrated]),b.useEffect(()=>{const D=e.pendingOperationFocus;if(D===null)return;if(r){tf(D),$n(D),Gg();return}if(Fy()!==null){Bu(D),Gg();return}Wr();const T=Zk(i.current);T&&yk(D,T),Gg()},[r,e.pendingOperationFocus]);const v=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(D=>D.theaterId===e.activeTheaterId);const y=b.useCallback((D,T)=>c.plugins.find(j=>j.id===D)?.renderLaunchIcon?.(T)??null,[c.plugins]),S=b.useCallback((D,T,E)=>{if(!g.current.activeTheaterId)return;const j={...Jk(E),zIndex:To()};av(D,T,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),w=b.useCallback((D,T)=>{if(!g.current.activeTheaterId)return;const E=IX(i.current),j={...Jk(E),zIndex:To()};av(D,T,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),x=b.useCallback((D,T,E)=>{g.current.activeTheaterId&&av(D,T,E,g.current.activeTheaterId,c.plugins)},[c.plugins]),k=b.useCallback(()=>{ER({x:0,y:0,zoom:1})},[]),R=b.useCallback(D=>{const T=g.current.operations.find(Q=>Q.id===D);if(!T)return;if(T.theaterId!==g.current.activeTheaterId){Uu(D);return}if(Uy()){tf(D),$n(D);return}const E=Fy();if(E!==null&&E!==D){$n(D),Bu(D);return}const j=Fl(),P=j.operations[D]??T.geometry??jX(T);j.operations[D]||Gy(D,P),tf(D),$n(D);const V=Zk(i.current);V&&yk(D,V)},[]),O=b.useCallback(D=>{g.current.activeOperationId===D&&$n(null),TR(D)},[]),I=b.useCallback((D,T)=>{of(D,{accent:T}).then(()=>Hn(null)).then(os).catch(()=>{})},[]),A=b.useCallback((D,T)=>{TE(D,T).then(()=>Hn(null)).then(os).catch(()=>{})},[]),$=b.useCallback((D,T)=>{of(D,{groupId:T}).then(()=>Hn(null)).then(os).catch(()=>{})},[]),L=b.useCallback((D,T,E)=>{l4({theaterId:D,name:T,color:"blue"}).then(j=>E?of(E,{groupId:j.id}).then(()=>{}):void 0).then(()=>Promise.all([Hn(null).then(os),oo().then(lo)])).catch(()=>{})},[]),H=b.useCallback((D,T)=>{T&&Wg(D,{color:T}).then(()=>oo()).then(lo).catch(()=>{})},[]),U=b.useCallback((D,T)=>{Wg(D,{name:T}).then(()=>oo()).then(lo).catch(()=>{})},[]),oe=b.useCallback(D=>{const T=new Map(g.current.groups.map(j=>[j.id,j])),E=D.flatMap((j,P)=>{const V=T.get(j);return!V||V.order===P?[]:[Wg(j,{order:P})]});E.length!==0&&Promise.allSettled(E).then(()=>oo()).then(lo).catch(()=>{})},[]),fe=b.useCallback(D=>{c4(D).then(()=>Promise.all([Hn(null).then(os),oo().then(lo)])).catch(()=>{})},[]),K=b.useCallback(D=>{if(rv.has(D))return;rv.add(D);const T=g.current.operations.find(j=>j.id===D)?.pluginId,E=(T?c.plugins.find(j=>j.id===T):null)??null;BX(D,E).finally(()=>rv.delete(D))},[c.plugins]),z=b.useCallback(async D=>{zE();try{const T=await EE(D),E=await kE(T);$E(E)}catch(T){gv(T instanceof Error?T.message:String(T))}},[]),N=b.useCallback(async D=>{const T=()=>Promise.all([Hn(null).then(os),oo().then(lo)]).then(()=>{}).catch(()=>{});try{await o4(D),xx(D),await T()}catch(E){if(E instanceof gt&&E.status===404){xx(D),await T();return}gv(E instanceof Error?E.message:String(E))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(_q,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:o,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:d,canLaunch:v,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:y,onLaunchKind:w,onResetView:k,onClose:K,onMinimize:O,onFocus:R,onSetAccent:I,onRename:A,onSetGroupId:$,onCreateGroup:L,onSetGroupColor:H,onRenameGroup:U,onReorderGroups:oe,onUngroupAll:fe,onSelectTheater:X4,onAddTheater:z,onCancelAddTheater:Q4,onForgetTheater:N}),u.jsx("div",{className:"operations-center-stage",ref:i,children:u.jsx(JV,{state:e,catalog:d,canLaunch:v,renderKindIcon:y,onLaunchKind:S,onLaunchAtGeometry:x,onClose:K,onFocus:R,onRename:A,onSetAccent:I})}),u.jsx(TX,{theaterId:e.activeTheaterId,api:MX}),u.jsx(NX,{})]})}function DX(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(_v)}function Zk(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function jX(e){return e.geometry??{x:0,y:0,width:ab,height:ob,zIndex:0}}function IX(e){const t=Fl(),i=e?.clientWidth??800,n=e?.clientHeight??600;return nh({x:i/2,y:n/2},t.viewport)}function Jk(e){return{x:e.x-ab/2,y:e.y-ob/2,width:ab,height:ob}}async function av(e,t,i,n,r){const o=r.find(v=>v.id===e),d=Mp(()=>{Hn(null).then(os).catch(()=>{})});let p=null;if(o?.launch?p=(await o.launch({theaterId:n,kind:t,geometry:i,operations:d.operations})).id:p=(await d.operations.create({theaterId:n,type:t.type,pluginId:e,title:t.title,geometry:i})).id,await Hn(null).then(os).catch(()=>{}),!p)return;const f=mG()===n,g=Fu().operations.some(v=>v.id===p);f&&g&&Fy()!==null?($n(p),Bu(p)):Uu(p)}async function BX(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Hn(null).then(os).catch(()=>{})}const PX=3e4;let sf=1e3,pu=null,ov=null,lv=!1;function MN(){pu!==null&&(clearTimeout(pu),pu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const n=JSON.parse(i.data);zX(n.operation)&&Y4(n.operation)}catch{}}),e.addEventListener("update:available",()=>{rh()}),e.onopen=()=>{sf=1e3,rh()},e.onerror=()=>{e.close(),pu=setTimeout(()=>{pu=null,sf=Math.min(sf*2,PX),Hn().then(os).catch(()=>{}).finally(MN)},sf)}}function rh(){if(ov){lv=!0;return}ov=t4(Fu().activeTheaterId).then(z4).catch(()=>{}).finally(()=>{ov=null,lv&&(lv=!1,rh())})}function zX(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const $X=6e3;function HX(){const e=Gs(),t=b.useRef(new Set),i=b.useRef(null),n=Ws(),r=Jl(),o=y0(),c=eN(o.state?.language??"auto"),p=n.pathname.startsWith("/operations"),f=b.useCallback(g=>i.current===null||t.current.has(g)?null:(t.current.add(g),i.current),[]);return b.useEffect(()=>{const g=Mp(()=>{Hn().then(os).catch(()=>{})}),v=r.plugins.map(y=>y.install?.(g)).filter(y=>typeof y=="function");return()=>{for(const y of v)y()}},[r.plugins]),b.useEffect(()=>{P4(p)},[p]),b.useEffect(()=>{const g=new AbortController;e4(g.signal).then(S=>{K4(S),wx()}).catch(S=>{g.signal.aborted||(ot({theaterError:S instanceof Error?S.message:String(S)}),wx())});const v=Date.now();Hn(null,g.signal).then(S=>{i.current=S.filter(w=>w.ts.createdAt<v).map(w=>w.id),V4(S)}).catch(()=>{}),oo(null,g.signal).then(lo).catch(()=>{}),rh();const y=window.setTimeout(rh,$X);return()=>{window.clearTimeout(y),g.abort()}},[]),b.useEffect(()=>(QR({locale:c}),Zq),[c]),b.useEffect(()=>hK({getSideBarCollapsed:()=>Yy().collapsed,setSideBarCollapsed:_0,toggleOperationSearch:FE,toggleRailChrome:n5}),[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(Nq,{operationsViewVisible:p}),u.jsx("main",{className:"console-route-content",children:u.jsxs(y6,{children:[u.jsx(vl,{path:"/",element:u.jsx(gx,{to:"/operations",replace:!0})}),u.jsx(vl,{path:"/operations",element:u.jsx(OX,{state:e,claimBootPanelMinimization:f})}),u.jsx(vl,{path:"/carrier-settings",element:u.jsx(DK,{})}),u.jsx(vl,{path:"/settings",element:u.jsx(uV,{})}),u.jsx(vl,{path:"*",element:u.jsx(gx,{to:"/operations",replace:!0})})]})}),u.jsx(Pq,{state:e}),u.jsx(rK,{state:e}),u.jsx(jq,{state:e}),u.jsx(Wq,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Tf,"react/jsx-runtime":PM,"@fleet-console/sdk/plugin/browser":s3,"@fleet-console/sdk/settings/browser":h3,"@fleet-console/sdk/operations/browser":qM,"@fleet-console/sdk/notifications/browser":f3,"@fleet-console/sdk/react/browser":m3};Of("instrument");W4();try{const e=await YR();Of(e.theme),mv(e.uiFont),Vq(e)}catch{}const FX=await PW();MN();const Qk=document.querySelector("#app");Qk&&S3.createRoot(Qk).render(u.jsx(b.StrictMode,{children:u.jsx(U6,{basename:"/console",children:u.jsx(BW,{value:FX,children:u.jsx(HX,{})})})}));export{eF as _,UX as a,lb as g,$t as k,ju as p};
|