@dotobokuri/fleet-console 1.27.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -0
- package/README.md +1 -0
- package/dist/cli.mjs +29811 -13451
- package/dist/client/assets/{_baseUniq-FPn1UwMX.js → _baseUniq-0TpVlb56.js} +1 -1
- package/dist/client/assets/{arc-Dbkm3o2R.js → arc-BIRhKPNZ.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-DGXd_rAH.js → architectureDiagram-Q4EWVU46-CJzkivmk.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-B1TfqDXH.js → blockDiagram-DXYQGD6D-PkVBy6UB.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-DkgjfzU2.js → c4Diagram-AHTNJAMY-TOO0Zc07.js} +1 -1
- package/dist/client/assets/channel-CqmujVSi.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-D82651yi.js → chunk-4BX2VUAB-Ugm2Ht26.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-3v1J62DG.js → chunk-4TB4RGXK-Byfwafb_.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-BrEuCB92.js → chunk-55IACEB6-2I_nwtuS.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-QZ3Tkj6o.js → chunk-EDXVE4YY-JYP41aJo.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-C0zm-jqg.js → chunk-FMBD7UC4-Duh-U1jY.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-BLWP9U3k.js → chunk-OYMX7WX6-64cqkTOO.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-61zanhRL.js → chunk-QZHKN3VN-engflZJB.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-DtQ3mOc9.js → chunk-YZCP3GAM-BwnK_1vX.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DLXkYur6.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DLXkYur6.js +1 -0
- package/dist/client/assets/clone-KonJWRw9.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Zg6I9Teh.js → cose-bilkent-S5V4N54A-D43_BnnE.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-DGHWYQzp.js → dagre-KV5264BT-Wh_p74YO.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-sJLUf_Mf.js → diagram-5BDNPKRD-BNcxA6wC.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BlyVweUa.js → diagram-G4DWMVQ6-HQdA06kX.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-TN0odItE.js → diagram-MMDJMWI5-DlMdX_ng.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-DMg-H_H9.js → diagram-TYMM5635-C1hKAjZD.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-q52C6AV0.js → erDiagram-SMLLAGMA-CsSiuv9G.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-DNTSODrD.js → flowDiagram-DWJPFMVM-DfjQ3Ug9.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B8lDyFkt.js → ganttDiagram-T4ZO3ILL-B0QHKePg.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-CMPu2f37.js → gitGraphDiagram-UUTBAWPF-_zejoqTH.js} +1 -1
- package/dist/client/assets/{graph-B4pb3uGP.js → graph-Dr6IPcji.js} +1 -1
- package/dist/client/assets/index-CsmxZ8UQ.js +453 -0
- package/dist/client/assets/index-DC8tBAf_.css +1 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-V3RHqQRb.js → infoDiagram-42DDH7IO-dhruAwPt.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-R7Tyr7yI.js → ishikawaDiagram-UXIWVN3A-DPoZZiH0.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-ChcMOmKn.js → journeyDiagram-VCZTEJTY-DQk8gmrd.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-B37w6pAA.js → kanban-definition-6JOO6SKY-B9rOgVFq.js} +1 -1
- package/dist/client/assets/{layout-osi6dy0A.js → layout-D54BXsv2.js} +1 -1
- package/dist/client/assets/{linear-Dq0-nOx7.js → linear-DJxG7kFF.js} +1 -1
- package/dist/client/assets/{mermaid.core-C5QhuJDM.js → mermaid.core-BBFWA-zA.js} +4 -4
- package/dist/client/assets/{min-xvvoUYjd.js → min-Dv_aLAYb.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-CAgbfylQ.js → mindmap-definition-QFDTVHPH-Dv5woCon.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-CkYJac9b.js → pieDiagram-DEJITSTG-B_V_vCG8.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-B_ylk-UV.js → quadrantDiagram-34T5L4WZ-QHqq3tFD.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-CaI3fMhb.js → requirementDiagram-MS252O5E-BhPhfMzK.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-Bc-gJOJq.js → sankeyDiagram-XADWPNL6-D2-ZsaS_.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-Cp36qrrt.js → sequenceDiagram-FGHM5R23-Di0qgM3v.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-7DLhFomz.js → stateDiagram-FHFEXIEX-BAuqrwY8.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DhNebJyd.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-ePpcuK5O.js → timeline-definition-GMOUNBTQ-BcMGkC6T.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-Cm2Die3B.js → vennDiagram-DHZGUBPP-C9dkwyKX.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-ni10OklI.js → wardley-RL74JXVD-BLLCncPa.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-CjIa7qSE.js → wardleyDiagram-NUSXRM2D-Yb9mlL0_.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-B7aOvrmt.js → xychartDiagram-5P7HB3ND-BAHLdje7.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/{diff → repository}/routes.mjs +148 -22
- package/dist/fleet-plugins/terminal/routes.mjs +1889 -446
- package/package.json +1 -1
- package/dist/client/assets/channel-CozojXwb.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DfJLxwIy.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DfJLxwIy.js +0 -1
- package/dist/client/assets/clone-hpL84gNz.js +0 -1
- package/dist/client/assets/index-BsO9uzdN.css +0 -1
- package/dist/client/assets/index-rJKd0Wfd.js +0 -395
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CRYMSSnC.js +0 -1
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
function gE(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function vb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function jZ(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var zg={exports:{}},Yc={};var fx;function o3(){if(fx)return Yc;fx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var c=null;if(o!==void 0&&(c=""+o),r.key!==void 0&&(c=""+r.key),"key"in r){o={};for(var d in r)d!=="key"&&(o[d]=r[d])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:c,ref:r!==void 0?r:null,props:o}}return Yc.Fragment=t,Yc.jsx=n,Yc.jsxs=n,Yc}var px;function l3(){return px||(px=1,zg.exports=o3()),zg.exports}var u=l3();const c3=vb(u),u3=gE({__proto__:null,default:c3},[u]);var $g={exports:{}},Ze={};var mx;function h3(){if(mx)return Ze;mx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,E={};function A(P,X,Q){this.props=P,this.context=X,this.refs=E,this.updater=Q||w}A.prototype.isReactComponent={},A.prototype.setState=function(P,X){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,X,"setState")},A.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function L(){}L.prototype=A.prototype;function I(P,X,Q){this.props=P,this.context=X,this.refs=E,this.updater=Q||w}var R=I.prototype=new L;R.constructor=I,x(R,A.prototype),R.isPureReactComponent=!0;var z=Array.isArray;function O(){}var H={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function ae(P,X,Q){var Y=Q.ref;return{$$typeof:e,type:P,key:X,ref:Y!==void 0?Y:null,props:Q}}function fe(P,X){return ae(P.type,X,P.props)}function V(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function $(P){var X={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(Q){return X[Q]})}var N=/\/+/g;function D(P,X){return typeof P=="object"&&P!==null&&P.key!=null?$(""+P.key):X.toString(36)}function T(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(O,O):(P.status="pending",P.then(function(X){P.status==="pending"&&(P.status="fulfilled",P.value=X)},function(X){P.status==="pending"&&(P.status="rejected",P.reason=X)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function k(P,X,Q,Y,ie){var me=typeof P;(me==="undefined"||me==="boolean")&&(P=null);var ye=!1;if(P===null)ye=!0;else switch(me){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(P.$$typeof){case e:case t:ye=!0;break;case g:return ye=P._init,k(ye(P._payload),X,Q,Y,ie)}}if(ye)return ie=ie(P),ye=Y===""?"."+D(P,0):Y,z(ie)?(Q="",ye!=null&&(Q=ye.replace(N,"$&/")+"/"),k(ie,X,Q,"",function(ct){return ct})):ie!=null&&(V(ie)&&(ie=fe(ie,Q+(ie.key==null||P&&P.key===ie.key?"":(""+ie.key).replace(N,"$&/")+"/")+ye)),X.push(ie)),1;ye=0;var ke=Y===""?".":Y+":";if(z(P))for(var Le=0;Le<P.length;Le++)Y=P[Le],me=ke+D(Y,Le),ye+=k(Y,X,Q,me,ie);else if(Le=S(P),typeof Le=="function")for(P=Le.call(P),Le=0;!(Y=P.next()).done;)Y=Y.value,me=ke+D(Y,Le++),ye+=k(Y,X,Q,me,ie);else if(me==="object"){if(typeof P.then=="function")return k(T(P),X,Q,Y,ie);throw X=String(P),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ye}function j(P,X,Q){if(P==null)return P;var Y=[],ie=0;return k(P,Y,"","",function(me){return X.call(Q,me,ie++)}),Y}function B(P){if(P._status===-1){var X=P._result;X=X(),X.then(function(Q){(P._status===0||P._status===-1)&&(P._status=1,P._result=Q)},function(Q){(P._status===0||P._status===-1)&&(P._status=2,P._result=Q)}),P._status===-1&&(P._status=0,P._result=X)}if(P._status===1)return P._result.default;throw P._result}var q=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},J={map:j,forEach:function(P,X,Q){j(P,function(){X.apply(this,arguments)},Q)},count:function(P){var X=0;return j(P,function(){X++}),X},toArray:function(P){return j(P,function(X){return X})||[]},only:function(P){if(!V(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ze.Activity=v,Ze.Children=J,Ze.Component=A,Ze.Fragment=n,Ze.Profiler=r,Ze.PureComponent=I,Ze.StrictMode=i,Ze.Suspense=p,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(P){return H.H.useMemoCache(P)}},Ze.cache=function(P){return function(){return P.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(P,X,Q){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var Y=x({},P.props),ie=P.key;if(X!=null)for(me in X.key!==void 0&&(ie=""+X.key),X)!F.call(X,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&X.ref===void 0||(Y[me]=X[me]);var me=arguments.length-2;if(me===1)Y.children=Q;else if(1<me){for(var ye=Array(me),ke=0;ke<me;ke++)ye[ke]=arguments[ke+2];Y.children=ye}return ae(P.type,ie,Y)},Ze.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},Ze.createElement=function(P,X,Q){var Y,ie={},me=null;if(X!=null)for(Y in X.key!==void 0&&(me=""+X.key),X)F.call(X,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ie[Y]=X[Y]);var ye=arguments.length-2;if(ye===1)ie.children=Q;else if(1<ye){for(var ke=Array(ye),Le=0;Le<ye;Le++)ke[Le]=arguments[Le+2];ie.children=ke}if(P&&P.defaultProps)for(Y in ye=P.defaultProps,ye)ie[Y]===void 0&&(ie[Y]=ye[Y]);return ae(P,me,ie)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(P){return{$$typeof:d,render:P}},Ze.isValidElement=V,Ze.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:B}},Ze.memo=function(P,X){return{$$typeof:f,type:P,compare:X===void 0?null:X}},Ze.startTransition=function(P){var X=H.T,Q={};H.T=Q;try{var Y=P(),ie=H.S;ie!==null&&ie(Q,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(O,q)}catch(me){q(me)}finally{X!==null&&Q.types!==null&&(X.types=Q.types),H.T=X}},Ze.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},Ze.use=function(P){return H.H.use(P)},Ze.useActionState=function(P,X,Q){return H.H.useActionState(P,X,Q)},Ze.useCallback=function(P,X){return H.H.useCallback(P,X)},Ze.useContext=function(P){return H.H.useContext(P)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(P,X){return H.H.useDeferredValue(P,X)},Ze.useEffect=function(P,X){return H.H.useEffect(P,X)},Ze.useEffectEvent=function(P){return H.H.useEffectEvent(P)},Ze.useId=function(){return H.H.useId()},Ze.useImperativeHandle=function(P,X,Q){return H.H.useImperativeHandle(P,X,Q)},Ze.useInsertionEffect=function(P,X){return H.H.useInsertionEffect(P,X)},Ze.useLayoutEffect=function(P,X){return H.H.useLayoutEffect(P,X)},Ze.useMemo=function(P,X){return H.H.useMemo(P,X)},Ze.useOptimistic=function(P,X){return H.H.useOptimistic(P,X)},Ze.useReducer=function(P,X,Q){return H.H.useReducer(P,X,Q)},Ze.useRef=function(P){return H.H.useRef(P)},Ze.useState=function(P){return H.H.useState(P)},Ze.useSyncExternalStore=function(P,X,Q){return H.H.useSyncExternalStore(P,X,Q)},Ze.useTransition=function(){return H.H.useTransition()},Ze.version="19.2.7",Ze}var gx;function yb(){return gx||(gx=1,$g.exports=h3()),$g.exports}var y=yb();const d3=vb(y),Lf=gE({__proto__:null,default:d3},[y]),f3="fc-operation-body";let ki=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function _E(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new ki(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(m3).filter(i=>i!==null):[]}function Nf(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)||vE(t))throw new ki(500,"Invalid operation response");return t}function vE(e){return gv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function p3({children:e,className:t}){return u.jsx("div",{className:_3(f3,t),children:e})}function m3(e){if(!yE(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(g3).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function g3(e){return!yE(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 yE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>gv(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||gv(i,t))}function _3(...e){return e.filter(t=>!!t).join(" ")}const v3=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ki,OperationBody:p3,assertOperationNode:Nf,fetchOperationCatalog:_E,hasForbiddenBrowserPayloadKey:vE},Symbol.toStringTag,{value:"Module"}));function y3(e){return e}function b3(e){return e}function bE(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(Hg(n,i),r).then(E3),subscribe:(n,i,r)=>{const o=new EventSource(Hg(n,i));o.onmessage=r;const c=()=>o.close();return t.add(c),()=>{c(),t.delete(c)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const c=await fetch(Hg(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!c.ok)throw new ki(c.status,`Terminal ticket request failed: ${c.status}`);const d=await c.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new ki(c.status,"Invalid terminal ticket response");return{ticket:d.ticket,ttlMs:d.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async n=>{const i=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new ki(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return Nf(r.operation)},rename:async(n,i)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw new ki(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Nf(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new ki(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>A3(n,i),write:(n,i)=>R3(n,i)},settings:{read:async n=>{const i=await fetch(_x(n));if(!i.ok)throw new ki(i.status,`Plugin settings read failed: ${i.status}`);const o=(await i.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(n,i)=>{const r=await fetch(_x(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new ki(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function SE(e,t){return y.useSyncExternalStore(e,t,t)}function S3(){const[e,t]=y.useState([]),n=y.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new ki(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(Nf):[])},[]);return y.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function w3(e,t){return y.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function x3(e,t){return y.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function C3(e,t,n){const[i,r]=y.useState(()=>e.read(t,n)),o=y.useCallback(c=>{r(c),e.write(t,c)},[e,t]);return[i,o]}function k3(e,t){return y.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function E3(e){if(!e.ok)throw new ki(e.status,`Plugin request failed: ${e.status}`);return e}function Hg(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new ki(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new ki(400,"Invalid plugin path");return`/plugins/${e}${n}`}const T3=/^[a-z0-9][a-z0-9._-]*$/;function _x(e){if(!T3.test(e))throw new ki(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function A3(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(`fleet-plugin.${e}`);return n===null?t:JSON.parse(n)}catch{return t}}function R3(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const L3=Object.freeze(Object.defineProperty({__proto__:null,React:Lf,createClientCapabilities:bE,defineOperationKind:b3,definePlugin:y3,useOperationStatus:k3,useOperations:S3,usePluginApi:w3,usePluginSettings:x3,usePluginStorage:C3,useStoreSnapshot:SE},Symbol.toStringTag,{value:"Module"}));function N3(e){return e}function M3({title:e,description:t,children:n}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:n})]})}function O3({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:n})]})}function D3({checked:e,onChange:t,label:n,disabled:i=!1}){const r=y.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[u.jsx("input",{id:r,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?u.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function j3({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=y.useId(),c=u.jsx("select",{id:o,className:"fc-settings-select__control",value:e,disabled:r,"aria-label":i?void 0:"Select setting",onChange:d=>n(d.currentTarget.value),children:t.map(d=>u.jsx("option",{value:d.value,children:d.label},d.value))});return i?u.jsxs("label",{className:"fc-settings-select",htmlFor:o,children:[u.jsx("span",{className:"fc-settings-select__label",children:i}),c]}):u.jsx("div",{className:"fc-settings-select",children:c})}function I3({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:n})]})}const B3=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:M3,SettingsField:I3,SettingsRow:O3,SettingsSelect:j3,SettingsToggle:D3,defineSettingsSection:N3},Symbol.toStringTag,{value:"Module"}));function P3(e){return e}const z3=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:P3},Symbol.toStringTag,{value:"Module"})),$3=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class bb extends y.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??$3:this.props.children}}const H3=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:bb,React:Lf,default:Lf},Symbol.toStringTag,{value:"Module"}));var Fg={exports:{}},Xc={},Ug={exports:{}},Wg={};var vx;function F3(){return vx||(vx=1,(function(e){function t(k,j){var B=k.length;k.push(j);e:for(;0<B;){var q=B-1>>>1,J=k[q];if(0<r(J,j))k[q]=j,k[B]=J,B=q;else break e}}function n(k){return k.length===0?null:k[0]}function i(k){if(k.length===0)return null;var j=k[0],B=k.pop();if(B!==j){k[0]=B;e:for(var q=0,J=k.length,P=J>>>1;q<P;){var X=2*(q+1)-1,Q=k[X],Y=X+1,ie=k[Y];if(0>r(Q,B))Y<J&&0>r(ie,Q)?(k[q]=ie,k[Y]=B,q=Y):(k[q]=Q,k[X]=B,q=X);else if(Y<J&&0>r(ie,B))k[q]=ie,k[Y]=B,q=Y;else break e}}return j}function r(k,j){var B=k.sortIndex-j.sortIndex;return B!==0?B:k.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,b=3,S=!1,w=!1,x=!1,E=!1,A=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function R(k){for(var j=n(f);j!==null;){if(j.callback===null)i(f);else if(j.startTime<=k)i(f),j.sortIndex=j.expirationTime,t(p,j);else break;j=n(f)}}function z(k){if(x=!1,R(k),!w)if(n(p)!==null)w=!0,O||(O=!0,$());else{var j=n(f);j!==null&&T(z,j.startTime-k)}}var O=!1,H=-1,F=5,ae=-1;function fe(){return E?!0:!(e.unstable_now()-ae<F)}function V(){if(E=!1,O){var k=e.unstable_now();ae=k;var j=!0;try{e:{w=!1,x&&(x=!1,L(H),H=-1),S=!0;var B=b;try{t:{for(R(k),v=n(p);v!==null&&!(v.expirationTime>k&&fe());){var q=v.callback;if(typeof q=="function"){v.callback=null,b=v.priorityLevel;var J=q(v.expirationTime<=k);if(k=e.unstable_now(),typeof J=="function"){v.callback=J,R(k),j=!0;break t}v===n(p)&&i(p),R(k)}else i(p);v=n(p)}if(v!==null)j=!0;else{var P=n(f);P!==null&&T(z,P.startTime-k),j=!1}}break e}finally{v=null,b=B,S=!1}j=void 0}}finally{j?$():O=!1}}}var $;if(typeof I=="function")$=function(){I(V)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,D=N.port2;N.port1.onmessage=V,$=function(){D.postMessage(null)}}else $=function(){A(V,0)};function T(k,j){H=A(function(){k(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(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(k){switch(b){case 1:case 2:case 3:var j=3;break;default:j=b}var B=b;b=j;try{return k()}finally{b=B}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(k,j){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var B=b;b=k;try{return j()}finally{b=B}},e.unstable_scheduleCallback=function(k,j,B){var q=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?q+B:q):B=q,k){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=B+J,k={id:g++,callback:j,priorityLevel:k,startTime:B,expirationTime:J,sortIndex:-1},B>q?(k.sortIndex=B,t(f,k),n(p)===null&&k===n(f)&&(x?(L(H),H=-1):x=!0,T(z,B-q))):(k.sortIndex=J,t(p,k),w||S||(w=!0,O||(O=!0,$()))),k},e.unstable_shouldYield=fe,e.unstable_wrapCallback=function(k){var j=b;return function(){var B=b;b=j;try{return k.apply(this,arguments)}finally{b=B}}}})(Wg)),Wg}var yx;function U3(){return yx||(yx=1,Ug.exports=F3()),Ug.exports}var Gg={exports:{}},_i={};var bx;function W3(){if(bx)return _i;bx=1;var e=yb();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(p,f,g){var 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 _i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,_i.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)},_i.flushSync=function(p){var f=c.T,g=i.p;try{if(c.T=null,i.p=2,p)return p()}finally{c.T=f,i.p=g,i.d.f()}},_i.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(p,f))},_i.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},_i.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var g=f.as,v=d(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:S}):g==="script"&&i.d.X(p,{crossOrigin:v,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},_i.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=d(f.as,f.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(p)},_i.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);i.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})}},_i.preloadModule=function(p,f){if(typeof p=="string")if(f){var g=d(f.as,f.crossOrigin);i.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(p)},_i.requestFormReset=function(p){i.d.r(p)},_i.unstable_batchedUpdates=function(p,f){return p(f)},_i.useFormState=function(p,f,g){return c.H.useFormState(p,f,g)},_i.useFormStatus=function(){return c.H.useHostTransitionStatus()},_i.version="19.2.7",_i}var Sx;function wE(){if(Sx)return Gg.exports;Sx=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(),Gg.exports=W3(),Gg.exports}var wx;function G3(){if(wx)return Xc;wx=1;var e=U3(),t=yb(),n=wE();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function c(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function p(s){if(o(s)!==s)throw Error(i(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var l=s,h=a;;){var m=l.return;if(m===null)break;var _=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(i(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(i(189))}}if(l.alternate!==h)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),I=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function $(s){return s===null||typeof s!="object"?null:(s=V&&s[V]||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 A:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case O:return"SuspenseList";case ae:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case I:return s.displayName||"Context";case L:return(s._context.displayName||"Context")+".Consumer";case R: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 F:a=s._payload,s=s._init;try{return D(s(a))}catch{}}return null}var T=Array.isArray,k=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},q=[],J=-1;function P(s){return{current:s}}function X(s){0>J||(s.current=q[J],q[J]=null,J--)}function Q(s,a){J++,q[J]=s.current,s.current=a}var Y=P(null),ie=P(null),me=P(null),ye=P(null);function ke(s,a){switch(Q(me,a),Q(ie,s),Q(Y,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Iw(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Iw(a),s=Bw(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(Y),Q(Y,s)}function Le(){X(Y),X(ie),X(me)}function ct(s){s.memoizedState!==null&&Q(ye,s);var a=Y.current,l=Bw(a,s.type);a!==l&&(Q(ie,s),Q(Y,l))}function je(s){ie.current===s&&(X(Y),X(ie)),ye.current===s&&(X(ye),Gc._currentValue=B)}var Ae,Se;function $e(s){if(Ae===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Ae=a&&a[1]||"",Se=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Ae+s+Se}var Ye=!1;function ht(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(re){var se=re}Reflect.construct(s,[],de)}else{try{de.call()}catch(re){se=re}s.call(de.prototype)}}else{try{throw Error()}catch(re){se=re}(de=s())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(re){if(re&&se&&typeof re.stack=="string")return[re.stack,se.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=h.DetermineComponentFrameRoot(),C=_[0],M=_[1];if(C&&M){var G=C.split(`
|
|
4
|
-
`),ne=M.split(`
|
|
5
|
-
`);for(m=h=0;h<G.length&&!G[h].includes("DetermineComponentFrameRoot");)h++;for(;m<ne.length&&!ne[m].includes("DetermineComponentFrameRoot");)m++;if(h===G.length||m===ne.length)for(h=G.length-1,m=ne.length-1;1<=h&&0<=m&&G[h]!==ne[m];)m--;for(;1<=h&&0<=m;h--,m--)if(G[h]!==ne[m]){if(h!==1||m!==1)do if(h--,m--,0>m||G[h]!==ne[m]){var le=`
|
|
6
|
-
`+G[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:"")?$e(l):""}function nt(s,a){switch(s.tag){case 26:case 27:case 5:return $e(s.type);case 16:return $e("Lazy");case 13:return s.child!==a&&a!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return ht(s.type,!1);case 11:return ht(s.type.render,!1);case 1:return ht(s.type,!0);case 31:return $e("Activity");default:return""}}function yt(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 Tt=Object.prototype.hasOwnProperty,nn=e.unstable_scheduleCallback,Be=e.unstable_cancelCallback,_e=e.unstable_shouldYield,We=e.unstable_requestPaint,ut=e.unstable_now,ds=e.unstable_getCurrentPriorityLevel,Fn=e.unstable_ImmediatePriority,kn=e.unstable_UserBlockingPriority,Ni=e.unstable_NormalPriority,bi=e.unstable_LowPriority,Ki=e.unstable_IdlePriority,fr=e.log,Vi=e.unstable_setDisableYieldValue,fi=null,Yt=null;function jt(s){if(typeof fr=="function"&&Vi(s),Yt&&typeof Yt.setStrictMode=="function")try{Yt.setStrictMode(fi,s)}catch{}}var It=Math.clz32?Math.clz32:fs,pr=Math.log,In=Math.LN2;function fs(s){return s>>>=0,s===0?32:31-(pr(s)/In|0)|0}var ei=256,ps=262144,js=4194304;function Bt(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function W(s,a,l){var h=s.pendingLanes;if(h===0)return 0;var m=0,_=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var M=h&134217727;return M!==0?(h=M&~_,h!==0?m=Bt(h):(C&=M,C!==0?m=Bt(C):l||(l=M&~s,l!==0&&(m=Bt(l))))):(M=h&~_,M!==0?m=Bt(M):C!==0?m=Bt(C):l||(l=h&~s,l!==0&&(m=Bt(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 ve(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ze(){var s=js;return js<<=1,(js&62914560)===0&&(js=4194304),s}function Rt(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function St(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Re(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,G=s.expirationTimes,ne=s.hiddenUpdates;for(l=C&~l;0<l;){var le=31-It(l),de=1<<le;M[le]=0,G[le]=-1;var se=ne[le];if(se!==null)for(ne[le]=null,le=0;le<se.length;le++){var re=se[le];re!==null&&(re.lane&=-536870913)}l&=~de}h!==0&&Ee(s,h,0),_!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=_&~(C&~a))}function Ee(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-It(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|l&261930}function Fe(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var h=31-It(l),m=1<<h;m&a|s[h]&a&&(s[h]|=a),l&=~m}}function Gt(s,a){var l=a&-a;return l=(l&42)!==0?1:rt(l),(l&(s.suspendedLanes|a))!==0?0:l}function rt(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 En(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:ax(s.type))}function pt(s,a){var l=j.p;try{return j.p=s,a()}finally{j.p=l}}var wt=Math.random().toString(36).slice(2),Ue="__reactFiber$"+wt,be="__reactProps$"+wt,Lt="__reactContainer$"+wt,Pt="__reactEvents$"+wt,ti="__reactListeners$"+wt,pi="__reactHandles$"+wt,Yi="__reactResources$"+wt,mi="__reactMarker$"+wt;function Me(s){delete s[Ue],delete s[be],delete s[Pt],delete s[ti],delete s[pi]}function U(s){var a=s[Ue];if(a)return a;for(var l=s.parentNode;l;){if(a=l[Lt]||l[Ue]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Ww(s);s!==null;){if(l=s[Ue])return l;s=Ww(s)}return a}s=l,l=s.parentNode}return null}function oe(s){if(s=s[Ue]||s[Lt]){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(i(33))}function Je(s){var a=s[Yi];return a||(a=s[Yi]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function et(s){s[mi]=!0}var Nt=new Set,sn={};function rn(s,a){ge(s,a),ge(s+"Capture",a)}function ge(s,a){for(sn[s]=a,s=0;s<a.length;s++)Nt.add(a[s])}var Ie=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]*$"),Pe={},xt={};function an(s){return Tt.call(xt,s)?!0:Tt.call(Pe,s)?!1:Ie.test(s)?xt[s]=!0:(Pe[s]=!0,!1)}function gi(s,a,l){if(an(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 Xi(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 Mi(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 Kt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Zi(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function bh(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 jo(s){if(!s._valueTracker){var a=Zi(s)?"checked":"value";s._valueTracker=bh(s,a,""+s[a])}}function sc(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return s&&(h=Zi(s)?s.checked?"true":"false":s.value),s=h,s!==l?(a.setValue(s),!0):!1}function Io(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 Pp=/[\n"\\]/g;function Oi(s){return s.replace(Pp,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function rc(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=""+Kt(a)):s.value!==""+Kt(a)&&(s.value=""+Kt(a)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),a!=null?Bo(s,C,Kt(a)):l!=null?Bo(s,C,Kt(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=""+Kt(M):s.removeAttribute("name")}function Ua(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)){jo(s);return}l=l!=null?""+Kt(l):"",a=a!=null?""+Kt(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),jo(s)}function Bo(s,a,l){a==="number"&&Io(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function ni(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=""+Kt(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 Sh(s,a,l){if(a!=null&&(a=""+Kt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+Kt(l):""}function Po(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(T(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=Kt(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),jo(s)}function Ke(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var wh=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 Tn(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||wh.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Mt(s,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,l!=null){for(var h in l)!l.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in a)h=a[m],a.hasOwnProperty(m)&&l[m]!==h&&Tn(s,m,h)}else for(var _ in a)a.hasOwnProperty(_)&&Tn(s,_,a[_])}function Zr(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 mr=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"]]),ac=/^[\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 Jr(s){return ac.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function xe(){}var Oe=null;function Qe(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var mt=null,un=null;function ms(s){var a=oe(s);if(a&&(s=a.stateNode)){var l=s[be]||null;e:switch(s=a.stateNode,a.type){case"input":if(rc(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="'+Oi(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==s&&h.form===s.form){var m=h[be]||null;if(!m)throw Error(i(90));rc(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&&sc(h)}break e;case"textarea":Sh(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&ni(s,!!l.multiple,a,!1)}}}var oc=!1;function xh(s,a,l){if(oc)return s(a,l);oc=!0;try{var h=s(a);return h}finally{if(oc=!1,(mt!==null||un!==null)&&(ud(),mt&&(a=mt,s=un,un=mt=null,ms(a),s)))for(a=0;a<s.length;a++)ms(s[a])}}function lc(s,a){var l=s.stateNode;if(l===null)return null;var h=l[be]||null;if(h===null)return null;l=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zp=!1;if(gr)try{var cc={};Object.defineProperty(cc,"passive",{get:function(){zp=!0}}),window.addEventListener("test",cc,cc),window.removeEventListener("test",cc,cc)}catch{zp=!1}var Qr=null,$p=null,Ch=null;function B0(){if(Ch)return Ch;var s,a=$p,l=a.length,h,m="value"in Qr?Qr.value:Qr.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 Ch=m.slice(s,1<h?1-h:void 0)}function kh(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 Eh(){return!0}function P0(){return!1}function Di(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)?Eh:P0,this.isPropagationStopped=P0,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=Eh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Eh)},persist:function(){},isPersistent:Eh}),a}var Wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Th=Di(Wa),uc=v({},Wa,{view:0,detail:0}),rN=Di(uc),Hp,Fp,hc,Ah=v({},uc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wp,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!==hc&&(hc&&s.type==="mousemove"?(Hp=s.screenX-hc.screenX,Fp=s.screenY-hc.screenY):Fp=Hp=0,hc=s),Hp)},movementY:function(s){return"movementY"in s?s.movementY:Fp}}),z0=Di(Ah),aN=v({},Ah,{dataTransfer:0}),oN=Di(aN),lN=v({},uc,{relatedTarget:0}),Up=Di(lN),cN=v({},Wa,{animationName:0,elapsedTime:0,pseudoElement:0}),uN=Di(cN),hN=v({},Wa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),dN=Di(hN),fN=v({},Wa,{data:0}),$0=Di(fN),pN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mN={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"},gN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _N(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=gN[s])?!!a[s]:!1}function Wp(){return _N}var vN=v({},uc,{key:function(s){if(s.key){var a=pN[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=kh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?mN[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wp,charCode:function(s){return s.type==="keypress"?kh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?kh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),yN=Di(vN),bN=v({},Ah,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),H0=Di(bN),SN=v({},uc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wp}),wN=Di(SN),xN=v({},Wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),CN=Di(xN),kN=v({},Ah,{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}),EN=Di(kN),TN=v({},Wa,{newState:0,oldState:0}),AN=Di(TN),RN=[9,13,27,32],Gp=gr&&"CompositionEvent"in window,dc=null;gr&&"documentMode"in document&&(dc=document.documentMode);var LN=gr&&"TextEvent"in window&&!dc,F0=gr&&(!Gp||dc&&8<dc&&11>=dc),U0=" ",W0=!1;function G0(s,a){switch(s){case"keyup":return RN.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q0(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var zo=!1;function NN(s,a){switch(s){case"compositionend":return q0(a);case"keypress":return a.which!==32?null:(W0=!0,U0);case"textInput":return s=a.data,s===U0&&W0?null:s;default:return null}}function MN(s,a){if(zo)return s==="compositionend"||!Gp&&G0(s,a)?(s=B0(),Ch=$p=Qr=null,zo=!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 F0&&a.locale!=="ko"?null:a.data;default:return null}}var ON={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 K0(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!ON[s.type]:a==="textarea"}function V0(s,a,l,h){mt?un?un.push(h):un=[h]:mt=h,a=_d(a,"onChange"),0<a.length&&(l=new Th("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var fc=null,pc=null;function DN(s){Lw(s,0)}function Rh(s){var a=Ce(s);if(sc(a))return s}function Y0(s,a){if(s==="change")return a}var X0=!1;if(gr){var qp;if(gr){var Kp="oninput"in document;if(!Kp){var Z0=document.createElement("div");Z0.setAttribute("oninput","return;"),Kp=typeof Z0.oninput=="function"}qp=Kp}else qp=!1;X0=qp&&(!document.documentMode||9<document.documentMode)}function J0(){fc&&(fc.detachEvent("onpropertychange",Q0),pc=fc=null)}function Q0(s){if(s.propertyName==="value"&&Rh(pc)){var a=[];V0(a,pc,s,Qe(s)),xh(DN,a)}}function jN(s,a,l){s==="focusin"?(J0(),fc=a,pc=l,fc.attachEvent("onpropertychange",Q0)):s==="focusout"&&J0()}function IN(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Rh(pc)}function BN(s,a){if(s==="click")return Rh(a)}function PN(s,a){if(s==="input"||s==="change")return Rh(a)}function zN(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var Ji=typeof Object.is=="function"?Object.is:zN;function mc(s,a){if(Ji(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(!Tt.call(a,m)||!Ji(s[m],a[m]))return!1}return!0}function e1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function t1(s,a){var l=e1(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=e1(l)}}function n1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?n1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function i1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Io(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=Io(s.document)}return a}function Vp(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 $N=gr&&"documentMode"in document&&11>=document.documentMode,$o=null,Yp=null,gc=null,Xp=!1;function s1(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Xp||$o==null||$o!==Io(h)||(h=$o,"selectionStart"in h&&Vp(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}),gc&&mc(gc,h)||(gc=h,h=_d(Yp,"onSelect"),0<h.length&&(a=new Th("onSelect","select",null,a,l),s.push({event:a,listeners:h}),a.target=$o)))}function Ga(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var Ho={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},Zp={},r1={};gr&&(r1=document.createElement("div").style,"AnimationEvent"in window||(delete Ho.animationend.animation,delete Ho.animationiteration.animation,delete Ho.animationstart.animation),"TransitionEvent"in window||delete Ho.transitionend.transition);function qa(s){if(Zp[s])return Zp[s];if(!Ho[s])return s;var a=Ho[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in r1)return Zp[s]=a[l];return s}var a1=qa("animationend"),o1=qa("animationiteration"),l1=qa("animationstart"),HN=qa("transitionrun"),FN=qa("transitionstart"),UN=qa("transitioncancel"),c1=qa("transitionend"),u1=new Map,Jp="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(" ");Jp.push("scrollEnd");function Is(s,a){u1.set(s,a),rn(a,[s])}var Lh=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)},gs=[],Fo=0,Qp=0;function Nh(){for(var s=Fo,a=Qp=Fo=0;a<s;){var l=gs[a];gs[a++]=null;var h=gs[a];gs[a++]=null;var m=gs[a];gs[a++]=null;var _=gs[a];if(gs[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&&h1(l,m,_)}}function Mh(s,a,l,h){gs[Fo++]=s,gs[Fo++]=a,gs[Fo++]=l,gs[Fo++]=h,Qp|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function em(s,a,l,h){return Mh(s,a,l,h),Oh(s)}function Ka(s,a){return Mh(s,null,null,a),Oh(s)}function h1(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-It(l),s=_.hiddenUpdates,h=s[m],h===null?s[m]=[a]:h.push(a),a.lane=l|536870912),_):null}function Oh(s){if(50<Pc)throw Pc=0,cg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var Uo={};function WN(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 Qi(s,a,l,h){return new WN(s,a,l,h)}function tm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function _r(s,a){var l=s.alternate;return l===null?(l=Qi(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 d1(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 Dh(s,a,l,h,m,_){var C=0;if(h=s,typeof s=="function")tm(s)&&(C=1);else if(typeof s=="string")C=YM(s,l,Y.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case ae:return s=Qi(31,l,a,m),s.elementType=ae,s.lanes=_,s;case x:return Va(l.children,m,_,a);case E:C=8,m|=24;break;case A:return s=Qi(12,l,a,m|2),s.elementType=A,s.lanes=_,s;case z:return s=Qi(13,l,a,m),s.elementType=z,s.lanes=_,s;case O:return s=Qi(19,l,a,m),s.elementType=O,s.lanes=_,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case I:C=10;break e;case L:C=9;break e;case R:C=11;break e;case H:C=14;break e;case F:C=16,h=null;break e}C=29,l=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=Qi(C,l,a,m),a.elementType=s,a.type=h,a.lanes=_,a}function Va(s,a,l,h){return s=Qi(7,s,h,a),s.lanes=l,s}function nm(s,a,l){return s=Qi(6,s,null,a),s.lanes=l,s}function f1(s){var a=Qi(18,null,null,0);return a.stateNode=s,a}function im(s,a,l){return a=Qi(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var p1=new WeakMap;function _s(s,a){if(typeof s=="object"&&s!==null){var l=p1.get(s);return l!==void 0?l:(a={value:s,source:a,stack:yt(a)},p1.set(s,a),a)}return{value:s,source:a,stack:yt(a)}}var Wo=[],Go=0,jh=null,_c=0,vs=[],ys=0,ea=null,Ys=1,Xs="";function vr(s,a){Wo[Go++]=_c,Wo[Go++]=jh,jh=s,_c=a}function m1(s,a,l){vs[ys++]=Ys,vs[ys++]=Xs,vs[ys++]=ea,ea=s;var h=Ys;s=Xs;var m=32-It(h)-1;h&=~(1<<m),l+=1;var _=32-It(a)+m;if(30<_){var C=m-m%5;_=(h&(1<<C)-1).toString(32),h>>=C,m-=C,Ys=1<<32-It(a)+m|l<<m|h,Xs=_+s}else Ys=1<<_|l<<m|h,Xs=s}function sm(s){s.return!==null&&(vr(s,1),m1(s,1,0))}function rm(s){for(;s===jh;)jh=Wo[--Go],Wo[Go]=null,_c=Wo[--Go],Wo[Go]=null;for(;s===ea;)ea=vs[--ys],vs[ys]=null,Xs=vs[--ys],vs[ys]=null,Ys=vs[--ys],vs[ys]=null}function g1(s,a){vs[ys++]=Ys,vs[ys++]=Xs,vs[ys++]=ea,Ys=a.id,Xs=a.overflow,ea=s}var ii=null,Xt=null,vt=!1,ta=null,bs=!1,am=Error(i(519));function na(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vc(_s(a,s)),am}function _1(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[Ue]=s,a[be]=h,l){case"dialog":ft("cancel",a),ft("close",a);break;case"iframe":case"object":case"embed":ft("load",a);break;case"video":case"audio":for(l=0;l<$c.length;l++)ft($c[l],a);break;case"source":ft("error",a);break;case"img":case"image":case"link":ft("error",a),ft("load",a);break;case"details":ft("toggle",a);break;case"input":ft("invalid",a),Ua(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":ft("invalid",a);break;case"textarea":ft("invalid",a),Po(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||Dw(a.textContent,l)?(h.popover!=null&&(ft("beforetoggle",a),ft("toggle",a)),h.onScroll!=null&&ft("scroll",a),h.onScrollEnd!=null&&ft("scrollend",a),h.onClick!=null&&(a.onclick=xe),a=!0):a=!1,a||na(s,!0)}function v1(s){for(ii=s.return;ii;)switch(ii.tag){case 5:case 31:case 13:bs=!1;return;case 27:case 3:bs=!0;return;default:ii=ii.return}}function qo(s){if(s!==ii)return!1;if(!vt)return v1(s),vt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Cg(s.type,s.memoizedProps)),l=!l),l&&Xt&&na(s),v1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=Uw(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=Uw(s)}else a===27?(a=Xt,ga(s.type)?(s=Rg,Rg=null,Xt=s):Xt=a):Xt=ii?ws(s.stateNode.nextSibling):null;return!0}function Ya(){Xt=ii=null,vt=!1}function om(){var s=ta;return s!==null&&(Pi===null?Pi=s:Pi.push.apply(Pi,s),ta=null),s}function vc(s){ta===null?ta=[s]:ta.push(s)}var lm=P(null),Xa=null,yr=null;function ia(s,a,l){Q(lm,a._currentValue),a._currentValue=l}function br(s){s._currentValue=lm.current,X(lm)}function cm(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 um(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 G=0;G<a.length;G++)if(M.context===a[G]){_.lanes|=l,M=_.alternate,M!==null&&(M.lanes|=l),cm(_.return,l,s),h||(C=null);break e}_=M.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(i(341));C.lanes|=l,_=C.alternate,_!==null&&(_.lanes|=l),cm(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 Ko(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(i(387));if(C=C.memoizedProps,C!==null){var M=m.type;Ji(m.pendingProps.value,C.value)||(s!==null?s.push(M):s=[M])}}else if(m===ye.current){if(C=m.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Gc):s=[Gc])}m=m.return}s!==null&&um(a,s,l,h),a.flags|=262144}function Ih(s){for(s=s.firstContext;s!==null;){if(!Ji(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Za(s){Xa=s,yr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function si(s){return y1(Xa,s)}function Bh(s,a){return Xa===null&&Za(s),y1(s,a)}function y1(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},yr===null){if(s===null)throw Error(i(308));yr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else yr=yr.next=a;return l}var GN=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()})}},qN=e.unstable_scheduleCallback,KN=e.unstable_NormalPriority,An={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hm(){return{controller:new GN,data:new Map,refCount:0}}function yc(s){s.refCount--,s.refCount===0&&qN(KN,function(){s.controller.abort()})}var bc=null,dm=0,Vo=0,Yo=null;function VN(s,a){if(bc===null){var l=bc=[];dm=0,Vo=mg(),Yo={status:"pending",value:void 0,then:function(h){l.push(h)}}}return dm++,a.then(b1,b1),a}function b1(){if(--dm===0&&bc!==null){Yo!==null&&(Yo.status="fulfilled");var s=bc;bc=null,Vo=0,Yo=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function YN(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 S1=k.S;k.S=function(s,a){sw=ut(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&VN(s,a),S1!==null&&S1(s,a)};var Ja=P(null);function fm(){var s=Ja.current;return s!==null?s:qt.pooledCache}function Ph(s,a){a===null?Q(Ja,Ja.current):Q(Ja,a.pool)}function w1(){var s=fm();return s===null?null:{parent:An._currentValue,pool:s}}var Xo=Error(i(460)),pm=Error(i(474)),zh=Error(i(542)),$h={then:function(){}};function x1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function C1(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(xe,xe),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,E1(s),s;default:if(typeof a.status=="string")a.then(xe,xe);else{if(s=qt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=h}},function(h){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,E1(s),s}throw eo=a,Xo}}function Qa(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(eo=l,Xo):l}}var eo=null;function k1(){if(eo===null)throw Error(i(459));var s=eo;return eo=null,s}function E1(s){if(s===Xo||s===zh)throw Error(i(483))}var Zo=null,Sc=0;function Hh(s){var a=Sc;return Sc+=1,Zo===null&&(Zo=[]),C1(Zo,s,a)}function wc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Fh(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function T1(s){function a(Z,K){if(s){var te=Z.deletions;te===null?(Z.deletions=[K],Z.flags|=16):te.push(K)}}function l(Z,K){if(!s)return null;for(;K!==null;)a(Z,K),K=K.sibling;return null}function h(Z){for(var K=new Map;Z!==null;)Z.key!==null?K.set(Z.key,Z):K.set(Z.index,Z),Z=Z.sibling;return K}function m(Z,K){return Z=_r(Z,K),Z.index=0,Z.sibling=null,Z}function _(Z,K,te){return Z.index=te,s?(te=Z.alternate,te!==null?(te=te.index,te<K?(Z.flags|=67108866,K):te):(Z.flags|=67108866,K)):(Z.flags|=1048576,K)}function C(Z){return s&&Z.alternate===null&&(Z.flags|=67108866),Z}function M(Z,K,te,he){return K===null||K.tag!==6?(K=nm(te,Z.mode,he),K.return=Z,K):(K=m(K,te),K.return=Z,K)}function G(Z,K,te,he){var He=te.type;return He===x?le(Z,K,te.props.children,he,te.key):K!==null&&(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===F&&Qa(He)===K.type)?(K=m(K,te.props),wc(K,te),K.return=Z,K):(K=Dh(te.type,te.key,te.props,null,Z.mode,he),wc(K,te),K.return=Z,K)}function ne(Z,K,te,he){return K===null||K.tag!==4||K.stateNode.containerInfo!==te.containerInfo||K.stateNode.implementation!==te.implementation?(K=im(te,Z.mode,he),K.return=Z,K):(K=m(K,te.children||[]),K.return=Z,K)}function le(Z,K,te,he,He){return K===null||K.tag!==7?(K=Va(te,Z.mode,he,He),K.return=Z,K):(K=m(K,te),K.return=Z,K)}function de(Z,K,te){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=nm(""+K,Z.mode,te),K.return=Z,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return te=Dh(K.type,K.key,K.props,null,Z.mode,te),wc(te,K),te.return=Z,te;case w:return K=im(K,Z.mode,te),K.return=Z,K;case F:return K=Qa(K),de(Z,K,te)}if(T(K)||$(K))return K=Va(K,Z.mode,te,null),K.return=Z,K;if(typeof K.then=="function")return de(Z,Hh(K),te);if(K.$$typeof===I)return de(Z,Bh(Z,K),te);Fh(Z,K)}return null}function se(Z,K,te,he){var He=K!==null?K.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return He!==null?null:M(Z,K,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return te.key===He?G(Z,K,te,he):null;case w:return te.key===He?ne(Z,K,te,he):null;case F:return te=Qa(te),se(Z,K,te,he)}if(T(te)||$(te))return He!==null?null:le(Z,K,te,he,null);if(typeof te.then=="function")return se(Z,K,Hh(te),he);if(te.$$typeof===I)return se(Z,K,Bh(Z,te),he);Fh(Z,te)}return null}function re(Z,K,te,he,He){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(te)||null,M(K,Z,""+he,He);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case S:return Z=Z.get(he.key===null?te:he.key)||null,G(K,Z,he,He);case w:return Z=Z.get(he.key===null?te:he.key)||null,ne(K,Z,he,He);case F:return he=Qa(he),re(Z,K,te,he,He)}if(T(he)||$(he))return Z=Z.get(te)||null,le(K,Z,he,He,null);if(typeof he.then=="function")return re(Z,K,te,Hh(he),He);if(he.$$typeof===I)return re(Z,K,te,Bh(K,he),He);Fh(K,he)}return null}function Ne(Z,K,te,he){for(var He=null,Ct=null,De=K,it=K=0,_t=null;De!==null&&it<te.length;it++){De.index>it?(_t=De,De=null):_t=De.sibling;var kt=se(Z,De,te[it],he);if(kt===null){De===null&&(De=_t);break}s&&De&&kt.alternate===null&&a(Z,De),K=_(kt,K,it),Ct===null?He=kt:Ct.sibling=kt,Ct=kt,De=_t}if(it===te.length)return l(Z,De),vt&&vr(Z,it),He;if(De===null){for(;it<te.length;it++)De=de(Z,te[it],he),De!==null&&(K=_(De,K,it),Ct===null?He=De:Ct.sibling=De,Ct=De);return vt&&vr(Z,it),He}for(De=h(De);it<te.length;it++)_t=re(De,Z,it,te[it],he),_t!==null&&(s&&_t.alternate!==null&&De.delete(_t.key===null?it:_t.key),K=_(_t,K,it),Ct===null?He=_t:Ct.sibling=_t,Ct=_t);return s&&De.forEach(function(Sa){return a(Z,Sa)}),vt&&vr(Z,it),He}function qe(Z,K,te,he){if(te==null)throw Error(i(151));for(var He=null,Ct=null,De=K,it=K=0,_t=null,kt=te.next();De!==null&&!kt.done;it++,kt=te.next()){De.index>it?(_t=De,De=null):_t=De.sibling;var Sa=se(Z,De,kt.value,he);if(Sa===null){De===null&&(De=_t);break}s&&De&&Sa.alternate===null&&a(Z,De),K=_(Sa,K,it),Ct===null?He=Sa:Ct.sibling=Sa,Ct=Sa,De=_t}if(kt.done)return l(Z,De),vt&&vr(Z,it),He;if(De===null){for(;!kt.done;it++,kt=te.next())kt=de(Z,kt.value,he),kt!==null&&(K=_(kt,K,it),Ct===null?He=kt:Ct.sibling=kt,Ct=kt);return vt&&vr(Z,it),He}for(De=h(De);!kt.done;it++,kt=te.next())kt=re(De,Z,it,kt.value,he),kt!==null&&(s&&kt.alternate!==null&&De.delete(kt.key===null?it:kt.key),K=_(kt,K,it),Ct===null?He=kt:Ct.sibling=kt,Ct=kt);return s&&De.forEach(function(a3){return a(Z,a3)}),vt&&vr(Z,it),He}function Ht(Z,K,te,he){if(typeof te=="object"&&te!==null&&te.type===x&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case S:e:{for(var He=te.key;K!==null;){if(K.key===He){if(He=te.type,He===x){if(K.tag===7){l(Z,K.sibling),he=m(K,te.props.children),he.return=Z,Z=he;break e}}else if(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===F&&Qa(He)===K.type){l(Z,K.sibling),he=m(K,te.props),wc(he,te),he.return=Z,Z=he;break e}l(Z,K);break}else a(Z,K);K=K.sibling}te.type===x?(he=Va(te.props.children,Z.mode,he,te.key),he.return=Z,Z=he):(he=Dh(te.type,te.key,te.props,null,Z.mode,he),wc(he,te),he.return=Z,Z=he)}return C(Z);case w:e:{for(He=te.key;K!==null;){if(K.key===He)if(K.tag===4&&K.stateNode.containerInfo===te.containerInfo&&K.stateNode.implementation===te.implementation){l(Z,K.sibling),he=m(K,te.children||[]),he.return=Z,Z=he;break e}else{l(Z,K);break}else a(Z,K);K=K.sibling}he=im(te,Z.mode,he),he.return=Z,Z=he}return C(Z);case F:return te=Qa(te),Ht(Z,K,te,he)}if(T(te))return Ne(Z,K,te,he);if($(te)){if(He=$(te),typeof He!="function")throw Error(i(150));return te=He.call(te),qe(Z,K,te,he)}if(typeof te.then=="function")return Ht(Z,K,Hh(te),he);if(te.$$typeof===I)return Ht(Z,K,Bh(Z,te),he);Fh(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,K!==null&&K.tag===6?(l(Z,K.sibling),he=m(K,te),he.return=Z,Z=he):(l(Z,K),he=nm(te,Z.mode,he),he.return=Z,Z=he),C(Z)):l(Z,K)}return function(Z,K,te,he){try{Sc=0;var He=Ht(Z,K,te,he);return Zo=null,He}catch(De){if(De===Xo||De===zh)throw De;var Ct=Qi(29,De,null,Z.mode);return Ct.lanes=he,Ct.return=Z,Ct}}}var to=T1(!0),A1=T1(!1),sa=!1;function mm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gm(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 ra(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function aa(s,a,l){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(At&2)!==0){var m=h.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),h.pending=a,a=Oh(s),h1(s,null,l),a}return Mh(s,h,a,l),Oh(s)}function xc(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,Fe(s,l)}}function _m(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 vm=!1;function Cc(){if(vm){var s=Yo;if(s!==null)throw s}}function kc(s,a,l,h){vm=!1;var m=s.updateQueue;sa=!1;var _=m.firstBaseUpdate,C=m.lastBaseUpdate,M=m.shared.pending;if(M!==null){m.shared.pending=null;var G=M,ne=G.next;G.next=null,C===null?_=ne:C.next=ne,C=G;var le=s.alternate;le!==null&&(le=le.updateQueue,M=le.lastBaseUpdate,M!==C&&(M===null?le.firstBaseUpdate=ne:M.next=ne,le.lastBaseUpdate=G))}if(_!==null){var de=m.baseState;C=0,le=ne=G=null,M=_;do{var se=M.lane&-536870913,re=se!==M.lane;if(re?(gt&se)===se:(h&se)===se){se!==0&&se===Vo&&(vm=!0),le!==null&&(le=le.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Ne=s,qe=M;se=a;var Ht=l;switch(qe.tag){case 1:if(Ne=qe.payload,typeof Ne=="function"){de=Ne.call(Ht,de,se);break e}de=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=qe.payload,se=typeof Ne=="function"?Ne.call(Ht,de,se):Ne,se==null)break e;de=v({},de,se);break e;case 2:sa=!0}}se=M.callback,se!==null&&(s.flags|=64,re&&(s.flags|=8192),re=m.callbacks,re===null?m.callbacks=[se]:re.push(se))}else re={lane:se,tag:M.tag,payload:M.payload,callback:M.callback,next:null},le===null?(ne=le=re,G=de):le=le.next=re,C|=se;if(M=M.next,M===null){if(M=m.shared.pending,M===null)break;re=M,M=re.next,re.next=null,m.lastBaseUpdate=re,m.shared.pending=null}}while(!0);le===null&&(G=de),m.baseState=G,m.firstBaseUpdate=ne,m.lastBaseUpdate=le,_===null&&(m.shared.lanes=0),ha|=C,s.lanes=C,s.memoizedState=de}}function R1(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function L1(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)R1(l[s],a)}var Jo=P(null),Uh=P(0);function N1(s,a){s=Rr,Q(Uh,s),Q(Jo,a),Rr=s|a.baseLanes}function ym(){Q(Uh,Rr),Q(Jo,Jo.current)}function bm(){Rr=Uh.current,X(Jo),X(Uh)}var es=P(null),Ss=null;function oa(s){var a=s.alternate;Q(Sn,Sn.current&1),Q(es,s),Ss===null&&(a===null||Jo.current!==null||a.memoizedState!==null)&&(Ss=s)}function Sm(s){Q(Sn,Sn.current),Q(es,s),Ss===null&&(Ss=s)}function M1(s){s.tag===22?(Q(Sn,Sn.current),Q(es,s),Ss===null&&(Ss=s)):la()}function la(){Q(Sn,Sn.current),Q(es,es.current)}function ts(s){X(es),Ss===s&&(Ss=null),X(Sn)}var Sn=P(0);function Wh(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Tg(l)||Ag(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 Sr=0,tt=null,zt=null,Rn=null,Gh=!1,Qo=!1,no=!1,qh=0,Ec=0,el=null,XN=0;function fn(){throw Error(i(321))}function wm(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!Ji(s[l],a[l]))return!1;return!0}function xm(s,a,l,h,m,_){return Sr=_,tt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,k.H=s===null||s.memoizedState===null?mS:Pm,no=!1,_=l(h,m),no=!1,Qo&&(_=D1(a,l,h,m)),O1(s),_}function O1(s){k.H=Rc;var a=zt!==null&&zt.next!==null;if(Sr=0,Rn=zt=tt=null,Gh=!1,Ec=0,el=null,a)throw Error(i(300));s===null||Ln||(s=s.dependencies,s!==null&&Ih(s)&&(Ln=!0))}function D1(s,a,l,h){tt=s;var m=0;do{if(Qo&&(el=null),Ec=0,Qo=!1,25<=m)throw Error(i(301));if(m+=1,Rn=zt=null,s.updateQueue!=null){var _=s.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}k.H=gS,_=a(l,h)}while(Qo);return _}function ZN(){var s=k.H,a=s.useState()[0];return a=typeof a.then=="function"?Tc(a):a,s=s.useState()[0],(zt!==null?zt.memoizedState:null)!==s&&(tt.flags|=1024),a}function Cm(){var s=qh!==0;return qh=0,s}function km(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Em(s){if(Gh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Gh=!1}Sr=0,Rn=zt=tt=null,Qo=!1,Ec=qh=0,el=null}function Si(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?tt.memoizedState=Rn=s:Rn=Rn.next=s,Rn}function wn(){if(zt===null){var s=tt.alternate;s=s!==null?s.memoizedState:null}else s=zt.next;var a=Rn===null?tt.memoizedState:Rn.next;if(a!==null)Rn=a,zt=s;else{if(s===null)throw tt.alternate===null?Error(i(467)):Error(i(310));zt=s,s={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},Rn===null?tt.memoizedState=Rn=s:Rn=Rn.next=s}return Rn}function Kh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tc(s){var a=Ec;return Ec+=1,el===null&&(el=[]),s=C1(el,s,a),a=tt,(Rn===null?a.memoizedState:Rn.next)===null&&(a=a.alternate,k.H=a===null||a.memoizedState===null?mS:Pm),s}function Vh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Tc(s);if(s.$$typeof===I)return si(s)}throw Error(i(438,String(s)))}function Tm(s){var a=null,l=tt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=tt.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=Kh(),tt.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 wr(s,a){return typeof a=="function"?a(s):a}function Yh(s){var a=wn();return Am(a,zt,s)}function Am(s,a,l){var h=s.queue;if(h===null)throw Error(i(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,G=null,ne=a,le=!1;do{var de=ne.lane&-536870913;if(de!==ne.lane?(gt&de)===de:(Sr&de)===de){var se=ne.revertLane;if(se===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),de===Vo&&(le=!0);else if((Sr&se)===se){ne=ne.next,se===Vo&&(le=!0);continue}else de={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},G===null?(M=G=de,C=_):G=G.next=de,tt.lanes|=se,ha|=se;de=ne.action,no&&l(_,de),_=ne.hasEagerState?ne.eagerState:l(_,de)}else se={lane:de,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},G===null?(M=G=se,C=_):G=G.next=se,tt.lanes|=de,ha|=de;ne=ne.next}while(ne!==null&&ne!==a);if(G===null?C=_:G.next=M,!Ji(_,s.memoizedState)&&(Ln=!0,le&&(l=Yo,l!==null)))throw l;s.memoizedState=_,s.baseState=C,s.baseQueue=G,h.lastRenderedState=_}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Rm(s){var a=wn(),l=a.queue;if(l===null)throw Error(i(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);Ji(_,a.memoizedState)||(Ln=!0),a.memoizedState=_,a.baseQueue===null&&(a.baseState=_),l.lastRenderedState=_}return[_,h]}function j1(s,a,l){var h=tt,m=wn(),_=vt;if(_){if(l===void 0)throw Error(i(407));l=l()}else l=a();var C=!Ji((zt||m).memoizedState,l);if(C&&(m.memoizedState=l,Ln=!0),m=m.queue,Mm(P1.bind(null,h,m,s),[s]),m.getSnapshot!==a||C||Rn!==null&&Rn.memoizedState.tag&1){if(h.flags|=2048,tl(9,{destroy:void 0},B1.bind(null,h,m,l,a),null),qt===null)throw Error(i(349));_||(Sr&127)!==0||I1(h,a,l)}return l}function I1(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=tt.updateQueue,a===null?(a=Kh(),tt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function B1(s,a,l,h){a.value=l,a.getSnapshot=h,z1(a)&&$1(s)}function P1(s,a,l){return l(function(){z1(a)&&$1(s)})}function z1(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!Ji(s,l)}catch{return!0}}function $1(s){var a=Ka(s,2);a!==null&&zi(a,s,2)}function Lm(s){var a=Si();if(typeof s=="function"){var l=s;if(s=l(),no){jt(!0);try{l()}finally{jt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:s},a}function H1(s,a,l,h){return s.baseState=l,Am(s,zt,typeof h=="function"?h:wr)}function JN(s,a,l,h,m){if(Jh(s))throw Error(i(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)}};k.T!==null?l(!0):_.isTransition=!1,h(_),l=a.pending,l===null?(_.next=a.pending=_,F1(a,_)):(_.next=l.next,a.pending=l.next=_)}}function F1(s,a){var l=a.action,h=a.payload,m=s.state;if(a.isTransition){var _=k.T,C={};k.T=C;try{var M=l(m,h),G=k.S;G!==null&&G(C,M),U1(s,a,M)}catch(ne){Nm(s,a,ne)}finally{_!==null&&C.types!==null&&(_.types=C.types),k.T=_}}else try{_=l(m,h),U1(s,a,_)}catch(ne){Nm(s,a,ne)}}function U1(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){W1(s,a,h)},function(h){return Nm(s,a,h)}):W1(s,a,l)}function W1(s,a,l){a.status="fulfilled",a.value=l,G1(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,F1(s,l)))}function Nm(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,G1(a),a=a.next;while(a!==h)}s.action=null}function G1(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function q1(s,a){return a}function K1(s,a){if(vt){var l=qt.formState;if(l!==null){e:{var h=tt;if(vt){if(Xt){t:{for(var m=Xt,_=bs;m.nodeType!==8;){if(!_){m=null;break t}if(m=ws(m.nextSibling),m===null){m=null;break t}}_=m.data,m=_==="F!"||_==="F"?m:null}if(m){Xt=ws(m.nextSibling),h=m.data==="F!";break e}}na(h)}h=!1}h&&(a=l[0])}}return l=Si(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q1,lastRenderedState:a},l.queue=h,l=dS.bind(null,tt,h),h.dispatch=l,h=Lm(!1),_=Bm.bind(null,tt,!1,h.queue),h=Si(),m={state:a,dispatch:null,action:s,pending:null},h.queue=m,l=JN.bind(null,tt,m,_,l),m.dispatch=l,h.memoizedState=s,[a,l,!1]}function V1(s){var a=wn();return Y1(a,zt,s)}function Y1(s,a,l){if(a=Am(s,a,q1)[0],s=Yh(wr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Tc(a)}catch(C){throw C===Xo?zh:C}else h=a;a=wn();var m=a.queue,_=m.dispatch;return l!==a.memoizedState&&(tt.flags|=2048,tl(9,{destroy:void 0},QN.bind(null,m,l),null)),[h,_,s]}function QN(s,a){s.action=a}function X1(s){var a=wn(),l=zt;if(l!==null)return Y1(a,l,s);wn(),a=a.memoizedState,l=wn();var h=l.queue.dispatch;return l.memoizedState=s,[a,h,!1]}function tl(s,a,l,h){return s={tag:s,create:l,deps:h,inst:a,next:null},a=tt.updateQueue,a===null&&(a=Kh(),tt.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 Z1(){return wn().memoizedState}function Xh(s,a,l,h){var m=Si();tt.flags|=s,m.memoizedState=tl(1|a,{destroy:void 0},l,h===void 0?null:h)}function Zh(s,a,l,h){var m=wn();h=h===void 0?null:h;var _=m.memoizedState.inst;zt!==null&&h!==null&&wm(h,zt.memoizedState.deps)?m.memoizedState=tl(a,_,l,h):(tt.flags|=s,m.memoizedState=tl(1|a,_,l,h))}function J1(s,a){Xh(8390656,8,s,a)}function Mm(s,a){Zh(2048,8,s,a)}function eM(s){tt.flags|=4;var a=tt.updateQueue;if(a===null)a=Kh(),tt.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function Q1(s){var a=wn().memoizedState;return eM({ref:a,nextImpl:s}),function(){if((At&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function eS(s,a){return Zh(4,2,s,a)}function tS(s,a){return Zh(4,4,s,a)}function nS(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 iS(s,a,l){l=l!=null?l.concat([s]):null,Zh(4,4,nS.bind(null,a,s),l)}function Om(){}function sS(s,a){var l=wn();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&wm(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function rS(s,a){var l=wn();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&wm(a,h[1]))return h[0];if(h=s(),no){jt(!0);try{s()}finally{jt(!1)}}return l.memoizedState=[h,a],h}function Dm(s,a,l){return l===void 0||(Sr&1073741824)!==0&&(gt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=aw(),tt.lanes|=s,ha|=s,l)}function aS(s,a,l,h){return Ji(l,a)?l:Jo.current!==null?(s=Dm(s,l,h),Ji(s,a)||(Ln=!0),s):(Sr&42)===0||(Sr&1073741824)!==0&&(gt&261930)===0?(Ln=!0,s.memoizedState=l):(s=aw(),tt.lanes|=s,ha|=s,a)}function oS(s,a,l,h,m){var _=j.p;j.p=_!==0&&8>_?_:8;var C=k.T,M={};k.T=M,Bm(s,!1,a,l);try{var G=m(),ne=k.S;if(ne!==null&&ne(M,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var le=YN(G,h);Ac(s,a,le,ss(s))}else Ac(s,a,h,ss(s))}catch(de){Ac(s,a,{then:function(){},status:"rejected",reason:de},ss())}finally{j.p=_,C!==null&&M.types!==null&&(C.types=M.types),k.T=C}}function tM(){}function jm(s,a,l,h){if(s.tag!==5)throw Error(i(476));var m=lS(s).queue;oS(s,m,a,B,l===null?tM:function(){return cS(s),l(h)})}function lS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:B},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function cS(s){var a=lS(s);a.next===null&&(a=s.alternate.memoizedState),Ac(s,a.next.queue,{},ss())}function Im(){return si(Gc)}function uS(){return wn().memoizedState}function hS(){return wn().memoizedState}function nM(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=ss();s=ra(l);var h=aa(a,s,l);h!==null&&(zi(h,a,l),xc(h,a,l)),a={cache:hm()},s.payload=a;return}a=a.return}}function iM(s,a,l){var h=ss();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Jh(s)?fS(a,l):(l=em(s,a,l,h),l!==null&&(zi(l,s,h),pS(l,a,h)))}function dS(s,a,l){var h=ss();Ac(s,a,l,h)}function Ac(s,a,l,h){var m={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Jh(s))fS(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,Ji(M,C))return Mh(s,a,m,0),qt===null&&Nh(),!1}catch{}if(l=em(s,a,m,h),l!==null)return zi(l,s,h),pS(l,a,h),!0}return!1}function Bm(s,a,l,h){if(h={lane:2,revertLane:mg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Jh(s)){if(a)throw Error(i(479))}else a=em(s,l,h,2),a!==null&&zi(a,s,2)}function Jh(s){var a=s.alternate;return s===tt||a!==null&&a===tt}function fS(s,a){Qo=Gh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function pS(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Fe(s,l)}}var Rc={readContext:si,use:Vh,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn};Rc.useEffectEvent=fn;var mS={readContext:si,use:Vh,useCallback:function(s,a){return Si().memoizedState=[s,a===void 0?null:a],s},useContext:si,useEffect:J1,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,Xh(4194308,4,nS.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Xh(4194308,4,s,a)},useInsertionEffect:function(s,a){Xh(4,2,s,a)},useMemo:function(s,a){var l=Si();a=a===void 0?null:a;var h=s();if(no){jt(!0);try{s()}finally{jt(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=Si();if(l!==void 0){var m=l(a);if(no){jt(!0);try{l(a)}finally{jt(!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=iM.bind(null,tt,s),[h.memoizedState,s]},useRef:function(s){var a=Si();return s={current:s},a.memoizedState=s},useState:function(s){s=Lm(s);var a=s.queue,l=dS.bind(null,tt,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Om,useDeferredValue:function(s,a){var l=Si();return Dm(l,s,a)},useTransition:function(){var s=Lm(!1);return s=oS.bind(null,tt,s.queue,!0,!1),Si().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=tt,m=Si();if(vt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),qt===null)throw Error(i(349));(gt&127)!==0||I1(h,a,l)}m.memoizedState=l;var _={value:l,getSnapshot:a};return m.queue=_,J1(P1.bind(null,h,_,s),[s]),h.flags|=2048,tl(9,{destroy:void 0},B1.bind(null,h,_,l,a),null),l},useId:function(){var s=Si(),a=qt.identifierPrefix;if(vt){var l=Xs,h=Ys;l=(h&~(1<<32-It(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=qh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=XN++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Im,useFormState:K1,useActionState:K1,useOptimistic:function(s){var a=Si();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Bm.bind(null,tt,!0,l),l.dispatch=a,[s,a]},useMemoCache:Tm,useCacheRefresh:function(){return Si().memoizedState=nM.bind(null,tt)},useEffectEvent:function(s){var a=Si(),l={impl:s};return a.memoizedState=l,function(){if((At&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Pm={readContext:si,use:Vh,useCallback:sS,useContext:si,useEffect:Mm,useImperativeHandle:iS,useInsertionEffect:eS,useLayoutEffect:tS,useMemo:rS,useReducer:Yh,useRef:Z1,useState:function(){return Yh(wr)},useDebugValue:Om,useDeferredValue:function(s,a){var l=wn();return aS(l,zt.memoizedState,s,a)},useTransition:function(){var s=Yh(wr)[0],a=wn().memoizedState;return[typeof s=="boolean"?s:Tc(s),a]},useSyncExternalStore:j1,useId:uS,useHostTransitionStatus:Im,useFormState:V1,useActionState:V1,useOptimistic:function(s,a){var l=wn();return H1(l,zt,s,a)},useMemoCache:Tm,useCacheRefresh:hS};Pm.useEffectEvent=Q1;var gS={readContext:si,use:Vh,useCallback:sS,useContext:si,useEffect:Mm,useImperativeHandle:iS,useInsertionEffect:eS,useLayoutEffect:tS,useMemo:rS,useReducer:Rm,useRef:Z1,useState:function(){return Rm(wr)},useDebugValue:Om,useDeferredValue:function(s,a){var l=wn();return zt===null?Dm(l,s,a):aS(l,zt.memoizedState,s,a)},useTransition:function(){var s=Rm(wr)[0],a=wn().memoizedState;return[typeof s=="boolean"?s:Tc(s),a]},useSyncExternalStore:j1,useId:uS,useHostTransitionStatus:Im,useFormState:X1,useActionState:X1,useOptimistic:function(s,a){var l=wn();return zt!==null?H1(l,zt,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Tm,useCacheRefresh:hS};gS.useEffectEvent=Q1;function zm(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 $m={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=ss(),m=ra(h);m.payload=a,l!=null&&(m.callback=l),a=aa(s,m,h),a!==null&&(zi(a,s,h),xc(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=ss(),m=ra(h);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=aa(s,m,h),a!==null&&(zi(a,s,h),xc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=ss(),h=ra(l);h.tag=2,a!=null&&(h.callback=a),a=aa(s,h,l),a!==null&&(zi(a,s,l),xc(a,s,l))}};function _S(s,a,l,h,m,_,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,_,C):a.prototype&&a.prototype.isPureReactComponent?!mc(l,h)||!mc(m,_):!0}function vS(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&&$m.enqueueReplaceState(a,a.state,null)}function io(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 yS(s){Lh(s)}function bS(s){console.error(s)}function SS(s){Lh(s)}function Qh(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function wS(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 Hm(s,a,l){return l=ra(l),l.tag=3,l.payload={element:null},l.callback=function(){Qh(s,a)},l}function xS(s){return s=ra(s),s.tag=3,s}function CS(s,a,l,h){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var _=h.value;s.payload=function(){return m(_)},s.callback=function(){wS(a,l,h)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){wS(a,l,h),typeof m!="function"&&(da===null?da=new Set([this]):da.add(this));var M=h.stack;this.componentDidCatch(h.value,{componentStack:M!==null?M:""})})}function sM(s,a,l,h,m){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&Ko(a,l,m,!0),l=es.current,l!==null){switch(l.tag){case 31:case 13:return Ss===null?hd():l.alternate===null&&pn===0&&(pn=3),l.flags&=-257,l.flags|=65536,l.lanes=m,h===$h?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),dg(s,h,m)),!1;case 22:return l.flags|=65536,h===$h?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)),dg(s,h,m)),!1}throw Error(i(435,l.tag))}return dg(s,h,m),hd(),!1}if(vt)return a=es.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,h!==am&&(s=Error(i(422),{cause:h}),vc(_s(s,l)))):(h!==am&&(a=Error(i(423),{cause:h}),vc(_s(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=_s(h,l),m=Hm(s.stateNode,h,m),_m(s,m),pn!==4&&(pn=2)),!1;var _=Error(i(520),{cause:h});if(_=_s(_,l),Bc===null?Bc=[_]:Bc.push(_),pn!==4&&(pn=2),a===null)return!0;h=_s(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=Hm(l.stateNode,h,s),_m(l,s),!1;case 1:if(a=l.type,_=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(da===null||!da.has(_))))return l.flags|=65536,m&=-m,l.lanes|=m,m=xS(m),CS(m,s,l,h),_m(l,m),!1}l=l.return}while(l!==null);return!1}var Fm=Error(i(461)),Ln=!1;function ri(s,a,l,h){a.child=s===null?A1(a,null,l,h):to(a,s.child,l,h)}function kS(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 Za(a),h=xm(s,a,l,C,_,m),M=Cm(),s!==null&&!Ln?(km(s,a,m),xr(s,a,m)):(vt&&M&&sm(a),a.flags|=1,ri(s,a,h,m),a.child)}function ES(s,a,l,h,m){if(s===null){var _=l.type;return typeof _=="function"&&!tm(_)&&_.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=_,TS(s,a,_,h,m)):(s=Dh(l.type,null,h,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(_=s.child,!Xm(s,m)){var C=_.memoizedProps;if(l=l.compare,l=l!==null?l:mc,l(C,h)&&s.ref===a.ref)return xr(s,a,m)}return a.flags|=1,s=_r(_,h),s.ref=a.ref,s.return=a,a.child=s}function TS(s,a,l,h,m){if(s!==null){var _=s.memoizedProps;if(mc(_,h)&&s.ref===a.ref)if(Ln=!1,a.pendingProps=h=_,Xm(s,m))(s.flags&131072)!==0&&(Ln=!0);else return a.lanes=s.lanes,xr(s,a,m)}return Um(s,a,l,h,m)}function AS(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 RS(s,a,_,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Ph(a,_!==null?_.cachePool:null),_!==null?N1(a,_):ym(),M1(a);else return h=a.lanes=536870912,RS(s,a,_!==null?_.baseLanes|l:l,l,h)}else _!==null?(Ph(a,_.cachePool),N1(a,_),la(),a.memoizedState=null):(s!==null&&Ph(a,null),ym(),la());return ri(s,a,m,l),a.child}function Lc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function RS(s,a,l,h,m){var _=fm();return _=_===null?null:{parent:An._currentValue,pool:_},a.memoizedState={baseLanes:l,cachePool:_},s!==null&&Ph(a,null),ym(),M1(a),s!==null&&Ko(s,a,h,!0),a.childLanes=m,null}function ed(s,a){return a=nd({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function LS(s,a,l){return to(a,s.child,null,l),s=ed(a,a.pendingProps),s.flags|=2,ts(a),a.memoizedState=null,s}function rM(s,a,l){var h=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(vt){if(h.mode==="hidden")return s=ed(a,h),a.lanes=536870912,Lc(null,s);if(Sm(a),(s=Xt)?(s=Fw(s,bs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ea!==null?{id:Ys,overflow:Xs}:null,retryLane:536870912,hydrationErrors:null},l=f1(s),l.return=a,a.child=l,ii=a,Xt=null)):s=null,s===null)throw na(a);return a.lanes=536870912,null}return ed(a,h)}var _=s.memoizedState;if(_!==null){var C=_.dehydrated;if(Sm(a),m)if(a.flags&256)a.flags&=-257,a=LS(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Ln||Ko(s,a,l,!1),m=(l&s.childLanes)!==0,Ln||m){if(h=qt,h!==null&&(C=Gt(h,l),C!==0&&C!==_.retryLane))throw _.retryLane=C,Ka(s,C),zi(h,s,C),Fm;hd(),a=LS(s,a,l)}else s=_.treeContext,Xt=ws(C.nextSibling),ii=a,vt=!0,ta=null,bs=!1,s!==null&&g1(a,s),a=ed(a,h),a.flags|=4096;return a}return s=_r(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function td(s,a){var l=a.ref;if(l===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function Um(s,a,l,h,m){return Za(a),l=xm(s,a,l,h,void 0,m),h=Cm(),s!==null&&!Ln?(km(s,a,m),xr(s,a,m)):(vt&&h&&sm(a),a.flags|=1,ri(s,a,l,m),a.child)}function NS(s,a,l,h,m,_){return Za(a),a.updateQueue=null,l=D1(a,h,l,m),O1(s),h=Cm(),s!==null&&!Ln?(km(s,a,_),xr(s,a,_)):(vt&&h&&sm(a),a.flags|=1,ri(s,a,l,_),a.child)}function MS(s,a,l,h,m){if(Za(a),a.stateNode===null){var _=Uo,C=l.contextType;typeof C=="object"&&C!==null&&(_=si(C)),_=new l(h,_),a.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=$m,a.stateNode=_,_._reactInternals=a,_=a.stateNode,_.props=h,_.state=a.memoizedState,_.refs={},mm(a),C=l.contextType,_.context=typeof C=="object"&&C!==null?si(C):Uo,_.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(zm(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&&$m.enqueueReplaceState(_,_.state,null),kc(a,h,_,m),Cc(),_.state=a.memoizedState),typeof _.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){_=a.stateNode;var M=a.memoizedProps,G=io(l,M);_.props=G;var ne=_.context,le=l.contextType;C=Uo,typeof le=="object"&&le!==null&&(C=si(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||ne!==C)&&vS(a,_,h,C),sa=!1;var se=a.memoizedState;_.state=se,kc(a,h,_,m),Cc(),ne=a.memoizedState,M||se!==ne||sa?(typeof de=="function"&&(zm(a,l,de,h),ne=a.memoizedState),(G=sa||_S(a,l,G,h,se,ne,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=ne),_.props=h,_.state=ne,_.context=C,h=G):(typeof _.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{_=a.stateNode,gm(s,a),C=a.memoizedProps,le=io(l,C),_.props=le,de=a.pendingProps,se=_.context,ne=l.contextType,G=Uo,typeof ne=="object"&&ne!==null&&(G=si(ne)),M=l.getDerivedStateFromProps,(ne=typeof M=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(C!==de||se!==G)&&vS(a,_,h,G),sa=!1,se=a.memoizedState,_.state=se,kc(a,h,_,m),Cc();var re=a.memoizedState;C!==de||se!==re||sa||s!==null&&s.dependencies!==null&&Ih(s.dependencies)?(typeof M=="function"&&(zm(a,l,M,h),re=a.memoizedState),(le=sa||_S(a,l,le,h,se,re,G)||s!==null&&s.dependencies!==null&&Ih(s.dependencies))?(ne||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(h,re,G),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(h,re,G)),typeof _.componentDidUpdate=="function"&&(a.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof _.componentDidUpdate!="function"||C===s.memoizedProps&&se===s.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&se===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=re),_.props=h,_.state=re,_.context=G,h=le):(typeof _.componentDidUpdate!="function"||C===s.memoizedProps&&se===s.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&se===s.memoizedState||(a.flags|=1024),h=!1)}return _=h,td(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=to(a,s.child,null,m),a.child=to(a,null,l,m)):ri(s,a,l,m),a.memoizedState=_.state,s=a.child):s=xr(s,a,m),s}function OS(s,a,l,h){return Ya(),a.flags|=256,ri(s,a,l,h),a.child}var Wm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gm(s){return{baseLanes:s,cachePool:w1()}}function qm(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=is),s}function DS(s,a,l){var h=a.pendingProps,m=!1,_=(a.flags&128)!==0,C;if((C=_)||(C=s!==null&&s.memoizedState===null?!1:(Sn.current&2)!==0),C&&(m=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,s===null){if(vt){if(m?oa(a):la(),(s=Xt)?(s=Fw(s,bs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ea!==null?{id:Ys,overflow:Xs}:null,retryLane:536870912,hydrationErrors:null},l=f1(s),l.return=a,a.child=l,ii=a,Xt=null)):s=null,s===null)throw na(a);return Ag(s)?a.lanes=32:a.lanes=536870912,null}var M=h.children;return h=h.fallback,m?(la(),m=a.mode,M=nd({mode:"hidden",children:M},m),h=Va(h,m,l,null),M.return=a,h.return=a,M.sibling=h,a.child=M,h=a.child,h.memoizedState=Gm(l),h.childLanes=qm(s,C,l),a.memoizedState=Wm,Lc(null,h)):(oa(a),Km(a,M))}var G=s.memoizedState;if(G!==null&&(M=G.dehydrated,M!==null)){if(_)a.flags&256?(oa(a),a.flags&=-257,a=Vm(s,a,l)):a.memoizedState!==null?(la(),a.child=s.child,a.flags|=128,a=null):(la(),M=h.fallback,m=a.mode,h=nd({mode:"visible",children:h.children},m),M=Va(M,m,l,null),M.flags|=2,h.return=a,M.return=a,h.sibling=M,a.child=h,to(a,s.child,null,l),h=a.child,h.memoizedState=Gm(l),h.childLanes=qm(s,C,l),a.memoizedState=Wm,a=Lc(null,h));else if(oa(a),Ag(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var ne=C.dgst;C=ne,h=Error(i(419)),h.stack="",h.digest=C,vc({value:h,source:null,stack:null}),a=Vm(s,a,l)}else if(Ln||Ko(s,a,l,!1),C=(l&s.childLanes)!==0,Ln||C){if(C=qt,C!==null&&(h=Gt(C,l),h!==0&&h!==G.retryLane))throw G.retryLane=h,Ka(s,h),zi(C,s,h),Fm;Tg(M)||hd(),a=Vm(s,a,l)}else Tg(M)?(a.flags|=192,a.child=s.child,a=null):(s=G.treeContext,Xt=ws(M.nextSibling),ii=a,vt=!0,ta=null,bs=!1,s!==null&&g1(a,s),a=Km(a,h.children),a.flags|=4096);return a}return m?(la(),M=h.fallback,m=a.mode,G=s.child,ne=G.sibling,h=_r(G,{mode:"hidden",children:h.children}),h.subtreeFlags=G.subtreeFlags&65011712,ne!==null?M=_r(ne,M):(M=Va(M,m,l,null),M.flags|=2),M.return=a,h.return=a,h.sibling=M,a.child=h,Lc(null,h),h=a.child,M=s.child.memoizedState,M===null?M=Gm(l):(m=M.cachePool,m!==null?(G=An._currentValue,m=m.parent!==G?{parent:G,pool:G}:m):m=w1(),M={baseLanes:M.baseLanes|l,cachePool:m}),h.memoizedState=M,h.childLanes=qm(s,C,l),a.memoizedState=Wm,Lc(s.child,h)):(oa(a),l=s.child,s=l.sibling,l=_r(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 Km(s,a){return a=nd({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function nd(s,a){return s=Qi(22,s,null,a),s.lanes=0,s}function Vm(s,a,l){return to(a,s.child,null,l),s=Km(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function jS(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),cm(s.return,a,l)}function Ym(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 IS(s,a,l){var h=a.pendingProps,m=h.revealOrder,_=h.tail;h=h.children;var C=Sn.current,M=(C&2)!==0;if(M?(C=C&1|2,a.flags|=128):C&=1,Q(Sn,C),ri(s,a,h,l),h=vt?_c:0,!M&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&jS(s,l,a);else if(s.tag===19)jS(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&&Wh(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),Ym(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&&Wh(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}Ym(a,!0,l,null,_,h);break;case"together":Ym(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function xr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),ha|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(Ko(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,l=_r(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=_r(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function Xm(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Ih(s)))}function aM(s,a,l){switch(a.tag){case 3:ke(a,a.stateNode.containerInfo),ia(a,An,s.memoizedState.cache),Ya();break;case 27:case 5:ct(a);break;case 4:ke(a,a.stateNode.containerInfo);break;case 10:ia(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Sm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(oa(a),a.flags|=128,null):(l&a.child.childLanes)!==0?DS(s,a,l):(oa(a),s=xr(s,a,l),s!==null?s.sibling:null);oa(a);break;case 19:var m=(s.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(Ko(s,a,l,!1),h=(l&a.childLanes)!==0),m){if(h)return IS(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Q(Sn,Sn.current),h)break;return null;case 22:return a.lanes=0,AS(s,a,l,a.pendingProps);case 24:ia(a,An,s.memoizedState.cache)}return xr(s,a,l)}function BS(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Ln=!0;else{if(!Xm(s,l)&&(a.flags&128)===0)return Ln=!1,aM(s,a,l);Ln=(s.flags&131072)!==0}else Ln=!1,vt&&(a.flags&1048576)!==0&&m1(a,_c,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=Qa(a.elementType),a.type=s,typeof s=="function")tm(s)?(h=io(s,h),a.tag=1,a=MS(null,a,s,h,l)):(a.tag=0,a=Um(null,a,s,h,l));else{if(s!=null){var m=s.$$typeof;if(m===R){a.tag=11,a=kS(null,a,s,h,l);break e}else if(m===H){a.tag=14,a=ES(null,a,s,h,l);break e}}throw a=D(s)||s,Error(i(306,a,""))}}return a;case 0:return Um(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,m=io(h,a.pendingProps),MS(s,a,h,m,l);case 3:e:{if(ke(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var _=a.memoizedState;m=_.element,gm(s,a),kc(a,h,null,l);var C=a.memoizedState;if(h=C.cache,ia(a,An,h),h!==_.cache&&um(a,[An],l,!0),Cc(),h=C.element,_.isDehydrated)if(_={element:h,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=_,a.memoizedState=_,a.flags&256){a=OS(s,a,h,l);break e}else if(h!==m){m=_s(Error(i(424)),a),vc(m),a=OS(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,Xt=ws(s.firstChild),ii=a,vt=!0,ta=null,bs=!0,l=A1(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Ya(),h===m){a=xr(s,a,l);break e}ri(s,a,h,l)}a=a.child}return a;case 26:return td(s,a),s===null?(l=Vw(a.type,null,a.pendingProps,null))?a.memoizedState=l:vt||(l=a.type,s=a.pendingProps,h=vd(me.current).createElement(l),h[Ue]=a,h[be]=s,ai(h,l,s),et(h),a.stateNode=h):a.memoizedState=Vw(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return ct(a),s===null&&vt&&(h=a.stateNode=Gw(a.type,a.pendingProps,me.current),ii=a,bs=!0,m=Xt,ga(a.type)?(Rg=m,Xt=ws(h.firstChild)):Xt=m),ri(s,a,a.pendingProps.children,l),td(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&vt&&((m=h=Xt)&&(h=IM(h,a.type,a.pendingProps,bs),h!==null?(a.stateNode=h,ii=a,Xt=ws(h.firstChild),bs=!1,m=!0):m=!1),m||na(a)),ct(a),m=a.type,_=a.pendingProps,C=s!==null?s.memoizedProps:null,h=_.children,Cg(m,_)?h=null:C!==null&&Cg(m,C)&&(a.flags|=32),a.memoizedState!==null&&(m=xm(s,a,ZN,null,null,l),Gc._currentValue=m),td(s,a),ri(s,a,h,l),a.child;case 6:return s===null&&vt&&((s=l=Xt)&&(l=BM(l,a.pendingProps,bs),l!==null?(a.stateNode=l,ii=a,Xt=null,s=!0):s=!1),s||na(a)),null;case 13:return DS(s,a,l);case 4:return ke(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=to(a,null,h,l):ri(s,a,h,l),a.child;case 11:return kS(s,a,a.type,a.pendingProps,l);case 7:return ri(s,a,a.pendingProps,l),a.child;case 8:return ri(s,a,a.pendingProps.children,l),a.child;case 12:return ri(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,ia(a,a.type,h.value),ri(s,a,h.children,l),a.child;case 9:return m=a.type._context,h=a.pendingProps.children,Za(a),m=si(m),h=h(m),a.flags|=1,ri(s,a,h,l),a.child;case 14:return ES(s,a,a.type,a.pendingProps,l);case 15:return TS(s,a,a.type,a.pendingProps,l);case 19:return IS(s,a,l);case 31:return rM(s,a,l);case 22:return AS(s,a,l,a.pendingProps);case 24:return Za(a),h=si(An),s===null?(m=fm(),m===null&&(m=qt,_=hm(),m.pooledCache=_,_.refCount++,_!==null&&(m.pooledCacheLanes|=l),m=_),a.memoizedState={parent:h,cache:m},mm(a),ia(a,An,m)):((s.lanes&l)!==0&&(gm(s,a),kc(a,null,null,l),Cc()),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),ia(a,An,h)):(h=_.cache,ia(a,An,h),h!==m.cache&&um(a,[An],l,!0))),ri(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Cr(s){s.flags|=4}function Zm(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(uw())s.flags|=8192;else throw eo=$h,pm}else s.flags&=-16777217}function PS(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Qw(a))if(uw())s.flags|=8192;else throw eo=$h,pm}function id(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?ze():536870912,s.lanes|=a,rl|=a)}function Nc(s,a){if(!vt)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 Zt(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 oM(s,a,l){var h=a.pendingProps;switch(rm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(a),null;case 1:return Zt(a),null;case 3:return l=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),br(An),Le(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(qo(a)?Cr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,om())),Zt(a),null;case 26:var m=a.type,_=a.memoizedState;return s===null?(Cr(a),_!==null?(Zt(a),PS(a,_)):(Zt(a),Zm(a,m,null,h,l))):_?_!==s.memoizedState?(Cr(a),Zt(a),PS(a,_)):(Zt(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Cr(a),Zt(a),Zm(a,m,s,h,l)),null;case 27:if(je(a),l=me.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Cr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Zt(a),null}s=Y.current,qo(a)?_1(a):(s=Gw(m,h,l),a.stateNode=s,Cr(a))}return Zt(a),null;case 5:if(je(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Cr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Zt(a),null}if(_=Y.current,qo(a))_1(a);else{var C=vd(me.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)}}_[Ue]=a,_[be]=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(ai(_,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&&Cr(a)}}return Zt(a),Zm(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Cr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=me.current,qo(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,m=ii,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Ue]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||Dw(s.nodeValue,l)),s||na(a,!0)}else s=vd(s).createTextNode(h),s[Ue]=a,a.stateNode=s}return Zt(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(h=qo(a),l!==null){if(s===null){if(!h)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Ue]=a}else Ya(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Zt(a),s=!1}else l=om(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(ts(a),a):(ts(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Zt(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=qo(a),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Ue]=a}else Ya(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Zt(a),m=!1}else m=om(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(ts(a),a):(ts(a),null)}return ts(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),id(a,a.updateQueue),Zt(a),null);case 4:return Le(),s===null&&yg(a.stateNode.containerInfo),Zt(a),null;case 10:return br(a.type),Zt(a),null;case 19:if(X(Sn),h=a.memoizedState,h===null)return Zt(a),null;if(m=(a.flags&128)!==0,_=h.rendering,_===null)if(m)Nc(h,!1);else{if(pn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(_=Wh(s),_!==null){for(a.flags|=128,Nc(h,!1),s=_.updateQueue,a.updateQueue=s,id(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)d1(l,s),l=l.sibling;return Q(Sn,Sn.current&1|2),vt&&vr(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&ut()>ld&&(a.flags|=128,m=!0,Nc(h,!1),a.lanes=4194304)}else{if(!m)if(s=Wh(_),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,id(a,s),Nc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!_.alternate&&!vt)return Zt(a),null}else 2*ut()-h.renderingStartTime>ld&&l!==536870912&&(a.flags|=128,m=!0,Nc(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=ut(),s.sibling=null,l=Sn.current,Q(Sn,m?l&1|2:l&1),vt&&vr(a,h.treeForkCount),s):(Zt(a),null);case 22:case 23:return ts(a),bm(),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&&(Zt(a),a.subtreeFlags&6&&(a.flags|=8192)):Zt(a),l=a.updateQueue,l!==null&&id(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&&X(Ja),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),br(An),Zt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function lM(s,a){switch(rm(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return br(An),Le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return je(a),null;case 31:if(a.memoizedState!==null){if(ts(a),a.alternate===null)throw Error(i(340));Ya()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(ts(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Ya()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return X(Sn),null;case 4:return Le(),null;case 10:return br(a.type),null;case 22:case 23:return ts(a),bm(),s!==null&&X(Ja),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return br(An),null;case 25:return null;default:return null}}function zS(s,a){switch(rm(a),a.tag){case 3:br(An),Le();break;case 26:case 27:case 5:je(a);break;case 4:Le();break;case 31:a.memoizedState!==null&&ts(a);break;case 13:ts(a);break;case 19:X(Sn);break;case 10:br(a.type);break;case 22:case 23:ts(a),bm(),s!==null&&X(Ja);break;case 24:br(An)}}function Mc(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){Dt(a,a.return,M)}}function ca(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 G=l,ne=M;try{ne()}catch(le){Dt(m,G,le)}}}h=h.next}while(h!==_)}}catch(le){Dt(a,a.return,le)}}function $S(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{L1(a,l)}catch(h){Dt(s,s.return,h)}}}function HS(s,a,l){l.props=io(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){Dt(s,a,h)}}function Oc(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){Dt(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){Dt(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){Dt(s,a,m)}else l.current=null}function FS(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){Dt(s,s.return,m)}}function Jm(s,a,l){try{var h=s.stateNode;LM(h,s.type,l,a),h[be]=a}catch(m){Dt(s,s.return,m)}}function US(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ga(s.type)||s.tag===4}function Qm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||US(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&&ga(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 eg(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=xe));else if(h!==4&&(h===27&&ga(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(eg(s,a,l),s=s.sibling;s!==null;)eg(s,a,l),s=s.sibling}function sd(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&&ga(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(sd(s,a,l),s=s.sibling;s!==null;)sd(s,a,l),s=s.sibling}function WS(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);ai(a,h,l),a[Ue]=s,a[be]=l}catch(_){Dt(s,s.return,_)}}var kr=!1,Nn=!1,tg=!1,GS=typeof WeakSet=="function"?WeakSet:Set,Un=null;function cM(s,a){if(s=s.containerInfo,wg=kd,s=i1(s),Vp(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,G=-1,ne=0,le=0,de=s,se=null;t:for(;;){for(var re;de!==l||m!==0&&de.nodeType!==3||(M=C+m),de!==_||h!==0&&de.nodeType!==3||(G=C+h),de.nodeType===3&&(C+=de.nodeValue.length),(re=de.firstChild)!==null;)se=de,de=re;for(;;){if(de===s)break t;if(se===l&&++ne===m&&(M=C),se===_&&++le===h&&(G=C),(re=de.nextSibling)!==null)break;de=se,se=de.parentNode}de=re}l=M===-1||G===-1?null:{start:M,end:G}}else l=null}l=l||{start:0,end:0}}else l=null;for(xg={focusedElem:s,selectionRange:l},kd=!1,Un=a;Un!==null;)if(a=Un,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Un=s;else for(;Un!==null;){switch(a=Un,_=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=io(l.type,m);s=h.getSnapshotBeforeUpdate(Ne,_),h.__reactInternalSnapshotBeforeUpdate=s}catch(qe){Dt(l,l.return,qe)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Eg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Eg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,Un=s;break}Un=a.return}}function qS(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Tr(s,l),h&4&&Mc(5,l);break;case 1:if(Tr(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(C){Dt(l,l.return,C)}else{var m=io(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(C){Dt(l,l.return,C)}}h&64&&$S(l),h&512&&Oc(l,l.return);break;case 3:if(Tr(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{L1(s,a)}catch(C){Dt(l,l.return,C)}}break;case 27:a===null&&h&4&&WS(l);case 26:case 5:Tr(s,l),a===null&&h&4&&FS(l),h&512&&Oc(l,l.return);break;case 12:Tr(s,l);break;case 31:Tr(s,l),h&4&&YS(s,l);break;case 13:Tr(s,l),h&4&&XS(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=vM.bind(null,l),PM(s,l))));break;case 22:if(h=l.memoizedState!==null||kr,!h){a=a!==null&&a.memoizedState!==null||Nn,m=kr;var _=Nn;kr=h,(Nn=a)&&!_?Ar(s,l,(l.subtreeFlags&8772)!==0):Tr(s,l),kr=m,Nn=_}break;case 30:break;default:Tr(s,l)}}function KS(s){var a=s.alternate;a!==null&&(s.alternate=null,KS(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 on=null,ji=!1;function Er(s,a,l){for(l=l.child;l!==null;)VS(s,a,l),l=l.sibling}function VS(s,a,l){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(fi,l)}catch{}switch(l.tag){case 26:Nn||Zs(l,a),Er(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Nn||Zs(l,a);var h=on,m=ji;ga(l.type)&&(on=l.stateNode,ji=!1),Er(s,a,l),Fc(l.stateNode),on=h,ji=m;break;case 5:Nn||Zs(l,a);case 6:if(h=on,m=ji,on=null,Er(s,a,l),on=h,ji=m,on!==null)if(ji)try{(on.nodeType===9?on.body:on.nodeName==="HTML"?on.ownerDocument.body:on).removeChild(l.stateNode)}catch(_){Dt(l,a,_)}else try{on.removeChild(l.stateNode)}catch(_){Dt(l,a,_)}break;case 18:on!==null&&(ji?(s=on,$w(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),fl(s)):$w(on,l.stateNode));break;case 4:h=on,m=ji,on=l.stateNode.containerInfo,ji=!0,Er(s,a,l),on=h,ji=m;break;case 0:case 11:case 14:case 15:ca(2,l,a),Nn||ca(4,l,a),Er(s,a,l);break;case 1:Nn||(Zs(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&HS(l,a,h)),Er(s,a,l);break;case 21:Er(s,a,l);break;case 22:Nn=(h=Nn)||l.memoizedState!==null,Er(s,a,l),Nn=h;break;default:Er(s,a,l)}}function YS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{fl(s)}catch(l){Dt(a,a.return,l)}}}function XS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{fl(s)}catch(l){Dt(a,a.return,l)}}function uM(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new GS),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new GS),a;default:throw Error(i(435,s.tag))}}function rd(s,a){var l=uM(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var m=yM.bind(null,s,h);h.then(m,m)}})}function Ii(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(ga(M.type)){on=M.stateNode,ji=!1;break e}break;case 5:on=M.stateNode,ji=!1;break e;case 3:case 4:on=M.stateNode.containerInfo,ji=!0;break e}M=M.return}if(on===null)throw Error(i(160));VS(_,C,m),on=null,ji=!1,_=m.alternate,_!==null&&(_.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)ZS(a,s),a=a.sibling}var Bs=null;function ZS(s,a){var l=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ii(a,s),Bi(s),h&4&&(ca(3,s,s.return),Mc(3,s),ca(5,s,s.return));break;case 1:Ii(a,s),Bi(s),h&512&&(Nn||l===null||Zs(l,l.return)),h&64&&kr&&(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=Bs;if(Ii(a,s),Bi(s),h&512&&(Nn||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],(!_||_[mi]||_[Ue]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=m.createElement(h),m.head.insertBefore(_,m.querySelector("head > title"))),ai(_,h,l),_[Ue]=s,et(_),h=_;break e;case"link":var C=Zw("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),ai(_,h,l),m.head.appendChild(_);break;case"meta":if(C=Zw("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),ai(_,h,l),m.head.appendChild(_);break;default:throw Error(i(468,h))}_[Ue]=s,et(_),h=_}s.stateNode=h}else Jw(m,s.type,s.stateNode);else s.stateNode=Xw(m,h,s.memoizedProps);else _!==h?(_===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):_.count--,h===null?Jw(m,s.type,s.stateNode):Xw(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Jm(s,s.memoizedProps,l.memoizedProps)}break;case 27:Ii(a,s),Bi(s),h&512&&(Nn||l===null||Zs(l,l.return)),l!==null&&h&4&&Jm(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Ii(a,s),Bi(s),h&512&&(Nn||l===null||Zs(l,l.return)),s.flags&32){m=s.stateNode;try{Ke(m,"")}catch(Ne){Dt(s,s.return,Ne)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,Jm(s,m,l!==null?l.memoizedProps:m)),h&1024&&(tg=!0);break;case 6:if(Ii(a,s),Bi(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,l=s.stateNode;try{l.nodeValue=h}catch(Ne){Dt(s,s.return,Ne)}}break;case 3:if(Sd=null,m=Bs,Bs=yd(a.containerInfo),Ii(a,s),Bs=m,Bi(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{fl(a.containerInfo)}catch(Ne){Dt(s,s.return,Ne)}tg&&(tg=!1,JS(s));break;case 4:h=Bs,Bs=yd(s.stateNode.containerInfo),Ii(a,s),Bi(s),Bs=h;break;case 12:Ii(a,s),Bi(s);break;case 31:Ii(a,s),Bi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,rd(s,h)));break;case 13:Ii(a,s),Bi(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(od=ut()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,rd(s,h)));break;case 22:m=s.memoizedState!==null;var G=l!==null&&l.memoizedState!==null,ne=kr,le=Nn;if(kr=ne||m,Nn=le||G,Ii(a,s),Nn=le,kr=ne,Bi(s),h&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||G||kr||Nn||so(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){G=l=a;try{if(_=G.stateNode,m)C=_.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{M=G.stateNode;var de=G.memoizedProps.style,se=de!=null&&de.hasOwnProperty("display")?de.display:null;M.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ne){Dt(G,G.return,Ne)}}}else if(a.tag===6){if(l===null){G=a;try{G.stateNode.nodeValue=m?"":G.memoizedProps}catch(Ne){Dt(G,G.return,Ne)}}}else if(a.tag===18){if(l===null){G=a;try{var re=G.stateNode;m?Hw(re,!0):Hw(G.stateNode,!1)}catch(Ne){Dt(G,G.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,rd(s,l))));break;case 19:Ii(a,s),Bi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,rd(s,h)));break;case 30:break;case 21:break;default:Ii(a,s),Bi(s)}}function Bi(s){var a=s.flags;if(a&2){try{for(var l,h=s.return;h!==null;){if(US(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,_=Qm(s);sd(s,_,m);break;case 5:var C=l.stateNode;l.flags&32&&(Ke(C,""),l.flags&=-33);var M=Qm(s);sd(s,M,C);break;case 3:case 4:var G=l.stateNode.containerInfo,ne=Qm(s);eg(s,ne,G);break;default:throw Error(i(161))}}catch(le){Dt(s,s.return,le)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function JS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;JS(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Tr(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)qS(s,a.alternate,a),a=a.sibling}function so(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ca(4,a,a.return),so(a);break;case 1:Zs(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&HS(a,a.return,l),so(a);break;case 27:Fc(a.stateNode);case 26:case 5:Zs(a,a.return),so(a);break;case 22:a.memoizedState===null&&so(a);break;case 30:so(a);break;default:so(a)}s=s.sibling}}function Ar(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:Ar(m,_,l),Mc(4,_);break;case 1:if(Ar(m,_,l),h=_,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ne){Dt(h,h.return,ne)}if(h=_,m=h.updateQueue,m!==null){var M=h.stateNode;try{var G=m.shared.hiddenCallbacks;if(G!==null)for(m.shared.hiddenCallbacks=null,m=0;m<G.length;m++)R1(G[m],M)}catch(ne){Dt(h,h.return,ne)}}l&&C&64&&$S(_),Oc(_,_.return);break;case 27:WS(_);case 26:case 5:Ar(m,_,l),l&&h===null&&C&4&&FS(_),Oc(_,_.return);break;case 12:Ar(m,_,l);break;case 31:Ar(m,_,l),l&&C&4&&YS(m,_);break;case 13:Ar(m,_,l),l&&C&4&&XS(m,_);break;case 22:_.memoizedState===null&&Ar(m,_,l),Oc(_,_.return);break;case 30:break;default:Ar(m,_,l)}a=a.sibling}}function ng(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&&yc(l))}function ig(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&yc(s))}function Ps(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)QS(s,a,l,h),a=a.sibling}function QS(s,a,l,h){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Ps(s,a,l,h),m&2048&&Mc(9,a);break;case 1:Ps(s,a,l,h);break;case 3:Ps(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&&yc(s)));break;case 12:if(m&2048){Ps(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(G){Dt(a,a.return,G)}}else Ps(s,a,l,h);break;case 31:Ps(s,a,l,h);break;case 13:Ps(s,a,l,h);break;case 23:break;case 22:_=a.stateNode,C=a.alternate,a.memoizedState!==null?_._visibility&2?Ps(s,a,l,h):Dc(s,a):_._visibility&2?Ps(s,a,l,h):(_._visibility|=2,nl(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),m&2048&&ng(C,a);break;case 24:Ps(s,a,l,h),m&2048&&ig(a.alternate,a);break;default:Ps(s,a,l,h)}}function nl(s,a,l,h,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var _=s,C=a,M=l,G=h,ne=C.flags;switch(C.tag){case 0:case 11:case 15:nl(_,C,M,G,m),Mc(8,C);break;case 23:break;case 22:var le=C.stateNode;C.memoizedState!==null?le._visibility&2?nl(_,C,M,G,m):Dc(_,C):(le._visibility|=2,nl(_,C,M,G,m)),m&&ne&2048&&ng(C.alternate,C);break;case 24:nl(_,C,M,G,m),m&&ne&2048&&ig(C.alternate,C);break;default:nl(_,C,M,G,m)}a=a.sibling}}function Dc(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:Dc(l,h),m&2048&&ng(h.alternate,h);break;case 24:Dc(l,h),m&2048&&ig(h.alternate,h);break;default:Dc(l,h)}a=a.sibling}}var jc=8192;function il(s,a,l){if(s.subtreeFlags&jc)for(s=s.child;s!==null;)ew(s,a,l),s=s.sibling}function ew(s,a,l){switch(s.tag){case 26:il(s,a,l),s.flags&jc&&s.memoizedState!==null&&XM(l,Bs,s.memoizedState,s.memoizedProps);break;case 5:il(s,a,l);break;case 3:case 4:var h=Bs;Bs=yd(s.stateNode.containerInfo),il(s,a,l),Bs=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=jc,jc=16777216,il(s,a,l),jc=h):il(s,a,l));break;default:il(s,a,l)}}function tw(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 Ic(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];Un=h,iw(h,s)}tw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)nw(s),s=s.sibling}function nw(s){switch(s.tag){case 0:case 11:case 15:Ic(s),s.flags&2048&&ca(9,s,s.return);break;case 3:Ic(s);break;case 12:Ic(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,ad(s)):Ic(s);break;default:Ic(s)}}function ad(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];Un=h,iw(h,s)}tw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ca(8,a,a.return),ad(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,ad(a));break;default:ad(a)}s=s.sibling}}function iw(s,a){for(;Un!==null;){var l=Un;switch(l.tag){case 0:case 11:case 15:ca(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:yc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,Un=h;else e:for(l=s;Un!==null;){h=Un;var m=h.sibling,_=h.return;if(KS(h),h===l){Un=null;break e}if(m!==null){m.return=_,Un=m;break e}Un=_}}}var hM={getCacheForType:function(s){var a=si(An),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return si(An).controller.signal}},dM=typeof WeakMap=="function"?WeakMap:Map,At=0,qt=null,dt=null,gt=0,Ot=0,ns=null,ua=!1,sl=!1,sg=!1,Rr=0,pn=0,ha=0,ro=0,rg=0,is=0,rl=0,Bc=null,Pi=null,ag=!1,od=0,sw=0,ld=1/0,cd=null,da=null,Bn=0,fa=null,al=null,Lr=0,og=0,lg=null,rw=null,Pc=0,cg=null;function ss(){return(At&2)!==0&>!==0?gt&-gt:k.T!==null?mg():ue()}function aw(){if(is===0)if((gt&536870912)===0||vt){var s=ps;ps<<=1,(ps&3932160)===0&&(ps=262144),is=s}else is=536870912;return s=es.current,s!==null&&(s.flags|=32),is}function zi(s,a,l){(s===qt&&(Ot===2||Ot===9)||s.cancelPendingCommit!==null)&&(ol(s,0),pa(s,gt,is,!1)),St(s,l),((At&2)===0||s!==qt)&&(s===qt&&((At&2)===0&&(ro|=l),pn===4&&pa(s,gt,is,!1)),Js(s))}function ow(s,a,l){if((At&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||ce(s,a),m=h?mM(s,a):hg(s,a,!0),_=h;do{if(m===0){sl&&!h&&pa(s,a,0,!1);break}else{if(l=s.current.alternate,_&&!fM(l)){m=hg(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=Bc;var G=M.current.memoizedState.isDehydrated;if(G&&(ol(M,C).flags|=256),C=hg(M,C,!1),C!==2){if(sg&&!G){M.errorRecoveryDisabledLanes|=_,ro|=_,m=4;break e}_=Pi,Pi=m,_!==null&&(Pi===null?Pi=_:Pi.push.apply(Pi,_))}m=C}if(_=!1,m!==2)continue}}if(m===1){ol(s,0),pa(s,a,0,!0);break}e:{switch(h=s,_=m,_){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:pa(h,a,is,!ua);break e;case 2:Pi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=od+300-ut(),10<m)){if(pa(h,a,is,!ua),W(h,0,!0)!==0)break e;Lr=a,h.timeoutHandle=Pw(lw.bind(null,h,l,Pi,cd,ag,a,is,ro,rl,ua,_,"Throttled",-0,0),m);break e}lw(h,l,Pi,cd,ag,a,is,ro,rl,ua,_,null,-0,0)}}break}while(!0);Js(s)}function lw(s,a,l,h,m,_,C,M,G,ne,le,de,se,re){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:xe},ew(a,_,de);var Ne=(_&62914560)===_?od-ut():(_&4194048)===_?sw-ut():0;if(Ne=ZM(de,Ne),Ne!==null){Lr=_,s.cancelPendingCommit=Ne(gw.bind(null,s,a,_,l,h,m,C,M,G,le,de,null,se,re)),pa(s,_,C,!ne);return}}gw(s,a,_,l,h,m,C,M,G)}function fM(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(!Ji(_(),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 pa(s,a,l,h){a&=~rg,a&=~ro,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var m=a;0<m;){var _=31-It(m),C=1<<_;h[_]=-1,m&=~C}l!==0&&Ee(s,l,a)}function ud(){return(At&6)===0?(zc(0),!1):!0}function ug(){if(dt!==null){if(Ot===0)var s=dt.return;else s=dt,yr=Xa=null,Em(s),Zo=null,Sc=0,s=dt;for(;s!==null;)zS(s.alternate,s),s=s.return;dt=null}}function ol(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,OM(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Lr=0,ug(),qt=s,dt=l=_r(s.current,null),gt=a,Ot=0,ns=null,ua=!1,sl=ce(s,a),sg=!1,rl=is=rg=ro=ha=pn=0,Pi=Bc=null,ag=!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-It(h),_=1<<m;a|=s[m],h&=~_}return Rr=a,Nh(),l}function cw(s,a){tt=null,k.H=Rc,a===Xo||a===zh?(a=k1(),Ot=3):a===pm?(a=k1(),Ot=4):Ot=a===Fm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ns=a,dt===null&&(pn=1,Qh(s,_s(a,s.current)))}function uw(){var s=es.current;return s===null?!0:(gt&4194048)===gt?Ss===null:(gt&62914560)===gt||(gt&536870912)!==0?s===Ss:!1}function hw(){var s=k.H;return k.H=Rc,s===null?Rc:s}function dw(){var s=k.A;return k.A=hM,s}function hd(){pn=4,ua||(gt&4194048)!==gt&&es.current!==null||(sl=!0),(ha&134217727)===0&&(ro&134217727)===0||qt===null||pa(qt,gt,is,!1)}function hg(s,a,l){var h=At;At|=2;var m=hw(),_=dw();(qt!==s||gt!==a)&&(cd=null,ol(s,a)),a=!1;var C=pn;e:do try{if(Ot!==0&&dt!==null){var M=dt,G=ns;switch(Ot){case 8:ug(),C=6;break e;case 3:case 2:case 9:case 6:es.current===null&&(a=!0);var ne=Ot;if(Ot=0,ns=null,ll(s,M,G,ne),l&&sl){C=0;break e}break;default:ne=Ot,Ot=0,ns=null,ll(s,M,G,ne)}}pM(),C=pn;break}catch(le){cw(s,le)}while(!0);return a&&s.shellSuspendCounter++,yr=Xa=null,At=h,k.H=m,k.A=_,dt===null&&(qt=null,gt=0,Nh()),C}function pM(){for(;dt!==null;)fw(dt)}function mM(s,a){var l=At;At|=2;var h=hw(),m=dw();qt!==s||gt!==a?(cd=null,ld=ut()+500,ol(s,a)):sl=ce(s,a);e:do try{if(Ot!==0&&dt!==null){a=dt;var _=ns;t:switch(Ot){case 1:Ot=0,ns=null,ll(s,a,_,1);break;case 2:case 9:if(x1(_)){Ot=0,ns=null,pw(a);break}a=function(){Ot!==2&&Ot!==9||qt!==s||(Ot=7),Js(s)},_.then(a,a);break e;case 3:Ot=7;break e;case 4:Ot=5;break e;case 7:x1(_)?(Ot=0,ns=null,pw(a)):(Ot=0,ns=null,ll(s,a,_,7));break;case 5:var C=null;switch(dt.tag){case 26:C=dt.memoizedState;case 5:case 27:var M=dt;if(C?Qw(C):M.stateNode.complete){Ot=0,ns=null;var G=M.sibling;if(G!==null)dt=G;else{var ne=M.return;ne!==null?(dt=ne,dd(ne)):dt=null}break t}}Ot=0,ns=null,ll(s,a,_,5);break;case 6:Ot=0,ns=null,ll(s,a,_,6);break;case 8:ug(),pn=6;break e;default:throw Error(i(462))}}gM();break}catch(le){cw(s,le)}while(!0);return yr=Xa=null,k.H=h,k.A=m,At=l,dt!==null?0:(qt=null,gt=0,Nh(),pn)}function gM(){for(;dt!==null&&!_e();)fw(dt)}function fw(s){var a=BS(s.alternate,s,Rr);s.memoizedProps=s.pendingProps,a===null?dd(s):dt=a}function pw(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=NS(l,a,a.pendingProps,a.type,void 0,gt);break;case 11:a=NS(l,a,a.pendingProps,a.type.render,a.ref,gt);break;case 5:Em(a);default:zS(l,a),a=dt=d1(a,Rr),a=BS(l,a,Rr)}s.memoizedProps=s.pendingProps,a===null?dd(s):dt=a}function ll(s,a,l,h){yr=Xa=null,Em(a),Zo=null,Sc=0;var m=a.return;try{if(sM(s,m,a,l,gt)){pn=1,Qh(s,_s(l,s.current)),dt=null;return}}catch(_){if(m!==null)throw dt=m,_;pn=1,Qh(s,_s(l,s.current)),dt=null;return}a.flags&32768?(vt||h===1?s=!0:sl||(gt&536870912)!==0?s=!1:(ua=s=!0,(h===2||h===9||h===3||h===6)&&(h=es.current,h!==null&&h.tag===13&&(h.flags|=16384))),mw(a,s)):dd(a)}function dd(s){var a=s;do{if((a.flags&32768)!==0){mw(a,ua);return}s=a.return;var l=oM(a.alternate,a,Rr);if(l!==null){dt=l;return}if(a=a.sibling,a!==null){dt=a;return}dt=a=s}while(a!==null);pn===0&&(pn=5)}function mw(s,a){do{var l=lM(s.alternate,s);if(l!==null){l.flags&=32767,dt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){dt=s;return}dt=s=l}while(s!==null);pn=6,dt=null}function gw(s,a,l,h,m,_,C,M,G){s.cancelPendingCommit=null;do fd();while(Bn!==0);if((At&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(_=a.lanes|a.childLanes,_|=Qp,Re(s,l,_,C,M,G),s===qt&&(dt=qt=null,gt=0),al=a,fa=s,Lr=l,og=_,lg=m,rw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,bM(Ni,function(){return Sw(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=k.T,k.T=null,m=j.p,j.p=2,C=At,At|=4;try{cM(s,a,l)}finally{At=C,j.p=m,k.T=h}}Bn=1,_w(),vw(),yw()}}function _w(){if(Bn===1){Bn=0;var s=fa,a=al,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var h=j.p;j.p=2;var m=At;At|=4;try{ZS(a,s);var _=xg,C=i1(s.containerInfo),M=_.focusedElem,G=_.selectionRange;if(C!==M&&M&&M.ownerDocument&&n1(M.ownerDocument.documentElement,M)){if(G!==null&&Vp(M)){var ne=G.start,le=G.end;if(le===void 0&&(le=ne),"selectionStart"in M)M.selectionStart=ne,M.selectionEnd=Math.min(le,M.value.length);else{var de=M.ownerDocument||document,se=de&&de.defaultView||window;if(se.getSelection){var re=se.getSelection(),Ne=M.textContent.length,qe=Math.min(G.start,Ne),Ht=G.end===void 0?qe:Math.min(G.end,Ne);!re.extend&&qe>Ht&&(C=Ht,Ht=qe,qe=C);var Z=t1(M,qe),K=t1(M,Ht);if(Z&&K&&(re.rangeCount!==1||re.anchorNode!==Z.node||re.anchorOffset!==Z.offset||re.focusNode!==K.node||re.focusOffset!==K.offset)){var te=de.createRange();te.setStart(Z.node,Z.offset),re.removeAllRanges(),qe>Ht?(re.addRange(te),re.extend(K.node,K.offset)):(te.setEnd(K.node,K.offset),re.addRange(te))}}}}for(de=[],re=M;re=re.parentNode;)re.nodeType===1&&de.push({element:re,left:re.scrollLeft,top:re.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}}kd=!!wg,xg=wg=null}finally{At=m,j.p=h,k.T=l}}s.current=a,Bn=2}}function vw(){if(Bn===2){Bn=0;var s=fa,a=al,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var h=j.p;j.p=2;var m=At;At|=4;try{qS(s,a.alternate,a)}finally{At=m,j.p=h,k.T=l}}Bn=3}}function yw(){if(Bn===4||Bn===3){Bn=0,We();var s=fa,a=al,l=Lr,h=rw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Bn=5:(Bn=0,al=fa=null,bw(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(da=null),En(l),a=a.stateNode,Yt&&typeof Yt.onCommitFiberRoot=="function")try{Yt.onCommitFiberRoot(fi,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=k.T,m=j.p,j.p=2,k.T=null;try{for(var _=s.onRecoverableError,C=0;C<h.length;C++){var M=h[C];_(M.value,{componentStack:M.stack})}}finally{k.T=a,j.p=m}}(Lr&3)!==0&&fd(),Js(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===cg?Pc++:(Pc=0,cg=s):Pc=0,zc(0)}}function bw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,yc(a)))}function fd(){return _w(),vw(),yw(),Sw()}function Sw(){if(Bn!==5)return!1;var s=fa,a=og;og=0;var l=En(Lr),h=k.T,m=j.p;try{j.p=32>l?32:l,k.T=null,l=lg,lg=null;var _=fa,C=Lr;if(Bn=0,al=fa=null,Lr=0,(At&6)!==0)throw Error(i(331));var M=At;if(At|=4,nw(_.current),QS(_,_.current,C,l),At=M,zc(0,!1),Yt&&typeof Yt.onPostCommitFiberRoot=="function")try{Yt.onPostCommitFiberRoot(fi,_)}catch{}return!0}finally{j.p=m,k.T=h,bw(s,a)}}function ww(s,a,l){a=_s(l,a),a=Hm(s.stateNode,a,2),s=aa(s,a,2),s!==null&&(St(s,2),Js(s))}function Dt(s,a,l){if(s.tag===3)ww(s,s,l);else for(;a!==null;){if(a.tag===3){ww(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(da===null||!da.has(h))){s=_s(l,s),l=xS(2),h=aa(a,l,2),h!==null&&(CS(l,h,a,s),St(h,2),Js(h));break}}a=a.return}}function dg(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new dM;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)||(sg=!0,m.add(l),s=_M.bind(null,s,a,l),a.then(s,s))}function _M(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,qt===s&&(gt&l)===l&&(pn===4||pn===3&&(gt&62914560)===gt&&300>ut()-od?(At&2)===0&&ol(s,0):rg|=l,rl===gt&&(rl=0)),Js(s)}function xw(s,a){a===0&&(a=ze()),s=Ka(s,a),s!==null&&(St(s,a),Js(s))}function vM(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),xw(s,l)}function yM(s,a){var l=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(l=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),xw(s,l)}function bM(s,a){return nn(s,a)}var pd=null,cl=null,fg=!1,md=!1,pg=!1,ma=0;function Js(s){s!==cl&&s.next===null&&(cl===null?pd=cl=s:cl=cl.next=s),md=!0,fg||(fg=!0,wM())}function zc(s,a){if(!pg&&md){pg=!0;do for(var l=!1,h=pd;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var _=0;else{var C=h.suspendedLanes,M=h.pingedLanes;_=(1<<31-It(42|s)+1)-1,_&=m&~(C&~M),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(l=!0,Tw(h,_))}else _=gt,_=W(h,h===qt?_:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(_&3)===0||ce(h,_)||(l=!0,Tw(h,_));h=h.next}while(l);pg=!1}}function SM(){Cw()}function Cw(){md=fg=!1;var s=0;ma!==0&&MM()&&(s=ma);for(var a=ut(),l=null,h=pd;h!==null;){var m=h.next,_=kw(h,a);_===0?(h.next=null,l===null?pd=m:l.next=m,m===null&&(cl=l)):(l=h,(s!==0||(_&3)!==0)&&(md=!0)),h=m}Bn!==0&&Bn!==5||zc(s),ma!==0&&(ma=0)}function kw(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var C=31-It(_),M=1<<C,G=m[C];G===-1?((M&l)===0||(M&h)!==0)&&(m[C]=ve(M,a)):G<=a&&(s.expiredLanes|=M),_&=~M}if(a=qt,l=gt,l=W(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(Ot===2||Ot===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Be(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&&Be(h),En(l)){case 2:case 8:l=kn;break;case 32:l=Ni;break;case 268435456:l=Ki;break;default:l=Ni}return h=Ew.bind(null,s),l=nn(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&Be(h),s.callbackPriority=2,s.callbackNode=null,2}function Ew(s,a){if(Bn!==0&&Bn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(fd()&&s.callbackNode!==l)return null;var h=gt;return h=W(s,s===qt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(ow(s,h,a),kw(s,ut()),s.callbackNode!=null&&s.callbackNode===l?Ew.bind(null,s):null)}function Tw(s,a){if(fd())return null;ow(s,a,!0)}function wM(){DM(function(){(At&6)!==0?nn(Fn,SM):Cw()})}function mg(){if(ma===0){var s=Vo;s===0&&(s=ei,ei<<=1,(ei&261888)===0&&(ei=256)),ma=s}return ma}function Aw(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Jr(""+s)}function Rw(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 xM(s,a,l,h,m){if(a==="submit"&&l&&l.stateNode===m){var _=Aw((m[be]||null).action),C=h.submitter;C&&(a=(a=C[be]||null)?Aw(a.formAction):C.getAttribute("formAction"),a!==null&&(_=a,C=null));var M=new Th("action","action",null,h,m);s.push({event:M,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(ma!==0){var G=C?Rw(m,C):new FormData(m);jm(l,{pending:!0,data:G,method:m.method,action:_},null,G)}}else typeof _=="function"&&(M.preventDefault(),G=C?Rw(m,C):new FormData(m),jm(l,{pending:!0,data:G,method:m.method,action:_},_,G))},currentTarget:m}]})}}for(var gg=0;gg<Jp.length;gg++){var _g=Jp[gg],CM=_g.toLowerCase(),kM=_g[0].toUpperCase()+_g.slice(1);Is(CM,"on"+kM)}Is(a1,"onAnimationEnd"),Is(o1,"onAnimationIteration"),Is(l1,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(HN,"onTransitionRun"),Is(FN,"onTransitionStart"),Is(UN,"onTransitionCancel"),Is(c1,"onTransitionEnd"),ge("onMouseEnter",["mouseout","mouseover"]),ge("onMouseLeave",["mouseout","mouseover"]),ge("onPointerEnter",["pointerout","pointerover"]),ge("onPointerLeave",["pointerout","pointerover"]),rn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rn("onBeforeInput",["compositionend","keypress","textInput","paste"]),rn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $c="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($c));function Lw(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],G=M.instance,ne=M.currentTarget;if(M=M.listener,G!==_&&m.isPropagationStopped())break e;_=M,m.currentTarget=ne;try{_(m)}catch(le){Lh(le)}m.currentTarget=null,_=G}else for(C=0;C<h.length;C++){if(M=h[C],G=M.instance,ne=M.currentTarget,M=M.listener,G!==_&&m.isPropagationStopped())break e;_=M,m.currentTarget=ne;try{_(m)}catch(le){Lh(le)}m.currentTarget=null,_=G}}}}function ft(s,a){var l=a[Pt];l===void 0&&(l=a[Pt]=new Set);var h=s+"__bubble";l.has(h)||(Nw(a,s,2,!1),l.add(h))}function vg(s,a,l){var h=0;a&&(h|=4),Nw(l,s,h,a)}var gd="_reactListening"+Math.random().toString(36).slice(2);function yg(s){if(!s[gd]){s[gd]=!0,Nt.forEach(function(l){l!=="selectionchange"&&(EM.has(l)||vg(l,!1,s),vg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[gd]||(a[gd]=!0,vg("selectionchange",!1,a))}}function Nw(s,a,l,h){switch(ax(a)){case 2:var m=e3;break;case 8:m=t3;break;default:m=Dg}l=m.bind(null,a,l,s),m=void 0,!zp||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 bg(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 G=C.tag;if((G===3||G===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;M!==null;){if(C=U(M),C===null)return;if(G=C.tag,G===5||G===6||G===26||G===27){h=_=C;continue e}M=M.parentNode}}h=h.return}xh(function(){var ne=_,le=Qe(l),de=[];e:{var se=u1.get(s);if(se!==void 0){var re=Th,Ne=s;switch(s){case"keypress":if(kh(l)===0)break e;case"keydown":case"keyup":re=yN;break;case"focusin":Ne="focus",re=Up;break;case"focusout":Ne="blur",re=Up;break;case"beforeblur":case"afterblur":re=Up;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":re=z0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=oN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=wN;break;case a1:case o1:case l1:re=uN;break;case c1:re=CN;break;case"scroll":case"scrollend":re=rN;break;case"wheel":re=EN;break;case"copy":case"cut":case"paste":re=dN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=H0;break;case"toggle":case"beforetoggle":re=AN}var qe=(a&4)!==0,Ht=!qe&&(s==="scroll"||s==="scrollend"),Z=qe?se!==null?se+"Capture":null:se;qe=[];for(var K=ne,te;K!==null;){var he=K;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||Z===null||(he=lc(K,Z),he!=null&&qe.push(Hc(K,he,te))),Ht)break;K=K.return}0<qe.length&&(se=new re(se,Ne,null,l,le),de.push({event:se,listeners:qe}))}}if((a&7)===0){e:{if(se=s==="mouseover"||s==="pointerover",re=s==="mouseout"||s==="pointerout",se&&l!==Oe&&(Ne=l.relatedTarget||l.fromElement)&&(U(Ne)||Ne[Lt]))break e;if((re||se)&&(se=le.window===le?le:(se=le.ownerDocument)?se.defaultView||se.parentWindow:window,re?(Ne=l.relatedTarget||l.toElement,re=ne,Ne=Ne?U(Ne):null,Ne!==null&&(Ht=o(Ne),qe=Ne.tag,Ne!==Ht||qe!==5&&qe!==27&&qe!==6)&&(Ne=null)):(re=null,Ne=ne),re!==Ne)){if(qe=z0,he="onMouseLeave",Z="onMouseEnter",K="mouse",(s==="pointerout"||s==="pointerover")&&(qe=H0,he="onPointerLeave",Z="onPointerEnter",K="pointer"),Ht=re==null?se:Ce(re),te=Ne==null?se:Ce(Ne),se=new qe(he,K+"leave",re,l,le),se.target=Ht,se.relatedTarget=te,he=null,U(le)===ne&&(qe=new qe(Z,K+"enter",Ne,l,le),qe.target=te,qe.relatedTarget=Ht,he=qe),Ht=he,re&&Ne)t:{for(qe=TM,Z=re,K=Ne,te=0,he=Z;he;he=qe(he))te++;he=0;for(var He=K;He;He=qe(He))he++;for(;0<te-he;)Z=qe(Z),te--;for(;0<he-te;)K=qe(K),he--;for(;te--;){if(Z===K||K!==null&&Z===K.alternate){qe=Z;break t}Z=qe(Z),K=qe(K)}qe=null}else qe=null;re!==null&&Mw(de,se,re,qe,!1),Ne!==null&&Ht!==null&&Mw(de,Ht,Ne,qe,!0)}}e:{if(se=ne?Ce(ne):window,re=se.nodeName&&se.nodeName.toLowerCase(),re==="select"||re==="input"&&se.type==="file")var Ct=Y0;else if(K0(se))if(X0)Ct=PN;else{Ct=IN;var De=jN}else re=se.nodeName,!re||re.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&Zr(ne.elementType)&&(Ct=Y0):Ct=BN;if(Ct&&(Ct=Ct(s,ne))){V0(de,Ct,l,le);break e}De&&De(s,se,ne),s==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&Bo(se,"number",se.value)}switch(De=ne?Ce(ne):window,s){case"focusin":(K0(De)||De.contentEditable==="true")&&($o=De,Yp=ne,gc=null);break;case"focusout":gc=Yp=$o=null;break;case"mousedown":Xp=!0;break;case"contextmenu":case"mouseup":case"dragend":Xp=!1,s1(de,l,le);break;case"selectionchange":if($N)break;case"keydown":case"keyup":s1(de,l,le)}var it;if(Gp)e:{switch(s){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else zo?G0(s,l)&&(_t="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(_t="onCompositionStart");_t&&(F0&&l.locale!=="ko"&&(zo||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&zo&&(it=B0()):(Qr=le,$p="value"in Qr?Qr.value:Qr.textContent,zo=!0)),De=_d(ne,_t),0<De.length&&(_t=new $0(_t,s,null,l,le),de.push({event:_t,listeners:De}),it?_t.data=it:(it=q0(l),it!==null&&(_t.data=it)))),(it=LN?NN(s,l):MN(s,l))&&(_t=_d(ne,"onBeforeInput"),0<_t.length&&(De=new $0("onBeforeInput","beforeinput",null,l,le),de.push({event:De,listeners:_t}),De.data=it)),xM(de,s,ne,l,le)}Lw(de,a)})}function Hc(s,a,l){return{instance:s,listener:a,currentTarget:l}}function _d(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=lc(s,l),m!=null&&h.unshift(Hc(s,m,_)),m=lc(s,a),m!=null&&h.push(Hc(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 Mw(s,a,l,h,m){for(var _=a._reactName,C=[];l!==null&&l!==h;){var M=l,G=M.alternate,ne=M.stateNode;if(M=M.tag,G!==null&&G===h)break;M!==5&&M!==26&&M!==27||ne===null||(G=ne,m?(ne=lc(l,_),ne!=null&&C.unshift(Hc(l,ne,G))):m||(ne=lc(l,_),ne!=null&&C.push(Hc(l,ne,G)))),l=l.return}C.length!==0&&s.push({event:a,listeners:C})}var AM=/\r\n?/g,RM=/\u0000|\uFFFD/g;function Ow(s){return(typeof s=="string"?s:""+s).replace(AM,`
|
|
9
|
-
`).replace(RM,"")}function Dw(s,a){return a=Ow(a),Ow(s)===a}function $t(s,a,l,h,m,_){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Ke(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Ke(s,""+h);break;case"className":Xi(s,"class",h);break;case"tabIndex":Xi(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Xi(s,l,h);break;case"style":Mt(s,h,_);break;case"data":if(a!=="object"){Xi(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=Jr(""+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"&&$t(s,a,"name",m.name,m,null),$t(s,a,"formEncType",m.formEncType,m,null),$t(s,a,"formMethod",m.formMethod,m,null),$t(s,a,"formTarget",m.formTarget,m,null)):($t(s,a,"encType",m.encType,m,null),$t(s,a,"method",m.method,m,null),$t(s,a,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=Jr(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=xe);break;case"onScroll":h!=null&&ft("scroll",s);break;case"onScrollEnd":h!=null&&ft("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}l=Jr(""+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":ft("beforetoggle",s),ft("toggle",s),gi(s,"popover",h);break;case"xlinkActuate":Mi(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Mi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Mi(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Mi(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Mi(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Mi(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Mi(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Mi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Mi(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":gi(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=mr.get(l)||l,gi(s,l,h))}}function Sg(s,a,l,h,m,_){switch(l){case"style":Mt(s,h,_);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof h=="string"?Ke(s,h):(typeof h=="number"||typeof h=="bigint")&&Ke(s,""+h);break;case"onScroll":h!=null&&ft("scroll",s);break;case"onScrollEnd":h!=null&&ft("scrollend",s);break;case"onClick":h!=null&&(s.onclick=xe);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sn.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[be]||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,""):gi(s,l,h)}}}function ai(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",s),ft("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(i(137,a));default:$t(s,a,_,C,l,null)}}m&&$t(s,a,"srcSet",l.srcSet,l,null),h&&$t(s,a,"src",l.src,l,null);return;case"input":ft("invalid",s);var M=_=C=m=null,G=null,ne=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":G=le;break;case"defaultChecked":ne=le;break;case"value":_=le;break;case"defaultValue":M=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,a));break;default:$t(s,a,h,le,l,null)}}Ua(s,_,M,G,ne,C,m,!1);return;case"select":ft("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:$t(s,a,m,M,l,null)}a=_,l=C,s.multiple=!!h,a!=null?ni(s,!!h,a,!1):l!=null&&ni(s,!!h,l,!0);return;case"textarea":ft("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(i(91));break;default:$t(s,a,C,M,l,null)}Po(s,h,m,_);return;case"option":for(G in l)l.hasOwnProperty(G)&&(h=l[G],h!=null)&&(G==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":$t(s,a,G,h,l,null));return;case"dialog":ft("beforetoggle",s),ft("toggle",s),ft("cancel",s),ft("close",s);break;case"iframe":case"object":ft("load",s);break;case"video":case"audio":for(h=0;h<$c.length;h++)ft($c[h],s);break;case"image":ft("error",s),ft("load",s);break;case"details":ft("toggle",s);break;case"embed":case"source":case"link":ft("error",s),ft("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in l)if(l.hasOwnProperty(ne)&&(h=l[ne],h!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:$t(s,a,ne,h,l,null)}return;default:if(Zr(a)){for(le in l)l.hasOwnProperty(le)&&(h=l[le],h!==void 0&&Sg(s,a,le,h,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(h=l[M],h!=null&&$t(s,a,M,h,l,null))}function LM(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,G=null,ne=null,le=null;for(re in l){var de=l[re];if(l.hasOwnProperty(re)&&de!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":G=de;default:h.hasOwnProperty(re)||$t(s,a,re,null,h,de)}}for(var se in h){var re=h[se];if(de=l[se],h.hasOwnProperty(se)&&(re!=null||de!=null))switch(se){case"type":_=re;break;case"name":m=re;break;case"checked":ne=re;break;case"defaultChecked":le=re;break;case"value":C=re;break;case"defaultValue":M=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,a));break;default:re!==de&&$t(s,a,se,re,h,de)}}rc(s,C,M,G,ne,le,_,m);return;case"select":re=C=M=se=null;for(_ in l)if(G=l[_],l.hasOwnProperty(_)&&G!=null)switch(_){case"value":break;case"multiple":re=G;default:h.hasOwnProperty(_)||$t(s,a,_,null,h,G)}for(m in h)if(_=h[m],G=l[m],h.hasOwnProperty(m)&&(_!=null||G!=null))switch(m){case"value":se=_;break;case"defaultValue":M=_;break;case"multiple":C=_;default:_!==G&&$t(s,a,m,_,h,G)}a=M,l=C,h=re,se!=null?ni(s,!!l,se,!1):!!h!=!!l&&(a!=null?ni(s,!!l,a,!0):ni(s,!!l,l?[]:"",!1));return;case"textarea":re=se=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:$t(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":se=m;break;case"defaultValue":re=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==_&&$t(s,a,C,m,h,_)}Sh(s,se,re);return;case"option":for(var Ne in l)se=l[Ne],l.hasOwnProperty(Ne)&&se!=null&&!h.hasOwnProperty(Ne)&&(Ne==="selected"?s.selected=!1:$t(s,a,Ne,null,h,se));for(G in h)se=h[G],re=l[G],h.hasOwnProperty(G)&&se!==re&&(se!=null||re!=null)&&(G==="selected"?s.selected=se&&typeof se!="function"&&typeof se!="symbol":$t(s,a,G,se,h,re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in l)se=l[qe],l.hasOwnProperty(qe)&&se!=null&&!h.hasOwnProperty(qe)&&$t(s,a,qe,null,h,se);for(ne in h)if(se=h[ne],re=l[ne],h.hasOwnProperty(ne)&&se!==re&&(se!=null||re!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,a));break;default:$t(s,a,ne,se,h,re)}return;default:if(Zr(a)){for(var Ht in l)se=l[Ht],l.hasOwnProperty(Ht)&&se!==void 0&&!h.hasOwnProperty(Ht)&&Sg(s,a,Ht,void 0,h,se);for(le in h)se=h[le],re=l[le],!h.hasOwnProperty(le)||se===re||se===void 0&&re===void 0||Sg(s,a,le,se,h,re);return}}for(var Z in l)se=l[Z],l.hasOwnProperty(Z)&&se!=null&&!h.hasOwnProperty(Z)&&$t(s,a,Z,null,h,se);for(de in h)se=h[de],re=l[de],!h.hasOwnProperty(de)||se===re||se==null&&re==null||$t(s,a,de,se,h,re)}function jw(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NM(){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&&jw(C)){for(C=0,M=m.responseEnd,h+=1;h<l.length;h++){var G=l[h],ne=G.startTime;if(ne>M)break;var le=G.transferSize,de=G.initiatorType;le&&jw(de)&&(G=G.responseEnd,C+=le*(G<M?1:(M-ne)/(G-ne)))}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 wg=null,xg=null;function vd(s){return s.nodeType===9?s:s.ownerDocument}function Iw(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 Bw(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 Cg(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 kg=null;function MM(){var s=window.event;return s&&s.type==="popstate"?s===kg?!1:(kg=s,!0):(kg=null,!1)}var Pw=typeof setTimeout=="function"?setTimeout:void 0,OM=typeof clearTimeout=="function"?clearTimeout:void 0,zw=typeof Promise=="function"?Promise:void 0,DM=typeof queueMicrotask=="function"?queueMicrotask:typeof zw<"u"?function(s){return zw.resolve(null).then(s).catch(jM)}:Pw;function jM(s){setTimeout(function(){throw s})}function ga(s){return s==="head"}function $w(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),fl(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")Fc(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Fc(l);for(var _=l.firstChild;_;){var C=_.nextSibling,M=_.nodeName;_[mi]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&_.rel.toLowerCase()==="stylesheet"||l.removeChild(_),_=C}}else l==="body"&&Fc(s.ownerDocument.body);l=m}while(l);fl(a)}function Hw(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 Eg(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":Eg(l),Me(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function IM(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[mi])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=ws(s.nextSibling),s===null)break}return null}function BM(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=ws(s.nextSibling),s===null))return null;return s}function Fw(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ws(s.nextSibling),s===null))return null;return s}function Tg(s){return s.data==="$?"||s.data==="$~"}function Ag(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function PM(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 ws(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 Rg=null;function Uw(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return ws(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function Ww(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 Gw(s,a,l){switch(a=vd(l),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Fc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Me(s)}var xs=new Map,qw=new Set;function yd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Nr=j.d;j.d={f:zM,r:$M,D:HM,C:FM,L:UM,m:WM,X:qM,S:GM,M:KM};function zM(){var s=Nr.f(),a=ud();return s||a}function $M(s){var a=oe(s);a!==null&&a.tag===5&&a.type==="form"?cS(a):Nr.r(s)}var ul=typeof document>"u"?null:document;function Kw(s,a,l){var h=ul;if(h&&typeof a=="string"&&a){var m=Oi(a);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),qw.has(m)||(qw.add(m),s={rel:s,crossOrigin:l,href:a},h.querySelector(m)===null&&(a=h.createElement("link"),ai(a,"link",s),et(a),h.head.appendChild(a)))}}function HM(s){Nr.D(s),Kw("dns-prefetch",s,null)}function FM(s,a){Nr.C(s,a),Kw("preconnect",s,a)}function UM(s,a,l){Nr.L(s,a,l);var h=ul;if(h&&s&&a){var m='link[rel="preload"][as="'+Oi(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Oi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Oi(l.imageSizes)+'"]')):m+='[href="'+Oi(s)+'"]';var _=m;switch(a){case"style":_=hl(s);break;case"script":_=dl(s)}xs.has(_)||(s=v({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),xs.set(_,s),h.querySelector(m)!==null||a==="style"&&h.querySelector(Uc(_))||a==="script"&&h.querySelector(Wc(_))||(a=h.createElement("link"),ai(a,"link",s),et(a),h.head.appendChild(a)))}}function WM(s,a){Nr.m(s,a);var l=ul;if(l&&s){var h=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Oi(h)+'"][href="'+Oi(s)+'"]',_=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=dl(s)}if(!xs.has(_)&&(s=v({rel:"modulepreload",href:s},a),xs.set(_,s),l.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Wc(_)))return}h=l.createElement("link"),ai(h,"link",s),et(h),l.head.appendChild(h)}}}function GM(s,a,l){Nr.S(s,a,l);var h=ul;if(h&&s){var m=Je(h).hoistableStyles,_=hl(s);a=a||"default";var C=m.get(_);if(!C){var M={loading:0,preload:null};if(C=h.querySelector(Uc(_)))M.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":a},l),(l=xs.get(_))&&Lg(s,l);var G=C=h.createElement("link");et(G),ai(G,"link",s),G._p=new Promise(function(ne,le){G.onload=ne,G.onerror=le}),G.addEventListener("load",function(){M.loading|=1}),G.addEventListener("error",function(){M.loading|=2}),M.loading|=4,bd(C,a,h)}C={type:"stylesheet",instance:C,count:1,state:M},m.set(_,C)}}}function qM(s,a){Nr.X(s,a);var l=ul;if(l&&s){var h=Je(l).hoistableScripts,m=dl(s),_=h.get(m);_||(_=l.querySelector(Wc(m)),_||(s=v({src:s,async:!0},a),(a=xs.get(m))&&Ng(s,a),_=l.createElement("script"),et(_),ai(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},h.set(m,_))}}function KM(s,a){Nr.M(s,a);var l=ul;if(l&&s){var h=Je(l).hoistableScripts,m=dl(s),_=h.get(m);_||(_=l.querySelector(Wc(m)),_||(s=v({src:s,async:!0,type:"module"},a),(a=xs.get(m))&&Ng(s,a),_=l.createElement("script"),et(_),ai(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},h.set(m,_))}}function Vw(s,a,l,h){var m=(m=me.current)?yd(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=hl(l.href),l=Je(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=hl(l.href);var _=Je(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(Uc(s)))&&!_._p&&(C.instance=_,C.state.loading=5),xs.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},xs.set(s,l),_||VM(m,s,l,C.state))),a&&h===null)throw Error(i(528,""));return C}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=dl(l),l=Je(m).hoistableScripts,h=l.get(a),h||(h={type:"script",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function hl(s){return'href="'+Oi(s)+'"'}function Uc(s){return'link[rel="stylesheet"]['+s+"]"}function Yw(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function VM(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}),ai(a,"link",l),et(a),s.head.appendChild(a))}function dl(s){return'[src="'+Oi(s)+'"]'}function Wc(s){return"script[async]"+s}function Xw(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Oi(l.href)+'"]');if(h)return a.instance=h,et(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"),et(h),ai(h,"style",m),bd(h,l.precedence,s),a.instance=h;case"stylesheet":m=hl(l.href);var _=s.querySelector(Uc(m));if(_)return a.state.loading|=4,a.instance=_,et(_),_;h=Yw(l),(m=xs.get(m))&&Lg(h,m),_=(s.ownerDocument||s).createElement("link"),et(_);var C=_;return C._p=new Promise(function(M,G){C.onload=M,C.onerror=G}),ai(_,"link",h),a.state.loading|=4,bd(_,l.precedence,s),a.instance=_;case"script":return _=dl(l.src),(m=s.querySelector(Wc(_)))?(a.instance=m,et(m),m):(h=l,(m=xs.get(_))&&(h=v({},l),Ng(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),et(m),ai(m,"link",h),s.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,bd(h,l.precedence,s));return a.instance}function bd(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 Lg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Ng(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Sd=null;function Zw(s,a,l){if(Sd===null){var h=new Map,m=Sd=new Map;m.set(l,h)}else m=Sd,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(!(_[mi]||_[Ue]||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 Jw(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function YM(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 Qw(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function XM(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=hl(h.href),_=a.querySelector(Uc(m));if(_){a=_._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=wd.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=_,et(_);return}_=a.ownerDocument||a,h=Yw(h),(m=xs.get(m))&&Lg(h,m),_=_.createElement("link"),et(_);var C=_;C._p=new Promise(function(M,G){C.onload=M,C.onerror=G}),ai(_,"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=wd.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var Mg=0;function ZM(s,a){return s.stylesheets&&s.count===0&&Cd(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&Cd(s,s.stylesheets),s.unsuspend){var _=s.unsuspend;s.unsuspend=null,_()}},6e4+a);0<s.imgBytes&&Mg===0&&(Mg=62500*NM());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Cd(s,s.stylesheets),s.unsuspend)){var _=s.unsuspend;s.unsuspend=null,_()}},(s.imgBytes>Mg?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function wd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var xd=null;function Cd(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,xd=new Map,a.forEach(JM,s),xd=null,wd.call(s))}function JM(s,a){if(!(a.state.loading&4)){var l=xd.get(s);if(l)var h=l.get(null);else{l=new Map,xd.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=wd.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 Gc={$$typeof:I,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function QM(s,a,l,h,m,_,C,M,G){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.hiddenUpdates=Rt(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=_,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function ex(s,a,l,h,m,_,C,M,G,ne,le,de){return s=new QM(s,a,l,C,G,ne,le,de,M),a=1,_===!0&&(a|=24),_=Qi(3,null,null,a),s.current=_,_.stateNode=s,a=hm(),a.refCount++,s.pooledCache=a,a.refCount++,_.memoizedState={element:h,isDehydrated:l,cache:a},mm(_),s}function tx(s){return s?(s=Uo,s):Uo}function nx(s,a,l,h,m,_){m=tx(m),h.context===null?h.context=m:h.pendingContext=m,h=ra(a),h.payload={element:l},_=_===void 0?null:_,_!==null&&(h.callback=_),l=aa(s,h,a),l!==null&&(zi(l,s,a),xc(l,s,a))}function ix(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Og(s,a){ix(s,a),(s=s.alternate)&&ix(s,a)}function sx(s){if(s.tag===13||s.tag===31){var a=Ka(s,67108864);a!==null&&zi(a,s,67108864),Og(s,67108864)}}function rx(s){if(s.tag===13||s.tag===31){var a=ss();a=rt(a);var l=Ka(s,a);l!==null&&zi(l,s,a),Og(s,a)}}var kd=!0;function e3(s,a,l,h){var m=k.T;k.T=null;var _=j.p;try{j.p=2,Dg(s,a,l,h)}finally{j.p=_,k.T=m}}function t3(s,a,l,h){var m=k.T;k.T=null;var _=j.p;try{j.p=8,Dg(s,a,l,h)}finally{j.p=_,k.T=m}}function Dg(s,a,l,h){if(kd){var m=jg(h);if(m===null)bg(s,a,h,Ed,l),ox(s,h);else if(i3(m,s,a,l,h))h.stopPropagation();else if(ox(s,h),a&4&&-1<n3.indexOf(s)){for(;m!==null;){var _=oe(m);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var C=Bt(_.pendingLanes);if(C!==0){var M=_;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var G=1<<31-It(C);M.entanglements[1]|=G,C&=~G}Js(_),(At&6)===0&&(ld=ut()+500,zc(0))}}break;case 31:case 13:M=Ka(_,2),M!==null&&zi(M,_,2),ud(),Og(_,2)}if(_=jg(h),_===null&&bg(s,a,h,Ed,l),_===m)break;m=_}m!==null&&h.stopPropagation()}else bg(s,a,h,null,l)}}function jg(s){return s=Qe(s),Ig(s)}var Ed=null;function Ig(s){if(Ed=null,s=U(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=c(a),s!==null)return s;s=null}else if(l===31){if(s=d(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Ed=s,null}function ax(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(ds()){case Fn:return 2;case kn:return 8;case Ni:case bi:return 32;case Ki:return 268435456;default:return 32}default:return 32}}var Bg=!1,_a=null,va=null,ya=null,qc=new Map,Kc=new Map,ba=[],n3="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 ox(s,a){switch(s){case"focusin":case"focusout":_a=null;break;case"dragenter":case"dragleave":va=null;break;case"mouseover":case"mouseout":ya=null;break;case"pointerover":case"pointerout":qc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kc.delete(a.pointerId)}}function Vc(s,a,l,h,m,_){return s===null||s.nativeEvent!==_?(s={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:_,targetContainers:[m]},a!==null&&(a=oe(a),a!==null&&sx(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function i3(s,a,l,h,m){switch(a){case"focusin":return _a=Vc(_a,s,a,l,h,m),!0;case"dragenter":return va=Vc(va,s,a,l,h,m),!0;case"mouseover":return ya=Vc(ya,s,a,l,h,m),!0;case"pointerover":var _=m.pointerId;return qc.set(_,Vc(qc.get(_)||null,s,a,l,h,m)),!0;case"gotpointercapture":return _=m.pointerId,Kc.set(_,Vc(Kc.get(_)||null,s,a,l,h,m)),!0}return!1}function lx(s){var a=U(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=c(l),a!==null){s.blockedOn=a,pt(s.priority,function(){rx(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,pt(s.priority,function(){rx(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 Td(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=jg(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=oe(l),a!==null&&sx(a),s.blockedOn=l,!1;a.shift()}return!0}function cx(s,a,l){Td(s)&&l.delete(a)}function s3(){Bg=!1,_a!==null&&Td(_a)&&(_a=null),va!==null&&Td(va)&&(va=null),ya!==null&&Td(ya)&&(ya=null),qc.forEach(cx),Kc.forEach(cx)}function Ad(s,a){s.blockedOn===a&&(s.blockedOn=null,Bg||(Bg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,s3)))}var Rd=null;function ux(s){Rd!==s&&(Rd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Rd===s&&(Rd=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(Ig(h||l)===null)continue;break}var _=oe(l);_!==null&&(s.splice(a,3),a-=3,jm(_,{pending:!0,data:m,method:l.method,action:h},h,m))}}))}function fl(s){function a(G){return Ad(G,s)}_a!==null&&Ad(_a,s),va!==null&&Ad(va,s),ya!==null&&Ad(ya,s),qc.forEach(a),Kc.forEach(a);for(var l=0;l<ba.length;l++){var h=ba[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<ba.length&&(l=ba[0],l.blockedOn===null);)lx(l),l.blockedOn===null&&ba.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[be]||null;if(typeof _=="function")C||ux(l);else if(C){var M=null;if(_&&_.hasAttribute("formAction")){if(m=_,C=_[be]||null)M=C.formAction;else if(Ig(m)!==null)continue}else M=C.action;typeof M=="function"?l[h+1]=M:(l.splice(h,3),h-=3),ux(l)}}}function hx(){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 Pg(s){this._internalRoot=s}Ld.prototype.render=Pg.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=ss();nx(l,h,s,a,null,null)},Ld.prototype.unmount=Pg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;nx(s.current,2,null,s,null,null),ud(),a[Lt]=null}};function Ld(s){this._internalRoot=s}Ld.prototype.unstable_scheduleHydration=function(s){if(s){var a=ue();s={blockedOn:null,target:s,priority:a};for(var l=0;l<ba.length&&a!==0&&a<ba[l].priority;l++);ba.splice(l,0,s),l===0&&lx(s)}};var dx=t.version;if(dx!=="19.2.7")throw Error(i(527,dx,"19.2.7"));j.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=f(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var r3={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nd.isDisabled&&Nd.supportsFiber)try{fi=Nd.inject(r3),Yt=Nd}catch{}}return Xc.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,h="",m=yS,_=bS,C=SS;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=ex(s,1,!1,null,null,l,h,null,m,_,C,hx),s[Lt]=a.current,yg(s),new Pg(a)},Xc.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var h=!1,m="",_=yS,C=bS,M=SS,G=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&&(G=l.formState)),a=ex(s,1,!0,a,l??null,h,m,G,_,C,M,hx),a.context=tx(null),l=a.current,h=ss(),h=rt(h),m=ra(h),m.callback=null,aa(l,m,h),l=h,a.current.lanes=l,St(a,l),Js(a),s[Lt]=a.current,yg(s),new Ld(a)},Xc.version="19.2.7",Xc}var xx;function q3(){if(xx)return Fg.exports;xx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Fg.exports=G3(),Fg.exports}var K3=q3();var Cx="popstate";function kx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function V3(e={}){function t(i,r){let o=r.state?.masked,{pathname:c,search:d,hash:p}=o||i.location;return _v("",{pathname:c,search:d,hash:p},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:Wu(r)}return X3(t,n,null,e)}function ln(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Y3(){return Math.random().toString(36).substring(2,10)}function Ex(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 _v(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Yl(t):t,state:n,key:t&&t.key||i||Y3(),mask:r}}function Wu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Yl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function X3(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,c=r.history,d="POP",p=null,f=g();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function g(){return(c.state||{idx:null}).idx}function v(){d="POP";let E=g(),A=E==null?null:E-f;f=E,p&&p({action:d,location:x.location,delta:A})}function b(E,A){d="PUSH";let L=kx(E)?E:_v(x.location,E,A);f=g()+1;let I=Ex(L,f),R=x.createHref(L.mask||L);try{c.pushState(I,"",R)}catch(z){if(z instanceof DOMException&&z.name==="DataCloneError")throw z;r.location.assign(R)}o&&p&&p({action:d,location:x.location,delta:1})}function S(E,A){d="REPLACE";let L=kx(E)?E:_v(x.location,E,A);f=g();let I=Ex(L,f),R=x.createHref(L.mask||L);c.replaceState(I,"",R),o&&p&&p({action:d,location:x.location,delta:0})}function w(E){return Z3(r,E)}let x={get action(){return d},get location(){return e(r,c)},listen(E){if(p)throw new Error("A history only accepts one active listener");return r.addEventListener(Cx,v),p=E,()=>{r.removeEventListener(Cx,v),p=null}},createHref(E){return t(r,E)},createURL:w,encodeLocation(E){let A=w(E);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:b,replace:S,go(E){return c.go(E)}};return x}function Z3(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),ln(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Wu(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function xE(e,t,n="/"){return J3(e,t,n,!1)}function J3(e,t,n,i,r){let o=typeof t=="string"?Yl(t):t,c=Gr(o.pathname||"/",n);if(c==null)return null;let d=Q3(e),p=null,f=h6(c);for(let g=0;p==null&&g<d.length;++g)p=c6(d[g],f,i);return p}function Q3(e){let t=CE(e);return e6(t),t}function CE(e,t=[],n=[],i="",r=!1){let o=(c,d,p=r,f)=>{let g={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&p)return;ln(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let v=Us([i,g.relativePath]),b=n.concat(g);c.children&&c.children.length>0&&(ln(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),CE(c.children,t,b,v,p)),!(c.path==null&&!c.index)&&t.push({path:v,score:o6(v,c.index),routesMeta:b})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))o(c,d);else for(let p of kE(c.path))o(c,d,!0,p)}),t}function kE(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return r?[o,""]:[o];let c=kE(i.join("/")),d=[];return d.push(...c.map(p=>p===""?o:[o,p].join("/"))),r&&d.push(...c),d.map(p=>e.startsWith("/")&&p===""?"/":p)}function e6(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:l6(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var t6=/^:[\w-]+$/,n6=3,i6=2,s6=1,r6=10,a6=-2,Tx=e=>e==="*";function o6(e,t){let n=e.split("/"),i=n.length;return n.some(Tx)&&(i+=a6),t&&(i+=i6),n.filter(r=>!Tx(r)).reduce((r,o)=>r+(t6.test(o)?n6:o===""?s6:r6),i)}function l6(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function c6(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",c=[];for(let d=0;d<i.length;++d){let p=i[d],f=d===i.length-1,g=o==="/"?t:t.slice(o.length)||"/",v=Mf({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},g),b=p.route;if(!v&&f&&n&&!i[i.length-1].route.index&&(v=Mf({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!v)return null;Object.assign(r,v.params),c.push({params:r,pathname:Us([o,v.pathname]),pathnameBase:m6(Us([o,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(o=Us([o,v.pathnameBase]))}return c}function Mf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=u6(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],c=o.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:i.reduce((f,{paramName:g,isOptional:v},b)=>{if(g==="*"){let w=d[b]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[b];return v&&!S?f[g]=void 0:f[g]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:c,pattern:e}}function u6(e,t=!1,n=!0){Gs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,p,f,g)=>{if(i.push({paramName:d,isOptional:p!=null}),p){let v=g.charAt(f+c.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function h6(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Gs(!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 Gr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var d6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function f6(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?Yl(e):e,o;return n?(n=EE(n),n.startsWith("/")?o=Ax(n.substring(1),"/"):o=Ax(n,t)):o=t,{pathname:o,search:g6(i),hash:_6(r)}}function Ax(e,t){let n=Of(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function qg(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function p6(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Sb(e){let t=p6(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function fp(e,t,n,i=!1){let r;typeof e=="string"?r=Yl(e):(r={...e},ln(!r.pathname||!r.pathname.includes("?"),qg("?","pathname","search",r)),ln(!r.pathname||!r.pathname.includes("#"),qg("#","pathname","hash",r)),ln(!r.search||!r.search.includes("#"),qg("#","search","hash",r)));let o=e===""||r.pathname==="",c=o?"/":r.pathname,d;if(c==null)d=n;else{let v=t.length-1;if(!i&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),v-=1;r.pathname=b.join("/")}d=v>=0?t[v]:"/"}let p=f6(r,d),f=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(f||g)&&(p.pathname+="/"),p}var EE=e=>e.replace(/\/\/+/g,"/"),Us=e=>EE(e.join("/")),Of=e=>e.replace(/\/+$/,""),m6=e=>Of(e).replace(/^\/*/,"/"),g6=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_6=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,v6=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function y6(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function b6(e){let t=e.map(n=>n.route.path).filter(Boolean);return Us(t)||"/"}var TE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function AE(e,t){let n=e;if(typeof n!="string"||!d6.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(TE)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Gr(c.pathname,t);c.origin===o.origin&&d!=null?n=d+c.search+c.hash:r=!0}catch{Gs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var RE=["POST","PUT","PATCH","DELETE"];new Set(RE);var S6=["GET",...RE];new Set(S6);var Xl=y.createContext(null);Xl.displayName="DataRouter";var pp=y.createContext(null);pp.displayName="DataRouterState";var LE=y.createContext(!1);function w6(){return y.useContext(LE)}var NE=y.createContext({isTransitioning:!1});NE.displayName="ViewTransition";var x6=y.createContext(new Map);x6.displayName="Fetchers";var C6=y.createContext(null);C6.displayName="Await";var hs=y.createContext(null);hs.displayName="Navigation";var hh=y.createContext(null);hh.displayName="Location";var hr=y.createContext({outlet:null,matches:[],isDataRoute:!1});hr.displayName="Route";var wb=y.createContext(null);wb.displayName="RouteError";var ME="REACT_ROUTER_ERROR",k6="REDIRECT",E6="ROUTE_ERROR_RESPONSE";function T6(e){if(e.startsWith(`${ME}:${k6}:{`))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 A6(e){if(e.startsWith(`${ME}:${E6}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new v6(t.status,t.statusText,t.data)}catch{}}function R6(e,{relative:t}={}){ln(Zl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=y.useContext(hs),{hash:r,pathname:o,search:c}=dh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Us([n,o])),i.createHref({pathname:d,search:c,hash:r})}function Zl(){return y.useContext(hh)!=null}function Ds(){return ln(Zl(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(hh).location}var OE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function DE(e){y.useContext(hs).static||y.useLayoutEffect(e)}function Jl(){let{isDataRoute:e}=y.useContext(hr);return e?F6():L6()}function L6(){ln(Zl(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(Xl),{basename:t,navigator:n}=y.useContext(hs),{matches:i}=y.useContext(hr),{pathname:r}=Ds(),o=JSON.stringify(Sb(i)),c=y.useRef(!1);return DE(()=>{c.current=!0}),y.useCallback((p,f={})=>{if(Gs(c.current,OE),!c.current)return;if(typeof p=="number"){n.go(p);return}let g=fp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Us([t,g.pathname])),(f.replace?n.replace:n.push)(g,f.state,f)},[t,n,o,r,e])}y.createContext(null);function dh(e,{relative:t}={}){let{matches:n}=y.useContext(hr),{pathname:i}=Ds(),r=JSON.stringify(Sb(n));return y.useMemo(()=>fp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function N6(e,t){return jE(e,t)}function jE(e,t,n){ln(Zl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(hs),{matches:r}=y.useContext(hr),o=r[r.length-1],c=o?o.params:{},d=o?o.pathname:"/",p=o?o.pathnameBase:"/",f=o&&o.route;{let E=f&&f.path||"";BE(d,!f||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${E}">) 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="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let g=Ds(),v;if(t){let E=typeof t=="string"?Yl(t):t;ln(p==="/"||E.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 "${E.pathname}" was given in the \`location\` prop.`),v=E}else v=g;let b=v.pathname||"/",S=b;if(p!=="/"){let E=p.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(E=>Object.assign(E,{route:n.manifest[E.route.id]||E.route})):xE(e,{pathname:S});Gs(f||w!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Gs(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=I6(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Us([p,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?p:Us([p,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),r,n);return t&&x?y.createElement(hh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...v},navigationType:"POP"}},x):x}function M6(){let e=H6(),t=y6(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:o},"ErrorBoundary")," or"," ",y.createElement("code",{style:o},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:r},n):null,c)}var O6=y.createElement(M6,null),IE=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=A6(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(hr.Provider,{value:this.props.routeContext},y.createElement(wb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(D6,{error:e},t):t}};IE.contextType=LE;var Kg=new WeakMap;function D6({children:e,error:t}){let{basename:n}=y.useContext(hs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=T6(t.digest);if(i){let r=Kg.get(t);if(r)throw r;let o=AE(i.location,n);if(TE&&!Kg.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw Kg.set(t,c),c}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function j6({routeContext:e,match:t,children:n}){let i=y.useContext(Xl);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(hr.Provider,{value:e},n)}function I6(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,o=i?.errors;if(o!=null){let g=r.findIndex(v=>v.route.id&&o?.[v.route.id]!==void 0);ln(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,g+1))}let c=!1,d=-1;if(n&&i){c=i.renderFallback;for(let g=0;g<r.length;g++){let v=r[g];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(d=g),v.route.id){let{loaderData:b,errors:S}=i,w=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!S||S[v.route.id]===void 0);if(v.route.lazy||w){n.isStatic&&(c=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let p=n?.onError,f=i&&p?(g,v)=>{p(g,{location:i.location,params:i.matches?.[0]?.params??{},pattern:b6(i.matches),errorInfo:v})}:void 0;return r.reduceRight((g,v,b)=>{let S,w=!1,x=null,E=null;i&&(S=o&&v.route.id?o[v.route.id]:void 0,x=v.route.errorElement||O6,c&&(d<0&&b===0?(BE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===b&&(w=!0,E=v.route.hydrateFallbackElement||null)));let A=t.concat(r.slice(0,b+1)),L=()=>{let I;return S?I=x:w?I=E:v.route.Component?I=y.createElement(v.route.Component,null):v.route.element?I=v.route.element:I=g,y.createElement(j6,{match:v,routeContext:{outlet:g,matches:A,isDataRoute:i!=null},children:I})};return i&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?y.createElement(IE,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:L(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:f}):L()},null)}function xb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B6(e){let t=y.useContext(Xl);return ln(t,xb(e)),t}function P6(e){let t=y.useContext(pp);return ln(t,xb(e)),t}function z6(e){let t=y.useContext(hr);return ln(t,xb(e)),t}function Cb(e){let t=z6(e),n=t.matches[t.matches.length-1];return ln(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $6(){return Cb("useRouteId")}function H6(){let e=y.useContext(wb),t=P6("useRouteError"),n=Cb("useRouteError");return e!==void 0?e:t.errors?.[n]}function F6(){let{router:e}=B6("useNavigate"),t=Cb("useNavigate"),n=y.useRef(!1);return DE(()=>{n.current=!0}),y.useCallback(async(r,o={})=>{Gs(n.current,OE),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var Rx={};function BE(e,t,n){!t&&!Rx[e]&&(Rx[e]=!0,Gs(!1,n))}y.memo(U6);function U6({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return jE(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function Vg({to:e,replace:t,state:n,relative:i}){ln(Zl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=y.useContext(hs);Gs(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=y.useContext(hr),{pathname:c}=Ds(),d=Jl(),p=fp(e,Sb(o),c,i==="path"),f=JSON.stringify(p);return y.useEffect(()=>{d(JSON.parse(f),{replace:t,state:n,relative:i})},[d,f,i,t,n]),null}function wl(e){ln(!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 W6({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:c}){ln(!Zl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),p=y.useMemo(()=>({basename:d,navigator:r,static:o,useTransitions:c,future:{}}),[d,r,o,c]);typeof n=="string"&&(n=Yl(n));let{pathname:f="/",search:g="",hash:v="",state:b=null,key:S="default",mask:w}=n,x=y.useMemo(()=>{let E=Gr(f,d);return E==null?null:{location:{pathname:E,search:g,hash:v,state:b,key:S,mask:w},navigationType:i}},[d,f,g,v,b,S,i,w]);return Gs(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:y.createElement(hs.Provider,{value:p},y.createElement(hh.Provider,{children:t,value:x}))}function G6({children:e,location:t}){return N6(vv(e),t)}function vv(e,t=[]){let n=[];return y.Children.forEach(e,(i,r)=>{if(!y.isValidElement(i))return;let o=[...t,r];if(i.type===y.Fragment){n.push.apply(n,vv(i.props.children,o));return}ln(i.type===wl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ln(!i.props.index||!i.props.children,"An index route cannot have child routes.");let c={id:i.props.id||o.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=vv(i.props.children,o)),n.push(c)}),n}var lf="get",cf="application/x-www-form-urlencoded";function mp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function q6(e){return mp(e)&&e.tagName.toLowerCase()==="button"}function K6(e){return mp(e)&&e.tagName.toLowerCase()==="form"}function V6(e){return mp(e)&&e.tagName.toLowerCase()==="input"}function Y6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function X6(e,t){return e.button===0&&(!t||t==="_self")&&!Y6(e)}var Md=null;function Z6(){if(Md===null)try{new FormData(document.createElement("form"),0),Md=!1}catch{Md=!0}return Md}var J6=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yg(e){return e!=null&&!J6.has(e)?(Gs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cf}"`),null):e}function Q6(e,t){let n,i,r,o,c;if(K6(e)){let d=e.getAttribute("action");i=d?Gr(d,t):null,n=e.getAttribute("method")||lf,r=Yg(e.getAttribute("enctype"))||cf,o=new FormData(e)}else if(q6(e)||V6(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||d.getAttribute("action");if(i=p?Gr(p,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||lf,r=Yg(e.getAttribute("formenctype"))||Yg(d.getAttribute("enctype"))||cf,o=new FormData(d,e),!Z6()){let{name:f,type:g,value:v}=e;if(g==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,v)}}else{if(mp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=lf,i=null,r=cf,c=e}return o&&r==="text/plain"&&(c=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function kb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function PE(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&Gr(r.pathname,t)==="/"?r.pathname=`${Of(t)}/_root.${i}`:r.pathname=`${Of(r.pathname)}.${i}`,r}async function e4(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function t4(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 n4(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let c=await e4(o,n);return c.links?c.links():[]}return[]}));return a4(i.flat(1).filter(t4).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function Lx(e,t,n,i,r,o){let c=(p,f)=>n[f]?p.route.id!==n[f].route.id:!0,d=(p,f)=>n[f].pathname!==p.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==p.params["*"];return o==="assets"?t.filter((p,f)=>c(p,f)||d(p,f)):o==="data"?t.filter((p,f)=>{let g=i.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(c(p,f)||d(p,f))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function i4(e,t,{includeHydrateFallback:n}={}){return s4(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function s4(e){return[...new Set(e)]}function r4(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function a4(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(r4(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function Eb(){let e=y.useContext(Xl);return kb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function o4(){let e=y.useContext(pp);return kb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Tb=y.createContext(void 0);Tb.displayName="FrameworkContext";function Ab(){let e=y.useContext(Tb);return kb(e,"You must render this element inside a <HydratedRouter> element"),e}function l4(e,t){let n=y.useContext(Tb),[i,r]=y.useState(!1),[o,c]=y.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:f,onMouseLeave:g,onTouchStart:v}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=A=>{A.forEach(L=>{c(L.isIntersecting)})},E=new IntersectionObserver(x,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),y.useEffect(()=>{if(i){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:Zc(d,S),onBlur:Zc(p,w),onMouseEnter:Zc(f,S),onMouseLeave:Zc(g,w),onTouchStart:Zc(v,S)}]:[!1,b,{}]}function Zc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function c4({page:e,...t}){let n=w6(),{router:i}=Eb(),r=y.useMemo(()=>xE(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?y.createElement(h4,{page:e,matches:r,...t}):y.createElement(d4,{page:e,matches:r,...t}):null}function u4(e){let{manifest:t,routeModules:n}=Ab(),[i,r]=y.useState([]);return y.useEffect(()=>{let o=!1;return n4(e,t,n).then(c=>{o||r(c)}),()=>{o=!0}},[e,t,n]),i}function h4({page:e,matches:t,...n}){let i=Ds(),{future:r}=Ab(),{basename:o}=Eb(),c=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=PE(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?p=!0:f.push(g.route.id);return p&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return y.createElement(y.Fragment,null,c.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function d4({page:e,matches:t,...n}){let i=Ds(),{future:r,manifest:o,routeModules:c}=Ab(),{basename:d}=Eb(),{loaderData:p,matches:f}=o4(),g=y.useMemo(()=>Lx(e,t,f,o,i,"data"),[e,t,f,o,i]),v=y.useMemo(()=>Lx(e,t,f,o,i,"assets"),[e,t,f,o,i]),b=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,E=!1;if(t.forEach(L=>{let I=o.routes[L.route.id];!I||!I.hasLoader||(!g.some(R=>R.route.id===L.route.id)&&L.route.id in p&&c[L.route.id]?.shouldRevalidate||I.hasClientLoader?E=!0:x.add(L.route.id))}),x.size===0)return[];let A=PE(e,d,r.v8_trailingSlashAwareDataRequests,"data");return E&&x.size>0&&A.searchParams.set("_routes",t.filter(L=>x.has(L.route.id)).map(L=>L.route.id).join(",")),[A.pathname+A.search]},[d,r.v8_trailingSlashAwareDataRequests,p,i,o,g,t,e,c]),S=y.useMemo(()=>i4(v,o),[v,o]),w=u4(v);return y.createElement(y.Fragment,null,b.map(x=>y.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),S.map(x=>y.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),w.map(({key:x,link:E})=>y.createElement("link",{key:x,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function f4(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var p4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{p4&&(window.__reactRouterVersion="7.17.0")}catch{}function m4({basename:e,children:t,useTransitions:n,window:i}){let r=y.useRef();r.current==null&&(r.current=V3({window:i,v5Compat:!0}));let o=r.current,[c,d]=y.useState({action:o.action,location:o.location}),p=y.useCallback(f=>{n===!1?d(f):y.startTransition(()=>d(f))},[n]);return y.useLayoutEffect(()=>o.listen(p),[o,p]),y.createElement(W6,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:n})}var zE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gu=y.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:c,mask:d,state:p,target:f,to:g,preventScrollReset:v,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:E,navigator:A,useTransitions:L}=y.useContext(hs),I=typeof g=="string"&&zE.test(g),R=AE(g,E);g=R.to;let z=R6(g,{relative:r}),O=Ds(),H=null;if(d){let T=fp(d,[],O.mask?O.mask.pathname:"/",!0);E!=="/"&&(T.pathname=T.pathname==="/"?E:Us([E,T.pathname])),H=A.createHref(T)}let[F,ae,fe]=l4(i,w),V=y4(g,{replace:c,mask:d,state:p,target:f,preventScrollReset:v,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:L});function $(T){t&&t(T),T.defaultPrevented||V(T)}let N=!(R.isExternal||o),D=y.createElement("a",{...w,...fe,href:(N?H:void 0)||R.absoluteURL||z,onClick:N?$:t,ref:f4(x,ae),target:f,"data-discover":!I&&n==="render"?"true":void 0});return F&&!I?y.createElement(y.Fragment,null,D,y.createElement(c4,{page:z})):D});Gu.displayName="Link";var g4=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:c,viewTransition:d,children:p,...f},g){let v=dh(c,{relative:f.relative}),b=Ds(),S=y.useContext(pp),{navigator:w,basename:x}=y.useContext(hs),E=S!=null&&C4(v)&&d===!0,A=w.encodeLocation?w.encodeLocation(v).pathname:v.pathname,L=b.pathname,I=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(L=L.toLowerCase(),I=I?I.toLowerCase():null,A=A.toLowerCase()),I&&x&&(I=Gr(I,x)||I);const R=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let z=L===A||!r&&L.startsWith(A)&&L.charAt(R)==="/",O=I!=null&&(I===A||!r&&I.startsWith(A)&&I.charAt(A.length)==="/"),H={isActive:z,isPending:O,isTransitioning:E},F=z?t:void 0,ae;typeof i=="function"?ae=i(H):ae=[i,z?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let fe=typeof o=="function"?o(H):o;return y.createElement(Gu,{...f,"aria-current":F,className:ae,ref:g,style:fe,to:c,viewTransition:d},typeof p=="function"?p(H):p)});g4.displayName="NavLink";var _4=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:c=lf,action:d,onSubmit:p,relative:f,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=y.useContext(hs),E=w4(),A=x4(d,{relative:f}),L=c.toLowerCase()==="get"?"get":"post",I=typeof d=="string"&&zE.test(d),R=z=>{if(p&&p(z),z.defaultPrevented)return;z.preventDefault();let O=z.nativeEvent.submitter,H=O?.getAttribute("formmethod")||c,F=()=>E(O||z.currentTarget,{fetcherKey:t,method:H,navigate:n,replace:r,state:o,relative:f,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:b});x&&n!==!1?y.startTransition(()=>F()):F()};return y.createElement("form",{ref:w,method:L,action:A,onSubmit:i?p:R,...S,"data-discover":!I&&e==="render"?"true":void 0})});_4.displayName="Form";function v4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $E(e){let t=y.useContext(Xl);return ln(t,v4(e)),t}function y4(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p,useTransitions:f}={}){let g=Jl(),v=Ds(),b=dh(e,{relative:c});return y.useCallback(S=>{if(X6(S,t)){S.preventDefault();let w=n!==void 0?n:Wu(v)===Wu(b),x=()=>g(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p});f?y.startTransition(()=>x()):x()}},[v,g,b,n,i,r,t,e,o,c,d,p,f])}var b4=0,S4=()=>`__${String(++b4)}__`;function w4(){let{router:e}=$E("useSubmit"),{basename:t}=y.useContext(hs),n=$6(),i=e.fetch,r=e.navigate;return y.useCallback(async(o,c={})=>{let{action:d,method:p,encType:f,formData:g,body:v}=Q6(o,t);if(c.navigate===!1){let b=c.fetcherKey||S4();await i(b,n,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:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[i,r,t,n])}function x4(e,{relative:t}={}){let{basename:n}=y.useContext(hs),i=y.useContext(hr);ln(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...dh(e||".",{relative:t})},c=Ds();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"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Us([n,o.pathname])),Wu(o)}function C4(e,{relative:t}={}){let n=y.useContext(NE);ln(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=$E("useViewTransitionState"),r=dh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Gr(n.currentLocation.pathname,i)||n.currentLocation.pathname,c=Gr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Mf(r.pathname,c)!=null||Mf(r.pathname,o)!=null}var Ha=wE();const k4=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let Vt=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function E4(e){const t=await fetch("/api/v1/theaters",{signal:e});await di(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new Vt(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>GE(i,t.status))}}async function T4(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await di(i),B4(await i.json(),i.status)}async function A4(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await di(t),P4(await t.json(),t.status)}async function R4(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const n=t.size>0?`?${t}`:"",i=await fetch(`/api/v1/updates/release-notes${n}`,{signal:e.signal});return await di(i),$4(await i.json(),i.status)}async function L4(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await di(t),z4(await t.json(),t.status)}async function HE(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await di(n);const i=await n.json();return GE(i,n.status)}async function N4(e,t){const n=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await di(n),G4(await n.json(),n.status)}async function FE(e,t){const n=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await di(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new Vt(n.status,"Invalid folder grant response");return i.folderGrantId}async function M4(e,t){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e}),signal:t});return await di(n),await n.json()}async function O4(e,t,n){const i=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,name:t}),signal:n});return await di(i),await i.json()}async function D4(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function Wi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await di(i);const r=await i.json();if(!Array.isArray(r.operations))throw new Vt(i.status,"Invalid operations response");return r.operations.map(o=>WE(o,i.status))}async function uo(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await di(i);const r=await i.json();if(!Array.isArray(r.groups))throw new Vt(i.status,"Invalid groups response");return r.groups.map(o=>Rb(o,i.status))}async function j4(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await di(n);const i=await n.json();return Rb(i.group,n.status)}async function Xg(e,t,n){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await di(i);const r=await i.json();return Rb(r.group,i.status)}async function I4(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function UE(e,t,n){return uf(e,{title:t},n)}async function uf(e,t,n){const i=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await di(i);const r=await i.json();return WE(r.operation,i.status)}function WE(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||qu(n)||qu(n.payload))throw new Vt(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,accent:typeof n.accent=="string"?n.accent:null,groupId:n.groupId===null?null:typeof n.groupId=="string"?n.groupId:void 0,ts:n.ts}}function Rb(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.name!="string"||typeof n.color!="string"||typeof n.order!="number"||typeof n.createdAt!="number")throw new Vt(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function GE(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string"||typeof n.createdAt!="string"||typeof n.lastOpenedAt!="string"||typeof n.hasWiki!="boolean"||typeof n.activeAdmiralCount!="number"||qu(n))throw new Vt(t,"Invalid Theater response");return n}function B4(e,t){const n=e;if(!n||typeof n.workspaces!="number"||typeof n.version!="string"||n.channel!=="stable"&&n.channel!=="local"&&n.channel!=="unknown"||typeof n.updateAvailable!="boolean"||typeof n.port!="number"||n.portMode!=="dynamic"&&n.portMode!=="static"||n.requestedPort!==null&&typeof n.requestedPort!="number"||typeof n.effectivePort!="number"||typeof n.portHonored!="boolean"||n.wikiServerStatus!=="available"&&n.wikiServerStatus!=="unavailable"&&n.wikiServerStatus!=="unknown")throw new Vt(t,"Invalid status response");return{workspaces:n.workspaces,version:n.version,channel:n.channel,updateAvailable:n.updateAvailable,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:void 0,port:n.port,portMode:n.portMode,requestedPort:n.requestedPort,effectivePort:n.effectivePort,portHonored:n.portHonored,wikiServerStatus:n.wikiServerStatus}}function P4(e,t){const n=e;if(!n||n.channel!=="local"||typeof n.version!="string"||typeof n.effectivePort!="number"||typeof n.dataDir!="string"||typeof n.lockFile!="string"||Object.keys(n).length!==5)throw new Vt(t,"Invalid environment response");return n}function z4(e,t){const n=e;if(!n||n.status!=="accepted")throw new Vt(t,"Invalid update response");return{status:"accepted"}}function $4(e,t){const n=e;if(!n||!Array.isArray(n.notes)||n.sourceRef!=="main"||typeof n.fetchedAt!="number"||typeof n.stale!="boolean"||"url"in n||"token"in n||"path"in n)throw new Vt(t,"Invalid release notes response");return{notes:n.notes.map(i=>H4(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function H4(e,t){const n=e;if(!n||typeof n.version!="string"||n.date!==null&&typeof n.date!="string"||!Array.isArray(n.sections)||typeof n.localizationFallback!="boolean")throw new Vt(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>F4(i,t)),localizationFallback:n.localizationFallback}}function F4(e,t){const n=e;if(!n||n.heading!=="Added"&&n.heading!=="Changed"&&n.heading!=="Fixed"&&n.heading!=="Removed"&&n.heading!=="Breaking Changes"||!Array.isArray(n.items))throw new Vt(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>U4(i,t))}}function U4(e,t){const n=e;if(!n||!Array.isArray(n.packageTags)||!n.packageTags.every(i=>typeof i=="string")||typeof n.text!="string"||"product"in n&&!W4(n.product))throw new Vt(t,"Invalid release notes response");return"product"in n?{packageTags:n.packageTags,text:n.text,product:n.product}:{packageTags:n.packageTags,text:n.text}}function W4(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function G4(e,t){const n=e;if(!n||typeof n.path!="string"||n.parentPath!==null&&typeof n.parentPath!="string"||!Array.isArray(n.roots)||!Array.isArray(n.entries)||qu(n))throw new Vt(t,"Invalid folder list response");return{path:n.path,parentPath:n.parentPath??null,roots:n.roots.filter(i=>typeof i=="string"),entries:n.entries.map(i=>q4(i,t)),truncated:n.truncated===!0?!0:void 0}}function q4(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||qu(n))throw new Vt(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function qu(e){if(!e||typeof e!="object")return!1;const t=e;return k4.some(n=>n in t)}async function di(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const n=await e.json();typeof n.error=="string"?t=n.error:typeof n.message=="string"&&(t=n.message)}catch{}throw new Vt(e.status,t)}function Nx(e,t){return e!==null&&e===t?e:null}function K4(e,t){return e&&t}function V4(e,t){return e?!1:t}const Y4="__unassigned__";function X4(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(Q4(i,t.get(i.theaterId)));return n}function Z4(e,t){const n=qE(t);return n.length===0?e:e.filter(i=>{const r=eO(i);return n.every(o=>r.includes(o))})}function J4(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??Y4,o=n.get(r);if(o!==void 0){const c=t[o];c&&(t[o]={...c,entries:[...c.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function qE(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function Q4(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function eO(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const tO=200,nO=.5,iO="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",sO=["monospace","serif","sans-serif"],bu=new Map;function rO(e,t={}){const n=gp(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=bu.get(i);if(r!==void 0)return r;const o=t.document??globalThis.document;if(!o)return!1;const c=o.createElement("canvas").getContext("2d");if(!c)return!1;const d=sO.some(p=>{const f=Mx(c,`${KE(n)}, ${p}`),g=Mx(c,p);return Math.abs(f-g)>nO});return aO(i,d,t.maxEntries??tO),d}function KE(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Df(e,t){const n=gp(e);return n?`${KE(n)}, ${t}`:t}function gp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Mx(e,t){return e.font=`28px ${t}`,e.measureText(iO).width}function aO(e,t,n){if(bu.size>=Math.max(1,n)){const i=bu.keys().next().value;i&&bu.delete(i)}bu.set(e,t)}const Dl={min:12,max:18,step:1,defaultValue:14},ju={source:"builtin",id:"manrope",size:Dl.defaultValue},jf=[{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 oO(e){if(!e||typeof e!="object")return ju;const t=e,n=lO(t.size);if(t.source==="builtin"&&uO(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=gp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return ju}function lO(e){return typeof e!="number"||!Number.isInteger(e)||e<Dl.min||e>Dl.max?Dl.defaultValue:e}function VE(e){return e.source==="system"?Df(e.familyName,jf[0].family):cO(e.id).family}function cO(e){return jf.find(t=>t.id===e)??jf[0]}function uO(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const yv="fleet-console.activeTheaterId",YE="fleet-console.commissioningSeen",XE="fleet-console.whatsNewSeenVersion",ZE="fleet-console.notificationPreferences",JE=1,hO="instrument",Od={globalMute:!1,dnd:!1,mutedTheaterIds:{}},bv=new Set;let Ox=0,Sv=null,Ge={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:hO,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:HO(),codexReader:null,codexReaderExpanded:!1};function Ku(){return Ge}function QE(e){return bv.add(e),()=>{bv.delete(e)}}function lt(e){Ge={...Ge,...e},BO()}function dO(e){Ge.operationsViewActive!==e&<({operationsViewActive:e})}function If(e){_O(e),lt({activeTheme:e})}function wv(e){yO(e)}function fO(e){lt({channel:e.channel,version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...o5({...Ge,version:e.version})})}function pO(){lt({releaseNotesLoading:!0,releaseNotesError:null})}function mO(e){const t={...Ge,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Ge.selectedReleaseNoteKey&&c5(e.notes,Ge.selectedReleaseNoteKey)?Ge.selectedReleaseNoteKey:l5(e.notes)};lt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...o5(t)})}function gO(e){lt({releaseNotesLoading:!1,releaseNotesError:e})}function _O(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function vO(){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 yO(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",VE(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function bO(e){const t=a5(e,Ge.activeTheaterId);lt({theaters:e,activeTheaterId:t})}function SO(e){bO(e.theaters)}function cs(e){lt({operations:e,operationsHydrated:!0})}function wO(e){const t=new Set(e.map(i=>i.id)),n=Ge.operations.filter(i=>!t.has(i.id));lt({operations:[...e,...n],operationsHydrated:!0})}function xO(e){const t=Ge.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Ge.operations];n[t]=e,lt({operations:n})}function ho(e){lt({groups:e})}function CO(e){_p(e),lt({activeTheaterId:e})}function Ui(e){Ge.activeOperationId!==e&<({activeOperationId:e})}function kO(e,t){if(t==="idle"){e5(e);return}Ge.operationStatus[e]!==t&<({operationStatus:{...Ge.operationStatus,[e]:t}})}function e5(e){if(!(e in Ge.operationStatus))return;const t={...Ge.operationStatus};delete t[e],lt({operationStatus:t})}function EO(e){if(!e.operationId)return;const t=Ge.operations.find(c=>c.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Ge.theaters.find(c=>c.id===n)?.label??n??"Unknown",r=t.title,o=zO(e.kind);Ox+=1,lt({operationNotifications:{...Ge.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:Ox}}})}function t5(){lt({addingTheater:!0,theaterError:null})}function n5(e){const t=[e,...Ge.theaters.filter(n=>n.id!==e.id)];_p(e.id),lt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function TO(){lt({addingTheater:!1,theaterError:null})}function xv(e){lt({addingTheater:!1,theaterError:e})}function Vu(e){const t=Ge.operations.find(n=>n.id===e);t&&(_p(t.theaterId),lt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:r5(Ge.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function Zg(){Ge.pendingOperationFocus!==null&<({pendingOperationFocus:null})}function AO(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,r=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[r]??null}function Lb(e,t){if(t.length===0)return[...e].sort(Cv);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),c=n.get(r.id);return o!==void 0&&c!==void 0?o-c:o!==void 0?-1:c!==void 0?1:Cv(i,r)})}function i5(e,t,n,i=[]){const r=Lb(e,n),o=new Set(i),c=[...t].sort((p,f)=>p.order-f.order||p.createdAt-f.createdAt),d=new Map;for(const p of c)d.set(p.id,[]);d.set(null,[]);for(const p of r){const f=p.groupId??null;f!==null&&d.has(f)?d.get(f).push(p):d.get(null).push(p)}return[...c.filter(p=>!o.has(p.id)).flatMap(p=>d.get(p.id)??[]),...d.get(null)??[]]}function RO(e,t,n,i,r){const o=new Set(r),c=i5(e,t,n,i),d=c.filter(p=>!o.has(p.id));return(d.length>0?d:c).map(p=>p.id)}function Cv(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Jg(){lt({operationSearchOpen:!1})}function s5(){lt({operationSearchOpen:!Ge.operationSearchOpen})}function LO(){Ge.releaseNotes.length===0||Ge.whatsNewOpen||lt({whatsNewOpen:!0,selectedReleaseNoteKey:Ge.selectedReleaseNoteKey??l5(Ge.releaseNotes)})}function Dd(){Ge.whatsNewOpen&&(Ge.automaticWhatsNewVersion&&GO(Ge.automaticWhatsNewVersion),lt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function Dx(e){c5(Ge.releaseNotes,e)&<({selectedReleaseNoteKey:e})}function Jc(){UO(!0),Ge.onboardingOpen&<({onboardingOpen:!1})}function $r(e){lt({codexReader:e,codexReaderExpanded:!1})}function hf(){Ge.codexReader!==null&<({codexReaderExpanded:!0})}function NO(){lt({codexReaderExpanded:!1})}function Qg(){lt({codexReader:null,codexReaderExpanded:!1})}function jx(){if(Ge.bootstrapped)return;const e=Ge.theaters.length===0&&!FO();lt({bootstrapped:!0,onboardingOpen:e?!0:Ge.onboardingOpen})}function Ix(e){const t=Ge.theaters.filter(c=>c.id!==e),n=a5(t,Ge.activeTheaterId===e?null:Ge.activeTheaterId),i=PO(Ge.operationNotifications,e),r=new Set(Ge.operations.filter(c=>c.theaterId===e).map(c=>c.id)),o=Ge.activeOperationId&&r.has(Ge.activeOperationId)?null:Ge.activeOperationId;_p(n),lt({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function MO(e){const t=r5(Ge.operationNotifications,e);t!==Ge.operationNotifications&<({operationNotifications:t})}function OO(e){const t={...Ge.notificationPreferences,globalMute:e};Mb(t),lt({notificationPreferences:t})}function DO(e){const t={...Ge.notificationPreferences,dnd:e};Mb(t),lt({notificationPreferences:t})}function jO(e){const t={...Ge.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Ge.notificationPreferences,mutedTheaterIds:t};Mb(n),lt({notificationPreferences:n})}function IO(e){return X4(e)}function BO(){for(const e of bv)e()}function r5(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function PO(e,t){let n=!1;const i={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[r]=o}return n?i:e}function a5(e,t){const n=new Set(e.map(r=>r.id)),i=$O();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function zO(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function o5(e){const t=e.releaseNotes.findIndex(i=>i.version!=="Unreleased"),n=t>=0?e.releaseNotes[t]:void 0;return!n||!e.version||n.version!==e.version||WO()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:Nb(n.version,t)}}function l5(e){return e[0]?Nb(e[0].version,0):null}function c5(e,t){return e.some((n,i)=>Nb(n.version,i)===t)}function Nb(e,t){return`${e}:${t}`}function $O(){if(typeof window>"u")return null;try{return window.localStorage.getItem(yv)}catch{return null}}function _p(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(yv,e):window.localStorage.removeItem(yv)}catch{}}function HO(){if(typeof window>"u")return Od;try{const e=window.localStorage.getItem(ZE);if(!e)return Od;const t=JSON.parse(e);return qO(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Od}catch{return Od}}function FO(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(YE)==="1"}catch{return!1}}function UO(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(YE,"1")}catch{}}function WO(){if(Sv!==null)return Sv;if(typeof window>"u")return null;try{return window.localStorage.getItem(XE)}catch{return null}}function GO(e){if(Sv=e,!(typeof window>"u"))try{window.localStorage.setItem(XE,e)}catch{}}function Mb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ZE,JSON.stringify({version:JE,preferences:e}))}catch{}}function qO(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==JE||!t.preferences||typeof t.preferences!="object")return!1;const n=t.preferences;return typeof n.globalMute=="boolean"&&typeof n.dnd=="boolean"&&!!n.mutedTheaterIds&&typeof n.mutedTheaterIds=="object"}function Ks(){return y.useSyncExternalStore(QE,Ku,Ku)}const KO=[{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"}]}],Su="data-keyboard-shortcuts-open",VO='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function u5(){return document.body.getAttribute(Su)==="true"}function YO(){return!u5()}function XO({onClose:e}){const t=y.useRef(null);y.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Su);return document.body.setAttribute(Su,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Su):document.body.setAttribute(Su,o),r&&(r.inert=!1)}},[e]);const n=i=>{if(i.key==="Escape"){i.preventDefault(),e();return}if(i.key!=="Tab")return;const r=[...t.current?.querySelectorAll(VO)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],c=r[r.length-1],d=document.activeElement;(d===t.current||!t.current?.contains(d)||(i.shiftKey?d===o:d===c))&&(i.preventDefault(),(i.shiftKey?c:o)?.focus())};return Ha.createPortal(u.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:u.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:n,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[u.jsx("strong",{children:"Keyboard Shortcuts"}),u.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),KO.map(i=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:i.title}),u.jsx("dl",{children:i.entries.map(r=>u.jsxs("div",{children:[u.jsx("dt",{children:r.combos.map((o,c)=>u.jsxs("span",{children:[c>0?" or ":null,o.map(d=>u.jsx("kbd",{children:d==="Mod"?"⌘/Ctrl":d},d))]},o.join("+")))}),u.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const ZO=1400,JO="https://github.com/sbluemin/fleet-harness",QO="https://github.com/sbluemin/fleet-harness/stargazers",eD="https://api.github.com/repos/sbluemin/fleet-harness",Ob="fleet-console.github-stars",tD=360*60*1e3,Bx='[role="menuitem"]:not([disabled])';function nD(){const e=Ks();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(sD,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(rD,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function iD({className:e="brand-foot-home"}){return u.jsxs(Gu,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(gD,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function sD({latestVersion:e,updateAvailable:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),d=Jl();h5(n,i,r,o,c);const p=f=>{c(!1),d(f),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>c(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[u.jsx(Px,{}),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(Px,{}),u.jsx("span",{children:"Settings"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(aD,{latestVersion:e})]}):null]}):null]})}function rD({releaseDisabled:e,version:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),[d,p]=y.useState(!1);return h5(n,i,r,o,c),u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>c(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:u.jsx(_D,{})}),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),LO()},children:[u.jsx(vD,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),p(!0)},children:[u.jsx(yD,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(oD,{menuItem:!0,version:t})]}):null,d?u.jsx(XO,{onClose:()=>{p(!1),i.current?.focus()}}):null]})}function h5(e,t,n,i,r){y.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(Bx)?.focus()}),c=p=>{p.target instanceof Node&&e.current?.contains(p.target)||r(!1)},d=p=>{if(p.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(p.key))return;const f=[...n.current?.querySelectorAll(Bx)??[]];if(f.length===0)return;p.preventDefault();const g=f.findIndex(b=>b===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)}},[n,i,e,r,t])}function aD({latestVersion:e}){const[t,n]=y.useState("idle"),[i,r]=y.useState(null),o=y.useRef(null),c=lD(t,i,e);y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const d=async()=>{if(!c.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await L4()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},ZO)}catch(p){const f=p instanceof Vt?p.message:"network_error";r(f),n(uD(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 oD({menuItem:e=!1,version:t}){const n=hD(),i=n.count!==null;return u.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"brand-foot-github-link",href:JO,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(bD,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:QO,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":i?`GitHub stars ${n.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(SD,{}),i?u.jsx("span",{className:"brand-foot-github-stars-count",children:mD(n.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function lD(e,t,n){const i=n?`Latest version ${n}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?cD(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:i,tone:"warn",disabled:!1}}function cD(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 uD(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function hD(){const[e,t]=y.useState(()=>{const n=dD();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return y.useEffect(()=>{if(fD())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(eD,{headers:{Accept:"application/vnd.github+json"}}).then(i=>i.ok?i.json():Promise.reject(new Error(`status ${i.status}`))).then(i=>{if(n)return;const r=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}pD(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function dD(){try{const e=window.localStorage.getItem(Ob);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function fD(){try{const e=window.localStorage.getItem(Ob);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<tD}catch{return!1}}function pD(e){try{window.localStorage.setItem(Ob,JSON.stringify({count:e,at:Date.now()}))}catch{}}function mD(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function gD(){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 Px(){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 _D(){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 vD(){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 yD(){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 bD(){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 SD(){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 wD=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class Ws extends Error{status;constructor(t,n){super(n),this.status=t}}async function xD(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await yp(n),f5(await n.json(),n.status)}async function d5(e,t,n){t!==null&&p5(t);const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:n});return await yp(i),f5(await i.json(),i.status)}async function CD(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await yp(n),ED(await n.json(),n.status)}async function kD(e,t,n){t!==null&&p5(t);const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:n});return await yp(i),TD(await i.json(),i.status)}function f5(e,t=200){Yu(e,t);const n=e;if(n.kind!=="root"&&n.kind!=="worktree"&&n.kind!=="directory"||!m5(n.label))throw new Ws(t,"Invalid path context response");if(n.relPath!==null&&(typeof n.relPath!="string"||!vp(n.relPath)))throw new Ws(t,"Invalid path context response");if(n.kind==="root"!=(n.relPath===null))throw new Ws(t,"Invalid path context response");return{kind:n.kind,relPath:n.relPath,label:n.label}}function ED(e,t=200){Yu(e,t);const n=e;if(typeof n.isGitRepo!="boolean"||!Array.isArray(n.worktrees))throw new Ws(t,"Invalid worktrees response");return{isGitRepo:n.isGitRepo,worktrees:n.worktrees.map(i=>{Yu(i,t);const r=i;if(typeof r.relPath!="string"||!vp(r.relPath)||r.branch!==null&&typeof r.branch!="string"||typeof r.isCurrent!="boolean")throw new Ws(t,"Invalid worktrees response");return{relPath:r.relPath,branch:r.branch,isCurrent:r.isCurrent}})}}function TD(e,t=200){Yu(e,t);const n=e;if(!Array.isArray(n.directories))throw new Ws(t,"Invalid directories response");return n.directories.map(i=>{Yu(i,t);const r=i;if(typeof r.relPath!="string"||!vp(r.relPath)||!m5(r.label))throw new Ws(t,"Invalid directories response");return{relPath:r.relPath,label:r.label}})}function p5(e){if(!vp(e))throw new Ws(400,"Invalid relative path")}function vp(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 m5(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function Yu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Ws(t,"Invalid path context response");for(const n of Object.keys(e))if(wD.has(n.toLowerCase()))throw new Ws(t,"Unsafe path context response")}async function yp(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Ws(e.status,t)}function AD({theaterId:e,parentPath:t,selectedRelPath:n,isDisabled:i,loadDirectories:r,onSelect:o}){const[c,d]=y.useState(null),[p,f]=y.useState(null);return y.useEffect(()=>{const g=new AbortController;return d(null),f(null),r(t,g.signal).then(d).catch(v=>{g.signal.aborted||f(v instanceof Error?v.message:"Unable to load directories")}),()=>g.abort()},[e,t,r]),p?y.createElement("div",{className:"rail-context-tree-status"},p):c?y.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},c.map(g=>y.createElement(g5,{key:g.relPath,directory:g,theaterId:e,depth:0,selectedRelPath:n,isDisabled:i,loadDirectories:r,onSelect:o}))):y.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function g5({directory:e,theaterId:t,depth:n,selectedRelPath:i,isDisabled:r,loadDirectories:o,onSelect:c}){const[d,p]=y.useState(!1),[f,g]=y.useState(null),[v,b]=y.useState(!1),S=y.useCallback(()=>{if(d){p(!1);return}if(p(!0),f)return;const E=new AbortController;b(!0),o(e.relPath,E.signal).then(g).catch(()=>g([])).finally(()=>b(!1))},[f,e.relPath,d,o]),w=y.createElement("div",{className:`rail-context-tree-row${n>0?" is-nested":""}`,style:{paddingLeft:`${n*16}px`}},y.createElement("button",{className:`rail-context-expand${d?" is-expanded":""}`,type:"button",disabled:r,"aria-label":`${d?"Collapse":"Expand"} ${e.label}`,onClick:S},"▸"),y.createElement("button",{className:`rail-context-select${i===e.relPath?" is-selected":""}`,type:"button",disabled:r,onClick:()=>c(e.relPath)},y.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),y.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),y.createElement("span",{className:"rail-context-row-label"},e.label))),x=d&&f?.map(E=>y.createElement(g5,{key:E.relPath,directory:E,theaterId:t,depth:n+1,selectedRelPath:i,isDisabled:r,loadDirectories:o,onSelect:c}));return y.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":d},w,d&&v?y.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,x)}const _5=y.forwardRef(function({className:t,theaterId:n,theaterLabel:i,context:r,isMutating:o,onSelect:c,onClose:d},p){const[f,g]=y.useState(null);y.useEffect(()=>{const S=new AbortController;return CD(n,S.signal).then(g).catch(()=>g({isGitRepo:!1,worktrees:[]})),()=>S.abort()},[n]),y.useEffect(()=>{const S=w=>{w.key==="Escape"&&d()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[d]);const v=y.useCallback((S,w)=>kD(n,S,w),[n]),b=y.useCallback(S=>{o||c(S)},[o,c]);return u.jsxs("div",{ref:p,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[u.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),u.jsxs("button",{className:`rail-context-row${r.relPath===null?" is-selected":""}`,type:"button",disabled:o,onClick:()=>b(null),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),u.jsx("span",{className:"rail-context-row-label",children:i}),u.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),u.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[u.jsx("h3",{children:"DIRECTORIES"}),u.jsx(AD,{theaterId:n,parentPath:null,selectedRelPath:r.relPath,isDisabled:o,loadDirectories:v,onSelect:b},`${n}:${r.relPath??"root"}`)]}),f?.isGitRepo?u.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[u.jsx("h3",{children:"WORKTREES"}),f.worktrees.map(S=>u.jsxs("button",{className:`rail-context-row${r.relPath===S.relPath?" is-selected":""}`,type:"button",title:S.relPath,disabled:o,onClick:()=>b(S.relPath),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),u.jsx("span",{className:"rail-context-row-label",children:S.relPath.split("/").at(-1)}),S.branch?u.jsx("span",{className:"rail-context-row-secondary",children:S.branch}):null]},S.relPath))]}):null,u.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),kv="fleet-console.rail.activePanelId",v5="fleet-console.rail.chromeExpanded",Ev=new Set,yo=new Map,Tv=new Map,jl=new Map,Iu=new Map;let Bf=null,wu=0,bt={activeRailPanelId:BD(),railChromeExpanded:PD(),rightRailWidth:44,panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function RD(e,t,n){return!e||t===null||n}function fh(e){return Ev.add(e),()=>{Ev.delete(e)}}function ph(){return bt}function LD(e){const t=bt.activeRailPanelId===e?null:e;Gi({...bt,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),k5(t)}function ND(){bt.activeRailPanelId!==null&&(Gi({...bt,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),k5(null))}function MD(e){bt.railChromeExpanded!==e&&(Gi({...bt,railChromeExpanded:e,isPathContextDeckOpen:!1}),zD(e))}function y5(){MD(!bt.railChromeExpanded)}function zx(e){const t=Number.isFinite(e)?Math.max(0,e):0;bt.rightRailWidth!==t&&Gi({...bt,rightRailWidth:t})}function OD(e,t){if(e!==bt.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),r=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;r!==bt.panelExtraWidth&&Gi({...bt,panelExtraWidth:r})}function b5(e){Bf?.abort(),Bf=null,wu+=1;const t=e?yo.get(e):void 0;Gi({...bt,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&E5(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function DD(e,t){bt.pathContextTheaterId!==e&&b5(e),Bf?.abort();const n=new AbortController;Bf=n;const i=++wu,r=Iu.get(e)??0;yo.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),bt.pathContextTheaterId===e&&Gi({...bt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(Tv.get(e)??Promise.resolve()),n.signal.aborted||i!==wu)return;const o=await t(n.signal);if(n.signal.aborted||i!==wu||r!==(Iu.get(e)??0))return;const c={context:o,isHydrated:!0,isLoading:!1,error:null};yo.set(e,c),bt.pathContextTheaterId===e&&Gi({...bt,pathContext:o,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(o){if(n.signal.aborted||i!==wu||r!==(Iu.get(e)??0))return;const c=o instanceof Error?o.message:"Unable to load path context";yo.set(e,{context:null,isHydrated:!1,isLoading:!1,error:c}),bt.pathContextTheaterId===e&&Gi({...bt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:c})}}async function S5(e,t){if(bt.pathContextTheaterId!==e)return null;Iu.set(e,(Iu.get(e)??0)+1),HD(e);const i=(Tv.get(e)??Promise.resolve()).then(()=>$D(e,t));return Tv.set(e,i.then(()=>{})),i}function df(e){e!==bt.isPathContextDeckOpen&&Gi({...bt,isPathContextDeckOpen:e})}function w5(){return y.useSyncExternalStore(fh,ph).activeRailPanelId}function x5(){return y.useSyncExternalStore(fh,ph).railChromeExpanded}function jD(){return y.useSyncExternalStore(fh,ph).rightRailWidth}function ID(){return y.useSyncExternalStore(fh,ph).panelExtraWidth}function C5(){return y.useSyncExternalStore(fh,ph)}function BD(){try{return localStorage.getItem(kv)}catch{return null}}function PD(){try{return localStorage.getItem(v5)!=="0"}catch{return!0}}function k5(e){try{e===null?localStorage.removeItem(kv):localStorage.setItem(kv,e)}catch{}}function zD(e){try{localStorage.setItem(v5,e?"1":"0")}catch{}}async function $D(e,t){try{const n=await t(new AbortController().signal),i={context:n,isHydrated:!0,isLoading:!1,error:null};return yo.set(e,i),bt.pathContextTheaterId===e&&Gi({...bt,pathContext:n,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),n}catch(n){const i=n instanceof Error?n.message:"Unable to save path context",r=yo.get(e);return yo.set(e,{context:r?.context??null,isHydrated:r?.isHydrated??!1,isLoading:!1,error:i}),bt.pathContextTheaterId===e&&Gi({...bt,pathContextError:i}),null}finally{FD(e)}}function E5(e){return(jl.get(e)??0)>0}function HD(e){jl.set(e,(jl.get(e)??0)+1),bt.pathContextTheaterId===e&&Gi({...bt,pathContextMutationInProgress:!0,pathContextError:null})}function FD(e){const t=(jl.get(e)??1)-1;t>0?jl.set(e,t):jl.delete(e),bt.pathContextTheaterId===e&&Gi({...bt,pathContextMutationInProgress:E5(e)})}function Gi(e){bt=e;for(const t of Ev)t()}function T5(e){const{sizeRange:t}=e,[n,i]=y.useState(""),[r,o]=y.useState(e.size),c=y.useRef(Promise.resolve()),d=y.useId(),p=y.useMemo(()=>UD(e),[e]),f=y.useMemo(()=>WD(p,n),[p,n]),g=y.useMemo(()=>f.map((O,H)=>({row:O,index:H})),[f]),[v,b]=y.useState(()=>GD(p,e.selected)),S=p.find(O=>Pf(O.selection,e.selected))??null,w=g[Math.min(v,Math.max(0,g.length-1))]?.row??null,x=`${d}-built-ins`,E=`${d}-installed`;y.useEffect(()=>{o(e.size)},[e.size]),y.useEffect(()=>{v>=g.length&&b(Math.max(0,g.length-1))},[v,g.length]);const A=y.useCallback(O=>{const H=Hx(O,t);o(H),c.current=c.current.catch(()=>{}).then(()=>e.onSizeCommit(H))},[e.onSizeCommit,t]),L=y.useCallback(O=>{f.length&&b(H=>(H+O+f.length)%f.length)},[f.length]),I=y.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),R=y.useCallback((O,H)=>{b(O),e.onSelectionChange(H)},[e]),z=O=>{O.key==="ArrowDown"?(O.preventDefault(),L(1)):O.key==="ArrowUp"?(O.preventDefault(),L(-1)):O.key==="Home"?(O.preventDefault(),b(0)):O.key==="End"?(O.preventDefault(),b(Math.max(0,f.length-1))):(O.key==="Enter"||O.key===" ")&&(O.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:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:O=>{i(O.currentTarget.value),b(0)}}),e.loading?u.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?u.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,u.jsxs("div",{id:d,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?A5(d,v):void 0,"aria-busy":e.loading||void 0,onKeyDown:z,children:[u.jsx($x,{groupId:x,label:"Built-in",rows:g.filter(({row:O})=>O.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:R}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx($x,{groupId:E,label:"Installed on this machine",rows:g.filter(({row:O})=>O.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:R}),!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:()=>A(r-t.step),"aria-label":"Decrease font size",children:"−"}),u.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>A(r+t.step),"aria-label":"Increase font size",children:"+"})]}),u.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:O=>o(Hx(Number(O.currentTarget.value),t)),onPointerUp:O=>A(Number(O.currentTarget.value)),onKeyUp:O=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(O.key)&&A(Number(O.currentTarget.value))}})]})]})})}function $x({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:c,onSelect:d}){return u.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[u.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:p,index:f})=>u.jsxs("button",{id:A5(o,f),type:"button",className:`fc-font-browser__row${Pf(p.selection,i?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Pf(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 UD(e){const t=new Set,n=e.builtIns.flatMap(o=>{const c=[o.id,o.label,...o.aliases??[]].map(Bu);return c.some(d=>t.has(d))?[]:(c.forEach(d=>t.add(d)),[{id:`builtin-${o.id}`,label:o.label,family:o.family,previewFamily:o.family,source:"builtin",selection:{source:"builtin",id:o.id},description:o.description,unavailable:!1}])}),i=e.installedFonts.map(o=>({id:`system-${Bu(o.family)}`,label:o.family,family:o.family,previewFamily:Df(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!rO(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${Bu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:Df(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function WD(e,t){const n=Bu(t);return n?e.filter(i=>Bu(`${i.label} ${i.description??""}`).includes(n)):e}function Bu(e){return e.trim().toLocaleLowerCase()}function A5(e,t){return`${e}-option-${t}`}function GD(e,t){const n=e.findIndex(i=>Pf(i.selection,t));return n>=0?n:0}function Pf(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function Hx(e,t){if(!Number.isFinite(e))return t.defaultValue;const n=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,n))}const qD="/api/v1/settings/fonts/system";class Tl extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function KD(e){if(!L5(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new Tl("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(VD)}}async function R5(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new Tl("System font fetching is unavailable in this environment.");let n;try{n=await t(qD,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new Tl("System fonts could not be loaded.")}if(!n.ok)throw new Tl("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new Tl("System font response is not valid JSON.",n.status)}return KD(i)}function VD(e){if(!L5(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new Tl("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function YD(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L5(e,t){return YD(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const Fx=250,XD=5e3,Ux=1,ZD=1013,JD=4e3,QD=4001;function ej(e){const t=new AbortController,n=new TextEncoder;let i=Fx,r=null,o=null,c=null,d=!1;const p=()=>{o?.dispose(),o=null},f=(b,S)=>{c={cols:b,rows:S},r?.readyState===Ux&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await nj(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await v(tj(b,e.location,e.wsPath),e),i=Fx}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await sj(i,t.signal),i=Math.min(i*2,XD)}},v=async(b,S)=>{await new Promise((w,x)=>{const E=(S.webSocketFactory??ij)(b);r=E,E.binaryType="arraybuffer",E.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(A=>{E.readyState===Ux&&E.send(n.encode(A))}),c&&f(c.cols,c.rows)},E.onmessage=A=>{A.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(A.data))},E.onerror=()=>{x(new Error("Terminal WebSocket error"))},E.onclose=A=>{p(),r===E&&(r=null);const L=A?.code;L===JD?(t.abort(),S.onStatus?.("closed","terminal_replaced")):L===QD?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):L===ZD&&(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 tj(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function nj(e,t,n){const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:n});if(!i.ok)throw new Error(`Terminal ticket request failed: ${i.status}`);const r=await i.json();if(typeof r.ticket!="string"||typeof r.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:r.ticket,ttlMs:r.ttlMs}}function ij(e){return new WebSocket(e)}async function sj(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var rj=2,aj=1,oj=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=c.top+c.bottom,p=c.right+c.left,f=i-d,g=r-p-t;return{cols:Math.max(rj,Math.floor(g/e.css.cell.width)),rows:Math.max(aj,Math.floor(f/e.css.cell.height))}}};var e_=[[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]],lj=[[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]],Pn;function cj(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var uj=class{constructor(){if(this.version="6",!Pn){Pn=new Uint8Array(65536),Pn.fill(1),Pn[0]=0,Pn.fill(0,1,32),Pn.fill(0,127,160),Pn.fill(2,4352,4448),Pn[9001]=2,Pn[9002]=2,Pn.fill(2,11904,42192),Pn[12351]=1,Pn.fill(2,44032,55204),Pn.fill(2,63744,64256),Pn.fill(2,65040,65050),Pn.fill(2,65072,65136),Pn.fill(2,65280,65377),Pn.fill(2,65504,65511);for(let t=0;t<e_.length;++t)Pn.fill(0,e_[t][0],e_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Pn[t]:cj(t,lj)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=$f.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return $f.createPropertyValue(0,i,r)}},hj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Wx.isErrorNoTelemetry(t)?new Wx(t.message+`
|
|
12
|
-
|
|
13
|
-
`+t.stack):new Error(t.message+`
|
|
14
|
-
|
|
15
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(n=>{n(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},dj=new hj;function t_(e){fj(e)||dj.onUnexpectedError(e)}var Av="Canceled";function fj(e){return e instanceof pj?!0:e instanceof Error&&e.name===Av&&e.message===Av}var pj=class extends Error{constructor(){super(Av),this.name=this.message}},Wx=class Rv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Rv)return t;let n=new Rv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function mj(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var gj;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(gj||={});var N5;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(R){yield R}e.single=r;function o(R){return t(R)?R:r(R)}e.wrap=o;function c(R){return R||n}e.from=c;function*d(R){for(let z=R.length-1;z>=0;z--)yield R[z]}e.reverse=d;function p(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function g(R,z){let O=0;for(let H of R)if(z(H,O++))return!0;return!1}e.some=g;function v(R,z){for(let O of R)if(z(O))return O}e.find=v;function*b(R,z){for(let O of R)z(O)&&(yield O)}e.filter=b;function*S(R,z){let O=0;for(let H of R)yield z(H,O++)}e.map=S;function*w(R,z){let O=0;for(let H of R)yield*z(H,O++)}e.flatMap=w;function*x(...R){for(let z of R)yield*z}e.concat=x;function E(R,z,O){let H=O;for(let F of R)H=z(H,F);return H}e.reduce=E;function*A(R,z,O=R.length){for(z<0&&(z+=R.length),O<0?O+=R.length:O>R.length&&(O=R.length);z<O;z++)yield R[z]}e.slice=A;function L(R,z=Number.POSITIVE_INFINITY){let O=[];if(z===0)return[O,R];let H=R[Symbol.iterator]();for(let F=0;F<z;F++){let ae=H.next();if(ae.done)return[O,e.empty()];O.push(ae.value)}return[O,{[Symbol.iterator](){return H}}]}e.consume=L;async function I(R){let z=[];for await(let O of R)z.push(O);return Promise.resolve(z)}e.asyncToArray=I})(N5||={});function M5(e){if(N5.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function _j(...e){return O5(()=>M5(e))}function O5(e){return{dispose:mj(()=>{e()})}}var D5=class j5{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{M5(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?j5.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)}};D5.DISABLE_DISPOSED_WARNING=!1;var Db=D5,zf=class{constructor(){this._store=new Db,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)}};zf.None=Object.freeze({dispose(){}});var vj=globalThis.performance&&typeof globalThis.performance.now=="function",yj=class I5{static create(t){return new I5(t)}constructor(t){this._now=vj&&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}},bj;(e=>{e.None=()=>zf.None;function t($,N){return v($,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n($){return(N,D=null,T)=>{let k=!1,j;return j=$(B=>{if(!k)return j?j.dispose():k=!0,N.call(D,B)},null,T),k&&j.dispose(),j}}e.once=n;function i($,N,D){return f((T,k=null,j)=>$(B=>T.call(k,N(B)),null,j),D)}e.map=i;function r($,N,D){return f((T,k=null,j)=>$(B=>{N(B),T.call(k,B)},null,j),D)}e.forEach=r;function o($,N,D){return f((T,k=null,j)=>$(B=>N(B)&&T.call(k,B),null,j),D)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(N,D=null,T)=>{let k=_j(...$.map(j=>j(B=>N.call(D,B))));return g(k,T)}}e.any=d;function p($,N,D,T){let k=D;return i($,j=>(k=N(k,j),k),T)}e.reduce=p;function f($,N){let D,T={onWillAddFirstListener(){D=$(k.fire,k)},onDidRemoveLastListener(){D?.dispose()}},k=new Ta(T);return N?.add(k),k.event}function g($,N){return N instanceof Array?N.push($):N&&N.add($),$}function v($,N,D=100,T=!1,k=!1,j,B){let q,J,P,X=0,Q,Y={leakWarningThreshold:j,onWillAddFirstListener(){q=$(me=>{X++,J=N(J,me),T&&!P&&(ie.fire(J),J=void 0),Q=()=>{let ye=J;J=void 0,P=void 0,(!T||X>1)&&ie.fire(ye),X=0},typeof D=="number"?(clearTimeout(P),P=setTimeout(Q,D)):P===void 0&&(P=0,queueMicrotask(Q))})},onWillRemoveListener(){k&&X>0&&Q?.()},onDidRemoveLastListener(){Q=void 0,q.dispose()}},ie=new Ta(Y);return B?.add(ie),ie.event}e.debounce=v;function b($,N=0,D){return e.debounce($,(T,k)=>T?(T.push(k),T):[k],N,void 0,!0,void 0,D)}e.accumulate=b;function S($,N=(T,k)=>T===k,D){let T=!0,k;return o($,j=>{let B=T||!N(j,k);return T=!1,k=j,B},D)}e.latch=S;function w($,N,D){return[e.filter($,N,D),e.filter($,T=>!N(T),D)]}e.split=w;function x($,N=!1,D=[],T){let k=D.slice(),j=$(J=>{k?k.push(J):q.fire(J)});T&&T.add(j);let B=()=>{k?.forEach(J=>q.fire(J)),k=null},q=new Ta({onWillAddFirstListener(){j||(j=$(J=>q.fire(J)),T&&T.add(j))},onDidAddFirstListener(){k&&(N?setTimeout(B):B())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(q),q.event}e.buffer=x;function E($,N){return(D,T,k)=>{let j=N(new L);return $(function(B){let q=j.evaluate(B);q!==A&&D.call(T,q)},void 0,k)}}e.chain=E;let A=Symbol("HaltChainable");class L{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:A),this}reduce(N,D){let T=D;return this.steps.push(k=>(T=N(T,k),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(k=>{let j=D||!N(k,T);return D=!1,T=k,j?k:A}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===A)break;return N}}function I($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.on(N,T),j=()=>$.removeListener(N,T),B=new Ta({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromNodeEventEmitter=I;function R($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.addEventListener(N,T),j=()=>$.removeEventListener(N,T),B=new Ta({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromDOMEventEmitter=R;function z($){return new Promise(N=>n($)(N))}e.toPromise=z;function O($){let N=new Ta;return $.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=O;function H($,N){return $(D=>N.fire(D))}e.forward=H;function F($,N,D){return N(D),$(T=>N(T))}e.runAndSubscribe=F;class ae{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 Ta(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($,N){return new ae($,N).emitter.event}e.fromObservable=fe;function V($){return(N,D,T)=>{let k=0,j=!1,B={beginUpdate(){k++},endUpdate(){k--,k===0&&($.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};$.addObserver(B),$.reportChanges();let q={dispose(){$.removeObserver(B)}};return T instanceof Db?T.add(q):Array.isArray(T)&&T.push(q),q}}e.fromObservableLight=V})(bj||={});var Lv=class Nv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Nv._idPool++}`,Nv.all.add(this)}start(t){this._stopWatch=new yj,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}}};Lv.all=new Set,Lv._idPool=0;var Sj=Lv,wj=-1,B5=class P5{constructor(t,n,i=(P5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new 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,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};B5._idPool=1;var xj=B5,Cj=class z5{constructor(t){this.value=t}static create(){let t=new Error;return new z5(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
-
`).slice(2).join(`
|
|
17
|
-
`))}},kj=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},Ej=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},Tj=0,n_=class{constructor(t){this.value=t,this.id=Tj++}},Aj=2,Rj,Ta=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new xj(t?.onListenerError??t_,this._options?.leakWarningThreshold??wj):void 0,this._perfMon=this._options?._profName?new Sj(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Ej(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||t_)(f),zf.None}if(this._disposed)return zf.None;n&&(t=t.bind(n));let r=new n_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Cj.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof n_?(this._deliveryQueue??=new Lj,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=O5(()=>{o?.(),this._removeListener(r)});return i instanceof Db?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Aj<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||t_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof n_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Lj=class{constructor(){this.i=-1,this.end=0}enqueue(t,n,i){this.i=0,this.end=i,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$f=class ff{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ta,this.onChange=this._onChange.event;let t=new uj;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let d=this.charProperties(c,i),p=ff.extractWidth(d);ff.extractShouldJoin(d)&&(p-=ff.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},i_=[[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]],s_=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],Mj=[[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]],Mr;function Gx(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var Oj=class{constructor(){if(this.version="11",!Mr){Mr=new Uint8Array(65536),Mr.fill(1),Mr[0]=0,Mr.fill(0,1,32),Mr.fill(0,127,160);for(let t=0;t<i_.length;++t)Mr.fill(0,i_[t][0],i_[t][1]+1);for(let t=0;t<s_.length;++t)Mr.fill(2,s_[t][0],s_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Mr[t]:Gx(t,Nj)?0:Gx(t,Mj)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=$f.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return $f.createPropertyValue(0,i,r)}},Dj=class{activate(t){t.unicode.register(new Oj)}dispose(){}};var jj=(e,t,n,i)=>{for(var r=t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},Ij=(e,t)=>(n,i)=>t(n,i,e),Bj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?qx.isErrorNoTelemetry(e)?new qx(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)}},Pj=new Bj;function r_(e){zj(e)||Pj.onUnexpectedError(e)}var Mv="Canceled";function zj(e){return e instanceof $j?!0:e instanceof Error&&e.name===Mv&&e.message===Mv}var $j=class extends Error{constructor(){super(Mv),this.name=this.message}},qx=class Ov extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ov)return t;let n=new Ov;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Hj;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Hj||={});function Fj(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var $5;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(R){yield R}e.single=r;function o(R){return t(R)?R:r(R)}e.wrap=o;function c(R){return R||n}e.from=c;function*d(R){for(let z=R.length-1;z>=0;z--)yield R[z]}e.reverse=d;function p(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function g(R,z){let O=0;for(let H of R)if(z(H,O++))return!0;return!1}e.some=g;function v(R,z){for(let O of R)if(z(O))return O}e.find=v;function*b(R,z){for(let O of R)z(O)&&(yield O)}e.filter=b;function*S(R,z){let O=0;for(let H of R)yield z(H,O++)}e.map=S;function*w(R,z){let O=0;for(let H of R)yield*z(H,O++)}e.flatMap=w;function*x(...R){for(let z of R)yield*z}e.concat=x;function E(R,z,O){let H=O;for(let F of R)H=z(H,F);return H}e.reduce=E;function*A(R,z,O=R.length){for(z<0&&(z+=R.length),O<0?O+=R.length:O>R.length&&(O=R.length);z<O;z++)yield R[z]}e.slice=A;function L(R,z=Number.POSITIVE_INFINITY){let O=[];if(z===0)return[O,R];let H=R[Symbol.iterator]();for(let F=0;F<z;F++){let ae=H.next();if(ae.done)return[O,e.empty()];O.push(ae.value)}return[O,{[Symbol.iterator](){return H}}]}e.consume=L;async function I(R){let z=[];for await(let O of R)z.push(O);return Promise.resolve(z)}e.asyncToArray=I})($5||={});function H5(e){if($5.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function F5(...e){return yi(()=>H5(e))}function yi(e){return{dispose:Fj(()=>{e()})}}var U5=class W5{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{H5(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?W5.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)}};U5.DISABLE_DISPOSED_WARNING=!1;var Il=U5,qs=class{constructor(){this._store=new Il,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)}};qs.None=Object.freeze({dispose(){}});var Qc=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}},jb=typeof process<"u"&&"title"in process,bp=jb?"node":navigator.userAgent,Uj=jb?"node":navigator.platform,Wj=bp.includes("Firefox"),Gj=bp.includes("Edge"),G5=/^((?!chrome|android).)*safari/i.test(bp);function qj(){if(!G5)return 0;let e=bp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}Uj.indexOf("Linux")>=0;var Kj="",qn=0,Kn=0,Vn=0,vn=0,Es={css:"#00000000",rgba:0},Ei;(e=>{function t(r,o,c,d){return d!==void 0?`#${ao(r)}${ao(o)}${ao(c)}${ao(d)}`:`#${ao(r)}${ao(o)}${ao(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(Ei||={});var xu;(e=>{function t(p,f){if(vn=(f.rgba&255)/255,vn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,v=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;qn=S+Math.round((g-S)*vn),Kn=w+Math.round((v-w)*vn),Vn=x+Math.round((b-x)*vn);let E=Ei.toCss(qn,Kn,Vn),A=Ei.toRgba(qn,Kn,Vn);return{css:E,rgba:A}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let v=bo.ensureContrastRatio(p.rgba,f.rgba,g);if(v)return Ei.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[qn,Kn,Vn]=bo.toChannels(f),{css:Ei.toCss(qn,Kn,Vn),rgba:f}}e.opaque=r;function o(p,f){return vn=Math.round(f*255),[qn,Kn,Vn]=bo.toChannels(p.rgba),{css:Ei.toCss(qn,Kn,Vn,vn),rgba:Ei.toRgba(qn,Kn,Vn,vn)}}e.opacity=o;function c(p,f){return vn=p.rgba&255,o(p,vn*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(xu||={});var Vj;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return qn=parseInt(r.slice(1,2).repeat(2),16),Kn=parseInt(r.slice(2,3).repeat(2),16),Vn=parseInt(r.slice(3,4).repeat(2),16),Ei.toColor(qn,Kn,Vn);case 5:return qn=parseInt(r.slice(1,2).repeat(2),16),Kn=parseInt(r.slice(2,3).repeat(2),16),Vn=parseInt(r.slice(3,4).repeat(2),16),vn=parseInt(r.slice(4,5).repeat(2),16),Ei.toColor(qn,Kn,Vn,vn);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 qn=parseInt(o[1]),Kn=parseInt(o[2]),Vn=parseInt(o[3]),vn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ei.toColor(qn,Kn,Vn,vn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qn,Kn,Vn,vn]=t.getImageData(0,0,1,1).data,vn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ei.toRgba(qn,Kn,Vn,vn),css:r}}e.toColor=i})(Vj||={});var wi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+v*.0722}e.relativeLuminance2=n})(wi||={});var bo;(e=>{function t(c,d){if(vn=(d&255)/255,vn===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,v=c>>24&255,b=c>>16&255,S=c>>8&255;return qn=v+Math.round((p-v)*vn),Kn=b+Math.round((f-b)*vn),Vn=S+Math.round((g-S)*vn),Ei.toRgba(qn,Kn,Vn)}e.blend=t;function n(c,d,p){let f=wi.relativeLuminance(c>>8),g=wi.relativeLuminance(d>>8);if(Or(f,g)<p){if(g<f){let S=i(c,d,p),w=Or(f,wi.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),E=Or(f,wi.relativeLuminance(x>>8));return w>E?S:x}return S}let v=r(c,d,p),b=Or(f,wi.relativeLuminance(v>>8));if(b<p){let S=i(c,d,p),w=Or(f,wi.relativeLuminance(S>>8));return b>w?v:S}return v}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Or(wi.relativeLuminance2(b,S,w),wi.relativeLuminance2(f,g,v));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Or(wi.relativeLuminance2(b,S,w),wi.relativeLuminance2(f,g,v));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Or(wi.relativeLuminance2(b,S,w),wi.relativeLuminance2(f,g,v));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Or(wi.relativeLuminance2(b,S,w),wi.relativeLuminance2(f,g,v));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(bo||={});function ao(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Or(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function On(e){if(!e)throw new Error("value must not be falsy");return e}function Ib(e){return 57508<=e&&e<=57558}function Yj(e){return 57520<=e&&e<=57527}function Xj(e){return 57344<=e&&e<=63743}function Zj(e){return 9472<=e&&e<=9631}function Jj(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 Qj(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Jj(e)&&!Ib(e)&&!Xj(e)}function q5(e){return Ib(e)||Zj(e)}function e8(){return{css:{canvas:jd(),cell:jd()},device:{canvas:jd(),cell:jd(),char:{width:0,height:0,left:0,top:0}}}}function jd(){return{width:0,height:0}}function t8(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var oi=0,Wn=0,Qs=!1,Dr=!1,Id=!1,$i,a_=0,n8=class{constructor(e,t,n,i,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Wn=0,oi=0,Dr=!1,Qs=!1,Id=!1,$i=this._themeService.colors,a_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));a_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(Wn=r.backgroundColorRGB.rgba>>8&16777215,Dr=!0),r.foregroundColorRGB&&(oi=r.foregroundColorRGB.rgba>>8&16777215,Qs=!0)}),Id=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Id){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Wn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Wn=(this.result.fg&16777215)<<8|255;break;default:Wn=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Wn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Wn=(this.result.bg&16777215)<<8|255;break}Wn=bo.blend(Wn,(this._coreBrowserService.isFocused?$i.selectionBackgroundOpaque:$i.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Wn=(this._coreBrowserService.isFocused?$i.selectionBackgroundOpaque:$i.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Dr=!0,$i.selectionForeground&&(oi=$i.selectionForeground.rgba>>8&16777215,Qs=!0),q5(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)oi=(this._coreBrowserService.isFocused?$i.selectionBackgroundOpaque:$i.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:oi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:oi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:oi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:oi=(this.result.fg&16777215)<<8|255;break;default:oi=this._themeService.colors.foreground.rgba}oi=bo.blend(oi,(this._coreBrowserService.isFocused?$i.selectionBackgroundOpaque:$i.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Qs=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(Wn=r.backgroundColorRGB.rgba>>8&16777215,Dr=!0),r.foregroundColorRGB&&(oi=r.foregroundColorRGB.rgba>>8&16777215,Qs=!0)}),Dr&&(Id?Wn=e.bg&-16777216&-134217729|Wn|50331648:Wn=e.bg&-16777216|Wn|50331648),Qs&&(oi=e.fg&-16777216&-67108865|oi|50331648),this.result.fg&67108864&&(Dr&&!Qs&&((this.result.bg&50331648)===0?oi=this.result.fg&-134217728|$i.background.rgba>>8&16777215&16777215|50331648:oi=this.result.fg&-134217728|this.result.bg&67108863,Qs=!0),!Dr&&Qs&&((this.result.fg&50331648)===0?Wn=this.result.bg&-67108864|$i.foreground.rgba>>8&16777215&16777215|50331648:Wn=this.result.bg&-67108864|this.result.fg&67108863,Dr=!0)),$i=void 0,this.result.bg=Dr?Wn:this.result.bg,this.result.fg=Qs?oi:this.result.fg,this.result.ext&=536870911,this.result.ext|=a_<<29&3758096384}},i8=.5,K5=Wj||Gj?"bottom":"ideographic",s8={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},r8={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},a8={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Xu={"":{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}};Xu[""]=Xu[""];Xu[""]=Xu[""];function o8(e,t,n,i,r,o,c,d){let p=s8[t];if(p)return l8(e,p,n,i,r,o),!0;let f=r8[t];if(f)return c8(e,f,n,i,r,o),!0;let g=a8[t];if(g)return u8(e,g,n,i,r,o,d),!0;let v=Xu[t];return v?(h8(e,v,n,i,r,o,c,d),!0):!1}function l8(e,t,n,i,r,o){for(let c=0;c<t.length;c++){let d=t[c],p=r/8,f=o/8;e.fillRect(n+d.x*p,i+d.y*f,d.w*p,d.h*f)}}var Kx=new Map;function c8(e,t,n,i,r,o){let c=Kx.get(t);c||(c=new Map,Kx.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 b=On(v.getContext("2d")),S=new ImageData(f,g),w,x,E,A;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),E=parseInt(d.slice(5,7),16),A=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,E,A]=d.substring(5,d.length-1).split(",").map(L=>parseFloat(L));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let L=0;L<g;L++)for(let I=0;I<f;I++)S.data[(L*f+I)*4]=w,S.data[(L*f+I)*4+1]=x,S.data[(L*f+I)*4+2]=E,S.data[(L*f+I)*4+3]=t[L][I]*(A*255);b.putImageData(S,0,0),p=On(e.createPattern(v,null)),c.set(d,p)}e.fillStyle=p,e.fillRect(n,i,r,o)}function u8(e,t,n,i,r,o,c){e.strokeStyle=e.fillStyle;for(let[d,p]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let f;if(typeof p=="function"){let g=.15/o*r;f=p(.15,g)}else f=p;for(let g of f.split(" ")){let v=g[0],b=V5[v];if(!b){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,Y5(S,r,o,n,i,!0,c))}e.stroke(),e.closePath()}}function h8(e,t,n,i,r,o,c,d){let p=new Path2D;p.rect(n,i,r,o),e.clip(p),e.beginPath();let f=c/12;e.lineWidth=d*f;for(let g of t.d.split(" ")){let v=g[0],b=V5[v];if(!b){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,Y5(S,r,o,n,i,!1,d,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Vx(e,t,n=0){return Math.max(Math.min(e,t),n)}var V5={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 Y5(e,t,n,i,r,o,c,d=0,p=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-d*c-p*c,o&&f[g]!==0&&(f[g]=Vx(Math.round(f[g]+.5)-.5,t,0)),f[g]+=i+d*c;for(let g=1;g<f.length;g+=2)f[g]*=n,o&&f[g]!==0&&(f[g]=Vx(Math.round(f[g]+.5)-.5,n,0)),f[g]+=r;return f}var Yx=class{constructor(){this._data={}}set(t,n,i){this._data[t]||(this._data[t]={}),this._data[t][n]=i}get(t,n){return this._data[t]?this._data[t][n]:void 0}clear(){this._data={}}},Xx=class{constructor(){this._data=new Yx}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new Yx),this._data.get(e,t).set(n,i,r)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},X5=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},d8=class extends X5{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},f8=class extends X5{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},p8=!jb&&"requestIdleCallback"in window?f8:d8,Al=class Z5{constructor(){this.fg=0,this.bg=0,this.extended=new J5}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 Z5;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}},J5=class Q5{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Q5(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},m8=globalThis.performance&&typeof globalThis.performance.now=="function",g8=class eT{static create(t){return new eT(t)}constructor(t){this._now=m8&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Hr;(e=>{e.None=()=>qs.None;function t($,N){return v($,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n($){return(N,D=null,T)=>{let k=!1,j;return j=$(B=>{if(!k)return j?j.dispose():k=!0,N.call(D,B)},null,T),k&&j.dispose(),j}}e.once=n;function i($,N,D){return f((T,k=null,j)=>$(B=>T.call(k,N(B)),null,j),D)}e.map=i;function r($,N,D){return f((T,k=null,j)=>$(B=>{N(B),T.call(k,B)},null,j),D)}e.forEach=r;function o($,N,D){return f((T,k=null,j)=>$(B=>N(B)&&T.call(k,B),null,j),D)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(N,D=null,T)=>{let k=F5(...$.map(j=>j(B=>N.call(D,B))));return g(k,T)}}e.any=d;function p($,N,D,T){let k=D;return i($,j=>(k=N(k,j),k),T)}e.reduce=p;function f($,N){let D,T={onWillAddFirstListener(){D=$(k.fire,k)},onDidRemoveLastListener(){D?.dispose()}},k=new en(T);return N?.add(k),k.event}function g($,N){return N instanceof Array?N.push($):N&&N.add($),$}function v($,N,D=100,T=!1,k=!1,j,B){let q,J,P,X=0,Q,Y={leakWarningThreshold:j,onWillAddFirstListener(){q=$(me=>{X++,J=N(J,me),T&&!P&&(ie.fire(J),J=void 0),Q=()=>{let ye=J;J=void 0,P=void 0,(!T||X>1)&&ie.fire(ye),X=0},typeof D=="number"?(clearTimeout(P),P=setTimeout(Q,D)):P===void 0&&(P=0,queueMicrotask(Q))})},onWillRemoveListener(){k&&X>0&&Q?.()},onDidRemoveLastListener(){Q=void 0,q.dispose()}},ie=new en(Y);return B?.add(ie),ie.event}e.debounce=v;function b($,N=0,D){return e.debounce($,(T,k)=>T?(T.push(k),T):[k],N,void 0,!0,void 0,D)}e.accumulate=b;function S($,N=(T,k)=>T===k,D){let T=!0,k;return o($,j=>{let B=T||!N(j,k);return T=!1,k=j,B},D)}e.latch=S;function w($,N,D){return[e.filter($,N,D),e.filter($,T=>!N(T),D)]}e.split=w;function x($,N=!1,D=[],T){let k=D.slice(),j=$(J=>{k?k.push(J):q.fire(J)});T&&T.add(j);let B=()=>{k?.forEach(J=>q.fire(J)),k=null},q=new en({onWillAddFirstListener(){j||(j=$(J=>q.fire(J)),T&&T.add(j))},onDidAddFirstListener(){k&&(N?setTimeout(B):B())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(q),q.event}e.buffer=x;function E($,N){return(D,T,k)=>{let j=N(new L);return $(function(B){let q=j.evaluate(B);q!==A&&D.call(T,q)},void 0,k)}}e.chain=E;let A=Symbol("HaltChainable");class L{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:A),this}reduce(N,D){let T=D;return this.steps.push(k=>(T=N(T,k),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(k=>{let j=D||!N(k,T);return D=!1,T=k,j?k:A}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===A)break;return N}}function I($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.on(N,T),j=()=>$.removeListener(N,T),B=new en({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromNodeEventEmitter=I;function R($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.addEventListener(N,T),j=()=>$.removeEventListener(N,T),B=new en({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromDOMEventEmitter=R;function z($){return new Promise(N=>n($)(N))}e.toPromise=z;function O($){let N=new en;return $.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=O;function H($,N){return $(D=>N.fire(D))}e.forward=H;function F($,N,D){return N(D),$(T=>N(T))}e.runAndSubscribe=F;class ae{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 en(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($,N){return new ae($,N).emitter.event}e.fromObservable=fe;function V($){return(N,D,T)=>{let k=0,j=!1,B={beginUpdate(){k++},endUpdate(){k--,k===0&&($.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};$.addObserver(B),$.reportChanges();let q={dispose(){$.removeObserver(B)}};return T instanceof Il?T.add(q):Array.isArray(T)&&T.push(q),q}}e.fromObservableLight=V})(Hr||={});var Dv=class jv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${jv._idPool++}`,jv.all.add(this)}start(t){this._stopWatch=new g8,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Dv.all=new Set,Dv._idPool=0;var _8=Dv,v8=-1,tT=class nT{constructor(t,n,i=(nT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new S8(d,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};tT._idPool=1;var y8=tT,b8=class iT{constructor(t){this.value=t}static create(){let t=new Error;return new iT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},S8=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},w8=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},x8=0,o_=class{constructor(t){this.value=t,this.id=x8++}},C8=2,k8,en=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new y8(t?.onListenerError??r_,this._options?.leakWarningThreshold??v8):void 0,this._perfMon=this._options?._profName?new _8(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new w8(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||r_)(f),qs.None}if(this._disposed)return qs.None;n&&(t=t.bind(n));let r=new o_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=b8.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof o_?(this._deliveryQueue??=new E8,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=yi(()=>{o?.(),this._removeListener(r)});return i instanceof Il?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*C8<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||r_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof o_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},E8=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Zx={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}},eu=2,tu,Aa=class xl{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new Xx,this._cacheMapCombined=new Xx,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Al,this._textureSize=512,this._onAddTextureAtlasCanvas=new en,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new en,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=sT(t,this._config.deviceCellWidth*4+eu*2,this._config.deviceCellHeight+eu*2),this._tmpCtx=On(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new p8;for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let i=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(xl.maxAtlasPages&&this._pages.length>=Math.max(4,xl.maxAtlasPages)){let n=this._pages.filter(f=>f.canvas.width*2<=(xl.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),i=-1,r=0;for(let f=0;f<n.length;f++)if(n[f].canvas.width!==r)i=f,r=n[f].canvas.width;else if(f-i===3)break;let o=n.slice(i,i+4),c=o.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),d=this.pages.length-o.length,p=this._mergePages(o,d);p.version++;for(let f=c.length-1;f>=0;f--)this._deletePage(c[f]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new l_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let i=t[0].canvas.width*2,r=new l_(this._document,i,t);for(let[o,c]of t.entries()){let d=o*c.canvas.width%i,p=Math.floor(o/2)*c.canvas.height;r.ctx.drawImage(c.canvas,d,p);for(let g of c.glyphs)g.texturePage=n,g.sizeClipSpace.x=g.size.x/i,g.sizeClipSpace.y=g.size.y/i,g.texturePosition.x+=d,g.texturePosition.y+=p,g.texturePositionClipSpace.x=g.texturePosition.x/i,g.texturePositionClipSpace.y=g.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let f=this._activePages.indexOf(c);f!==-1&&this._activePages.splice(f,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let r of i.glyphs)r.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,c)}getRasterizedGlyph(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,c)}_getFromCacheMap(t,n,i,r,o,c,d){return tu=t.get(n,i,r,o),tu||(tu=this._drawToCache(n,i,r,o,c,d),t.set(n,i,r,o,tu)),tu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Es;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let c=Al.toColorRGB(n);o=Ei.toColor(c[0],c[1],c[2]);break;default:i?o=xu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=xu.opaque(o)),o}_getForegroundColor(t,n,i,r,o,c,d,p,f,g){let v=this._getMinimumContrastColor(t,n,i,r,o,c,d,f,p,g);if(v)return v;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&c<8&&(c+=8),b=this._getColorFromAnsiIndex(c);break;case 50331648:let S=Al.toColorRGB(c);b=Ei.toColor(S[0],S[1],S[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=xu.opaque(b)),p&&(b=xu.multiplyOpacity(b,i8)),b}_resolveBackgroundRgba(t,n,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,i,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,i,r,o,c,d,p,f,g){if(this._config.minimumContrastRatio===1||g)return;let v=this._getContrastCache(f),b=v.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,d),w=this._resolveForegroundRgba(o,c,d,p),x=bo.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!x){v.setColor(t,r,null);return}let E=Ei.toColor(x>>24&255,x>>16&255,x>>8&255);return v.setColor(t,r,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,c){let d=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+eu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+eu*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return Zx;let g=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),A=this._workAttributeData.getFgColor(),L=this._workAttributeData.getFgColorMode(),I=this._workAttributeData.getBgColor(),R=this._workAttributeData.getBgColorMode();if(v){let J=A;A=I,I=J;let P=L;L=R,R=P}let z=this._getBackgroundColor(R,I,v,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=z.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let O=g?this._config.fontWeightBold:this._config.fontWeight,H=S?"italic":"";this._tmpCtx.font=`${H} ${O} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=K5;let F=d.length===1&&Ib(d.charCodeAt(0)),ae=d.length===1&&Yj(d.charCodeAt(0)),fe=this._getForegroundColor(n,R,I,i,L,A,v,b,g,q5(d.charCodeAt(0)));this._tmpCtx.fillStyle=fe.css;let V=ae?0:eu*2,$=!1;this._config.customGlyphs!==!1&&($=o8(this._tmpCtx,d,V,V,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N=!F,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),P=J%2===1?.5:0;if(this._tmpCtx.lineWidth=J,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())N=!1,this._tmpCtx.strokeStyle=`rgb(${Al.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{N=!1;let ye=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ye<8&&(ye+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ye).css}this._tmpCtx.beginPath();let X=V,Q=Math.ceil(V+this._config.deviceCharHeight)-P-(o?J*2:0),Y=Q+J,ie=Q+J*2,me=this._workAttributeData.getUnderlineVariantOffset();for(let ye=0;ye<D;ye++){this._tmpCtx.save();let ke=X+ye*this._config.deviceCellWidth,Le=X+(ye+1)*this._config.deviceCellWidth,ct=ke+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ke,Q),this._tmpCtx.lineTo(Le,Q),this._tmpCtx.moveTo(ke,ie),this._tmpCtx.lineTo(Le,ie);break;case 3:let je=J<=1?ie:Math.ceil(V+this._config.deviceCharHeight-J/2)-P,Ae=J<=1?Q:Math.ceil(V+this._config.deviceCharHeight+J/2)-P,Se=new Path2D;Se.rect(ke,Q,this._config.deviceCellWidth,ie-Q),this._tmpCtx.clip(Se),this._tmpCtx.moveTo(ke-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(ke-this._config.deviceCellWidth/2,Ae,ke,Ae,ke,Y),this._tmpCtx.bezierCurveTo(ke,je,ct,je,ct,Y),this._tmpCtx.bezierCurveTo(ct,Ae,Le,Ae,Le,Y),this._tmpCtx.bezierCurveTo(Le,je,Le+this._config.deviceCellWidth/2,je,Le+this._config.deviceCellWidth/2,Y);break;case 4:let $e=me===0?0:me>=J?J*2-me:J-me;me>=J||$e===0?(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ke+$e,Q),this._tmpCtx.lineTo(Le,Q)):(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ke,Q),this._tmpCtx.lineTo(ke+$e,Q),this._tmpCtx.moveTo(ke+$e+J,Q),this._tmpCtx.lineTo(Le,Q)),me=t8(Le-ke,J,me);break;case 5:let Ye=.6,ht=.3,nt=Le-ke,yt=Math.floor(Ye*nt),Tt=Math.floor(ht*nt),nn=nt-yt-Tt;this._tmpCtx.setLineDash([yt,Tt,nn]),this._tmpCtx.moveTo(ke,Q),this._tmpCtx.lineTo(Le,Q);break;default:this._tmpCtx.moveTo(ke,Q),this._tmpCtx.lineTo(Le,Q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!$&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ye=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ye&&ye.actualBoundingBoxDescent>0){this._tmpCtx.save();let ke=new Path2D;ke.rect(X,Q-Math.ceil(J/2),this._config.deviceCellWidth*D,ie-Q+Math.ceil(J/2)),this._tmpCtx.clip(ke),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=z.css,this._tmpCtx.strokeText(d,V,V+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),P=J%2===1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+P),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*D,V+P),this._tmpCtx.stroke()}if($||this._tmpCtx.fillText(d,V,V+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let J=c_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),z,fe,N);if(J)for(let P=1;P<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=z.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,V,V+this._config.deviceCharHeight-P),J=c_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),z,fe,N),!!J);P++);}if(x){let J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),P=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+Math.floor(this._config.deviceCharHeight/2)-P),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*D,V+Math.floor(this._config.deviceCharHeight/2)-P),this._tmpCtx.stroke()}this._tmpCtx.restore();let T=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),k;if(this._config.allowTransparency?k=T8(T):k=c_(T,z,fe,N),k)return Zx;let j=this._findGlyphBoundingBox(T,this._workBoundingBox,p,ae,$,V),B,q;for(;;){if(this._activePages.length===0){let J=this._createNewPage();B=J,q=J.currentRow,q.height=j.size.y;break}B=this._activePages[this._activePages.length-1],q=B.currentRow;for(let J of this._activePages)j.size.y<=J.currentRow.height&&(B=J,q=J.currentRow);for(let J=this._activePages.length-1;J>=0;J--)for(let P of this._activePages[J].fixedRows)P.height<=q.height&&j.size.y<=P.height&&(B=this._activePages[J],q=P);if(j.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new l_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),B=this._overflowSizePage,q=this._overflowSizePage.currentRow,q.x+j.size.x>=B.canvas.width&&(q.x=0,q.y+=q.height,q.height=0);break}if(q.y+j.size.y>=B.canvas.height||q.height>j.size.y+2){let J=!1;if(B.currentRow.y+B.currentRow.height+j.size.y>=B.canvas.height){let P;for(let X of this._activePages)if(X.currentRow.y+X.currentRow.height+j.size.y<X.canvas.height){P=X;break}if(P)B=P;else if(xl.maxAtlasPages&&this._pages.length>=xl.maxAtlasPages&&q.y+j.size.y<=B.canvas.height&&q.height>=j.size.y&&q.x+j.size.x<=B.canvas.width)J=!0;else{let X=this._createNewPage();B=X,q=X.currentRow,q.height=j.size.y,J=!0}}J||(B.currentRow.height>0&&B.fixedRows.push(B.currentRow),q={x:0,y:B.currentRow.y+B.currentRow.height,height:j.size.y},B.fixedRows.push(q),B.currentRow={x:0,y:q.y+q.height,height:0})}if(q.x+j.size.x<=B.canvas.width)break;q===B.currentRow?(q.x=0,q.y+=q.height,q.height=0):B.fixedRows.splice(B.fixedRows.indexOf(q),1)}return j.texturePage=this._pages.indexOf(B),j.texturePosition.x=q.x,j.texturePosition.y=q.y,j.texturePositionClipSpace.x=q.x/B.canvas.width,j.texturePositionClipSpace.y=q.y/B.canvas.height,j.sizeClipSpace.x/=B.canvas.width,j.sizeClipSpace.y/=B.canvas.height,q.height=Math.max(q.height,j.size.y),q.x+=j.size.x,B.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),B.addGlyph(j),B.version++,j}_findGlyphBoundingBox(t,n,i,r,o,c){n.top=0;let d=r?this._config.deviceCellHeight:this._tmpCanvas.height,p=r?this._config.deviceCellWidth:i,f=!1;for(let g=0;g<d;g++){for(let v=0;v<p;v++){let b=g*this._tmpCanvas.width*4+v*4+3;if(t.data[b]!==0){n.top=g,f=!0;break}}if(f)break}n.left=0,f=!1;for(let g=0;g<c+p;g++){for(let v=0;v<d;v++){let b=v*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.left=g,f=!0;break}}if(f)break}n.right=p,f=!1;for(let g=c+p-1;g>=c;g--){for(let v=0;v<d;v++){let b=v*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.right=g,f=!0;break}}if(f)break}n.bottom=d,f=!1;for(let g=d-1;g>=0;g--){for(let v=0;v<p;v++){let b=g*this._tmpCanvas.width*4+v*4+3;if(t.data[b]!==0){n.bottom=g,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+c+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+c+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},l_=class{constructor(t,n,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=sT(t,n,n),this.ctx=On(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 c_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,c=t.rgba>>>8&255,d=n.rgba>>>24,p=n.rgba>>>16&255,f=n.rgba>>>8&255,g=Math.floor((Math.abs(r-d)+Math.abs(o-p)+Math.abs(c-f))/12),v=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===c||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-c)<g?e.data[b+3]=0:v=!1;return v}function T8(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function sT(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function A8(e,t,n,i,r,o,c,d){let p={foreground:o.foreground,background:o.background,cursor:Es,cursorAccent:Es,selectionForeground:Es,selectionBackgroundTransparent:Es,selectionBackgroundOpaque:Es,selectionInactiveBackgroundTransparent:Es,selectionInactiveBackgroundOpaque:Es,overviewRulerBorder:Es,scrollbarSliderBackground:Es,scrollbarSliderHoverBackground:Es,scrollbarSliderActiveBackground:Es,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:c,deviceMaxTextureSize:d,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:p}}function Jx(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function R8(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ns=[];function rT(e,t,n,i,r,o,c,d,p){let f=A8(i,r,o,c,t,n,d,p);for(let b=0;b<Ns.length;b++){let S=Ns[b],w=S.ownedBy.indexOf(e);if(w>=0){if(Jx(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Ns.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<Ns.length;b++){let S=Ns[b];if(Jx(S.config,f))return S.ownedBy.push(e),S.atlas}let g=e._core,v={atlas:new Aa(document,f,g.unicodeService),config:f,ownedBy:[e]};return Ns.push(v),v.atlas}function Qx(e){for(let t=0;t<Ns.length;t++){let n=Ns[t].ownedBy.indexOf(e);if(n!==-1){Ns[t].ownedBy.length===1?(Ns[t].atlas.dispose(),Ns.splice(t,1)):Ns[t].ownedBy.splice(n,1);break}}}var Bd=600,L8=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=Bd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Bd-(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=Bd-(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})},Bd)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function eC(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(p=>p.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let c=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&n(c,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return yi(()=>i?.disconnect())}function N8(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var tC=class aT extends Al{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new J5,this.combinedData=""}static fromCharData(t){let n=new aT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},oT=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function lT(e,t,n){let i=On(e.createProgram());if(e.attachShader(i,On(nC(e,e.VERTEX_SHADER,t))),e.attachShader(i,On(nC(e,e.FRAGMENT_SHADER,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function nC(e,t,n){let i=On(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function M8(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let r=0;r<e.length;r++)i[r]=e[r];return i}var O8=class{constructor(t){this.texture=t,this.version=-1}},D8=`#version 300 es
|
|
24
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
25
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
26
|
-
layout (location = 2) in vec2 a_offset;
|
|
27
|
-
layout (location = 3) in vec2 a_size;
|
|
28
|
-
layout (location = 4) in float a_texpage;
|
|
29
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
30
|
-
layout (location = 6) in vec2 a_texsize;
|
|
31
|
-
|
|
32
|
-
uniform mat4 u_projection;
|
|
33
|
-
uniform vec2 u_resolution;
|
|
34
|
-
|
|
35
|
-
out vec2 v_texcoord;
|
|
36
|
-
flat out int v_texpage;
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
40
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
41
|
-
v_texpage = int(a_texpage);
|
|
42
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
43
|
-
}`;function j8(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
44
|
-
precision lowp float;
|
|
45
|
-
|
|
46
|
-
in vec2 v_texcoord;
|
|
47
|
-
flat in int v_texpage;
|
|
48
|
-
|
|
49
|
-
uniform sampler2D u_texture[${e}];
|
|
50
|
-
|
|
51
|
-
out vec4 outColor;
|
|
52
|
-
|
|
53
|
-
void main() {
|
|
54
|
-
if (v_texpage == 0) {
|
|
55
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
56
|
-
} ${t}
|
|
57
|
-
}`}var Ra=11,pl=Ra*Float32Array.BYTES_PER_ELEMENT,I8=2,mn=0,Jt,u_=0,nu=0,B8=class extends qs{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Aa.maxAtlasPages===void 0&&(Aa.maxAtlasPages=Math.min(32,On(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Aa.maxTextureSize=On(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=On(lT(o,D8,j8(Aa.maxAtlasPages))),this._register(yi(()=>o.deleteProgram(this._program))),this._projectionLocation=On(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=On(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=On(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(yi(()=>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(yi(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=On(o.createBuffer()),this._register(yi(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,pl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,pl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,pl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,pl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,pl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,pl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let g=new Int32Array(Aa.maxAtlasPages);for(let v=0;v<Aa.maxAtlasPages;v++)g[v]=v;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,oT),this._atlasTextures=[];for(let v=0;v<Aa.maxAtlasPages;v++){let b=new O8(On(o.createTexture()));this._register(yi(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+v),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[v]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,c,d,p,f){this._updateCell(this._vertices.attributes,t,n,i,r,o,c,d,p,f)}_updateCell(t,n,i,r,o,c,d,p,f,g){if(mn=(i*this._terminal.cols+n)*Ra,r===0||r===void 0){t.fill(0,mn,mn+Ra-1-I8);return}this._atlas&&(p&&p.length>1?Jt=this._atlas.getRasterizedGlyphCombinedChar(p,o,c,d,!1,this._terminal.element):Jt=this._atlas.getRasterizedGlyph(r,o,c,d,!1,this._terminal.element),u_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&Jt.offset.x>u_?(nu=Jt.offset.x-u_,t[mn]=-(Jt.offset.x-nu)+this._dimensions.device.char.left,t[mn+1]=-Jt.offset.y+this._dimensions.device.char.top,t[mn+2]=(Jt.size.x-nu)/this._dimensions.device.canvas.width,t[mn+3]=Jt.size.y/this._dimensions.device.canvas.height,t[mn+4]=Jt.texturePage,t[mn+5]=Jt.texturePositionClipSpace.x+nu/this._atlas.pages[Jt.texturePage].canvas.width,t[mn+6]=Jt.texturePositionClipSpace.y,t[mn+7]=Jt.sizeClipSpace.x-nu/this._atlas.pages[Jt.texturePage].canvas.width,t[mn+8]=Jt.sizeClipSpace.y):(t[mn]=-Jt.offset.x+this._dimensions.device.char.left,t[mn+1]=-Jt.offset.y+this._dimensions.device.char.top,t[mn+2]=Jt.size.x/this._dimensions.device.canvas.width,t[mn+3]=Jt.size.y/this._dimensions.device.canvas.height,t[mn+4]=Jt.texturePage,t[mn+5]=Jt.texturePositionClipSpace.x,t[mn+6]=Jt.texturePositionClipSpace.y,t[mn+7]=Jt.sizeClipSpace.x,t[mn+8]=Jt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Qj(r,f,Jt.size.x,this._dimensions.device.cell.width)&&(t[mn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*Ra;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==n?this._vertices.attributesBuffers[i]=new Float32Array(n):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=n,i=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=Ra}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let c=o*this._terminal.cols*Ra,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*Ra);i.set(d,r),r+=d.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,r),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,r/Ra)}setAtlas(t){this._atlas=t;for(let n of this._atlasTextures)n.version=-1}_bindAtlasPageTexture(t,n,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=n.pages[i].version}setDimensions(t){this._dimensions=t}},P8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,n,i,r=!1){if(this.selectionStart=n,this.selectionEnd=i,!n||!i||n[0]===i[0]&&n[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,c=n[1]-o,d=i[1]-o,p=Math.max(c,0),f=Math.min(d,t.rows-1);if(p>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=f,this.startCol=n[0],this.endCol=i[0]}isCellSelected(t,n,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&i>=this.viewportCappedStartRow&&n<this.endCol&&i<=this.viewportCappedEndRow:n<this.startCol&&i>=this.viewportCappedStartRow&&n>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol):!1}};function z8(){return new P8}var Hf=4,pf=1,mf=2,h_=3,$8=2147483648,H8=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=z8()}resize(t,n){let i=t*n*Hf;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},F8=`#version 300 es
|
|
58
|
-
layout (location = 0) in vec2 a_position;
|
|
59
|
-
layout (location = 1) in vec2 a_size;
|
|
60
|
-
layout (location = 2) in vec4 a_color;
|
|
61
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
62
|
-
|
|
63
|
-
uniform mat4 u_projection;
|
|
64
|
-
|
|
65
|
-
out vec4 v_color;
|
|
66
|
-
|
|
67
|
-
void main() {
|
|
68
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
69
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
70
|
-
v_color = a_color;
|
|
71
|
-
}`,U8=`#version 300 es
|
|
72
|
-
precision lowp float;
|
|
73
|
-
|
|
74
|
-
in vec4 v_color;
|
|
75
|
-
|
|
76
|
-
out vec4 outColor;
|
|
77
|
-
|
|
78
|
-
void main() {
|
|
79
|
-
outColor = v_color;
|
|
80
|
-
}`,zr=8,d_=zr*Float32Array.BYTES_PER_ELEMENT,W8=20*zr,iC=class{constructor(){this.attributes=new Float32Array(W8),this.count=0}},jr=0,sC=0,rC=0,aC=0,oC=0,lC=0,cC=0,G8=class extends qs{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new iC,this._verticesCursor=new iC;let r=this._gl;this._program=On(lT(r,F8,U8)),this._register(yi(()=>r.deleteProgram(this._program))),this._projectionLocation=On(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(yi(()=>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(yi(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=On(r.createBuffer()),this._register(yi(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,d_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,d_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,d_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,oT),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,i=1,r,o,c,d,p,f,g,v,b,S,w;for(r=0;r<t.rows;r++){for(c=-1,d=0,p=0,f=!1,o=0;o<t.cols;o++)g=(r*t.cols+o)*Hf,v=e.cells[g+pf],b=e.cells[g+mf],S=!!(b&67108864),(v!==d||b!==p&&(f||S))&&((d!==0||f&&p!==0)&&(w=i++*zr,this._updateRectangle(n,w,p,d,c,o,r)),c=o,d=v,p=b,f=S);(d!==0||f&&p!==0)&&(w=i++*zr,this._updateRectangle(n,w,p,d,c,t.cols,r))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,r=0;(n.style==="bar"||n.style==="outline")&&(i=r++*zr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=r++*zr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=r++*zr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=r++*zr,this._addRectangleFloat(t.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,n,i,r,o,c){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:jr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:jr=(n&16777215)<<8;break;default:jr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:jr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:jr=(i&16777215)<<8;break;default:jr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=M8(e.attributes,this._terminal.rows*this._terminal.cols*zr)),sC=r*this._dimensions.device.cell.width,rC=c*this._dimensions.device.cell.height,aC=(jr>>24&255)/255,oC=(jr>>16&255)/255,lC=(jr>>8&255)/255,cC=1,this._addRectangle(e.attributes,t,sC,rC,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,aC,oC,lC,cC)}_addRectangle(e,t,n,i,r,o,c,d,p,f){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c,e[t+5]=d,e[t+6]=p,e[t+7]=f}_addRectangleFloat(e,t,n,i,r,o,c){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c[0],e[t+5]=c[1],e[t+6]=c[2],e[t+7]=c[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},q8=class extends qs{constructor(t,n,i,r,o,c,d,p){super(),this._container=n,this._alpha=o,this._coreBrowserService=c,this._optionsService=d,this._themeService=p,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(yi(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=On(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,i){}handleSelectionChanged(t,n,i,r=!1){}_setTransparency(t,n){if(n===this._alpha)return;let i=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=rT(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=K5,this._clipCell(i,r,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,i){let r=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},K8=class extends q8{constructor(t,n,i,r,o,c,d){super(i,t,"link",n,!0,o,c,d),this._register(r.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(r.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,n){super.resize(t,n),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&R8(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},mo=typeof window=="object"?window:globalThis,Iv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new en,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new en,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Iv.INSTANCE=new Iv;var cT=Iv;function V8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}cT.INSTANCE.onDidChangeZoomLevel;cT.INSTANCE.onDidChangeFullscreen;var Ql=typeof navigator=="object"?navigator.userAgent:"";Ql.indexOf("Firefox")>=0;Ql.indexOf("AppleWebKit")>=0;var Y8=Ql.indexOf("Chrome")>=0;!Y8&&Ql.indexOf("Safari")>=0;Ql.indexOf("Electron/")>=0;Ql.indexOf("Android")>=0;var f_=!1;if(typeof mo.matchMedia=="function"){let e=mo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=mo.matchMedia("(display-mode: fullscreen)");f_=e.matches,V8(mo,e,({matches:n})=>{f_&&t.matches||(f_=n)})}var Rl="en",p_=!1,uT=!1,Pd,gf=Rl,uC=Rl,X8,Br,So=globalThis,os;typeof So.vscode<"u"&&typeof So.vscode.process<"u"?os=So.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(os=process);var Z8=typeof os?.versions?.electron=="string",J8=Z8&&os?.type==="renderer";if(typeof os=="object"){os.platform,os.platform,p_=os.platform==="linux",p_&&os.env.SNAP&&os.env.SNAP_REVISION,os.env.CI||os.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Pd=Rl,gf=Rl;let e=os.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Pd=t.userLocale,uC=t.osLocale,gf=t.resolvedLanguage||Rl,X8=t.languagePack?.translationsConfigFile}catch{}uT=!0}else typeof navigator=="object"&&!J8?(Br=navigator.userAgent,Br.indexOf("Windows")>=0,Br.indexOf("Macintosh")>=0,(Br.indexOf("Macintosh")>=0||Br.indexOf("iPad")>=0||Br.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p_=Br.indexOf("Linux")>=0,Br?.indexOf("Mobi")>=0,gf=globalThis._VSCODE_NLS_LANGUAGE||Rl,Pd=navigator.language.toLowerCase(),uC=Pd):console.error("Unable to resolve platform.");var hC=uT,lr=Br,wa=gf,Q8;(e=>{function t(){return wa}e.value=t;function n(){return wa.length===2?wa==="en":wa.length>=3?wa[0]==="e"&&wa[1]==="n"&&wa[2]==="-":!1}e.isDefaultVariant=n;function i(){return wa==="en"}e.isDefault=i})(Q8||={});var e7=typeof So.postMessage=="function"&&!So.importScripts;(()=>{if(e7){let e=[];So.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),So.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var t7=!!(lr&&lr.indexOf("Chrome")>=0);lr&&lr.indexOf("Firefox")>=0;!t7&&lr&&lr.indexOf("Safari")>=0;lr&&lr.indexOf("Edg/")>=0;lr&&lr.indexOf("Android")>=0;var ml=typeof navigator=="object"?navigator:{};hC||document.queryCommandSupported&&document.queryCommandSupported("copy")||ml&&ml.clipboard&&ml.clipboard.writeText,hC||ml&&ml.clipboard&&ml.clipboard.readText;var Bb=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}},m_=new Bb,dC=new Bb,fC=new Bb;new Array(230);var n7;(e=>{function t(d){return m_.keyCodeToStr(d)}e.toString=t;function n(d){return m_.strToKeyCode(d)}e.fromString=n;function i(d){return dC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return fC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return dC.strToKeyCode(d)||fC.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 m_.keyCodeToStr(d)}e.toElectronAccelerator=c})(n7||={});var hT=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),i7;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof s7?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Hr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:hT})})(i7||={});var s7=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?hT:(this._emitter||(this._emitter=new en),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},r7;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(r7||={});var pC=class Ts{static fromArray(t){return new Ts(n=>{n.emitMany(t)})}static fromPromise(t){return new Ts(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ts(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ts(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new en,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Hr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ts(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ts.map(this,t)}static filter(t,n){return new Ts(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ts.filter(this,t)}static coalesce(t){return Ts.filter(t,n=>!!n)}coalesce(){return Ts.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ts.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())}};pC.EMPTY=pC.fromArray([]);var{getWindow:a7}=(function(){let e=new Map,t={window:mo,disposables:new Il};e.set(mo.vscodeWindowId,t);let n=new en,i=new en,r=new en;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return qs.None;let d=new Il,p={window:c,disposables:d.add(new Il)};return e.set(c.vscodeWindowId,p),d.add(yi(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(Bv(c,l7.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(p),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let p=c;return p?.view?p.view.window:mo},getDocument(c){return a7(c).document}}})(),o7=class{constructor(t,n,i,r){this._node=t,this._type=n,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Bv(e,t,n,i){return new o7(e,t,n,i)}var l7={BEFORE_UNLOAD:"beforeunload"},c7=class extends qs{constructor(t,n,i,r,o,c,d,p,f){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=c,this._optionsService=d,this._themeService=p,this._cursorBlinkStateManager=new Qc,this._charAtlasDisposable=this._register(new Qc),this._observerDisposable=this._register(new Qc),this._model=new H8,this._workCell=new tC,this._workCell2=new tC,this._rectangleRenderer=this._register(new Qc),this._glyphRenderer=this._register(new Qc),this._onChangeTextureAtlas=this._register(new en),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new en),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new en),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new en),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new en),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n8(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new K8(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=e8(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Bv(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(Bv(this._canvas,"webglcontextrestored",v=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Qx(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=eC(this._canvas,this._coreBrowserService.window,(v,b)=>this._setCanvasDevicePixelDimensions(v,b)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=eC(this._canvas,v,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(yi(()=>{for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),Qx(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,n,i);this._model.selection.update(this._core,t,n,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new G8(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new B8(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=rT(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=F5(Hr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Hr.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new L8(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,c,d,p,f,g,v=0,b=!0,S,w,x,E,A,L,I,R,z;t=mC(t,i.rows-1,0),n=mC(n,i.rows-1,0);let O=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,F=H-i.buffer.ydisp,ae=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),fe=-1,V=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let $=!1;for(c=t;c<=n;c++)for(d=c+i.buffer.ydisp,p=i.buffer.lines.get(d),this._model.lineLengths[c]=0,x=H===d,v=0,f=this._characterJoinerService.getJoinedCharacters(d),R=0;R<i.cols;R++){if(o=this._cellColorResolver.result.bg,p.loadCell(R,r),R===0&&(o=this._cellColorResolver.result.bg),g=!1,b=R>=v,S=R,f.length>0&&R===f[0][0]&&b){w=f.shift();let N=this._model.selection.isCellSelected(this._terminal,w[0],d);for(I=w[0]+1;I<w[1];I++)b&&=N===this._model.selection.isCellSelected(this._terminal,I,d);b&&=!x||ae<w[0]||ae>=w[1],b?(g=!0,r=new u7(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):v=w[1]}if(E=r.getChars(),A=r.getCode(),I=(c*i.cols+R)*Hf,this._cellColorResolver.resolve(r,R,d,this.dimensions.device.cell.width),V&&d===H&&(R===ae&&(this._model.cursor={x:ae,y:F,width:r.getWidth(),style:this._coreBrowserService.isFocused?O:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},fe=ae+r.getWidth()-1),R>=ae&&R<=fe&&(this._coreBrowserService.isFocused&&O==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),A!==0&&(this._model.lineLengths[c]=R+1),!(this._model.cells[I]===A&&this._model.cells[I+pf]===this._cellColorResolver.result.bg&&this._model.cells[I+mf]===this._cellColorResolver.result.fg&&this._model.cells[I+h_]===this._cellColorResolver.result.ext)&&($=!0,E.length>1&&(A|=$8),this._model.cells[I]=A,this._model.cells[I+pf]=this._cellColorResolver.result.bg,this._model.cells[I+mf]=this._cellColorResolver.result.fg,this._model.cells[I+h_]=this._cellColorResolver.result.ext,L=r.getWidth(),this._glyphRenderer.value.updateCell(R,c,A,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,L,o),g)){for(r=this._workCell,R++;R<=S;R++)z=(c*i.cols+R)*Hf,this._glyphRenderer.value.updateCell(R,c,0,0,0,0,Kj,0,0),this._model.cells[z]=0,this._model.cells[z+pf]=this._cellColorResolver.result.bg,this._model.cells[z+mf]=this._cellColorResolver.result.fg,this._model.cells[z+h_]=this._cellColorResolver.result.ext;R--}}$&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},u7=class extends Al{constructor(t,n,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function mC(e,t,n=0){return Math.max(Math.min(e,t),n)}var gC="di$target",_C="di$dependencies",g_=new Map;function dr(e){if(g_.has(e))return g_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h7(t,n,r)};return t._id=e,g_.set(e,t),t}function h7(e,t,n){t[gC]===t?t[_C].push({id:e,index:n}):(t[_C]=[{id:e,index:n}],t[gC]=t)}dr("BufferService");dr("CoreMouseService");dr("CoreService");dr("CharsetService");dr("InstantiationService");dr("LogService");var d7=dr("OptionsService");dr("OscLinkService");dr("UnicodeService");dr("DecorationService");var f7={trace:0,debug:1,info:2,warn:3,error:4,off:5},p7="xterm.js: ",vC=class extends qs{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=f7[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":p7)+n,...i)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};vC=jj([Ij(0,d7)],vC);var m7=class extends qs{constructor(t){if(G5&&qj()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new en),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new en),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new en),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new en),this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=n.coreService,r=n.optionsService,o=n,c=o._renderService,d=o._characterJoinerService,p=o._charSizeService,f=o._coreBrowserService,g=o._decorationService;o._logService;let v=o._themeService;this._renderer=this._register(new c7(t,d,p,f,i,g,r,v,this._preserveDrawingBuffer)),this._register(Hr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Hr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Hr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Hr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(yi(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var dT=Object.defineProperty,g7=Object.getOwnPropertyDescriptor,_7=(e,t)=>{for(var n in t)dT(e,n,{get:t[n],enumerable:!0})},bn=(e,t,n,i)=>{for(var r=i>1?void 0:i?g7(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=(i?c(t,n,r):c(r))||r);return i&&r&&dT(t,n,r),r},Te=(e,t)=>(n,i)=>t(n,i,e),yC="Terminal input",Pv={get:()=>yC,set:e=>yC=e},bC="Too much output to announce, navigate to rows manually to read",zv={get:()=>bC,set:e=>bC=e};function v7(e){return e.replace(/\r?\n/g,"\r")}function y7(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function b7(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function S7(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");fT(r,t,n,i)}}function fT(e,t,n,i){e=v7(e),e=y7(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function pT(e,t,n){let i=n.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function SC(e,t,n,i,r){pT(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Na(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Sp(e,t=0,n=e.length){let i="";for(let r=t;r<n;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var w7=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(c-55296)*1024+d-56320+65536:(t[i++]=c,t[i++]=d);continue}c!==65279&&(t[i++]=c)}return i}},x7=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r,o,c,d,p=0,f=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,x;for(;(x=this.interim[++w]&63)&&w<4;)S<<=6,S|=x;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=E-w;for(;f<A;){if(f>=n)return 0;if(x=e[f++],(x&192)!==128){f--,b=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}b||(E===2?S<128?f--:t[i++]=S:E===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let g=n-4,v=f;for(;v<n;){for(;v<g&&!((r=e[v])&128)&&!((o=e[v+1])&128)&&!((c=e[v+2])&128)&&!((d=e[v+3])&128);)t[i++]=r,t[i++]=o,t[i++]=c,t[i++]=d,v+=4;if(r=e[v++],r<128)t[i++]=r;else if((r&224)===192){if(v>=n)return this.interim[0]=r,i;if(o=e[v++],(o&192)!==128){v--;continue}if(p=(r&31)<<6|o&63,p<128){v--;continue}t[i++]=p}else if((r&240)===224){if(v>=n)return this.interim[0]=r,i;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=o,i;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[i++]=p}else if((r&248)===240){if(v>=n)return this.interim[0]=r,i;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=c,i;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[i++]=p}}return i}},mT="",Da=" ",mh=class gT{constructor(){this.fg=0,this.bg=0,this.extended=new Ff}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 gT;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}},Ff=class _T{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _T(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ms=class vT extends mh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ff,this.combinedData=""}static fromCharData(t){let n=new vT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Na(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},wC="di$target",$v="di$dependencies",__=new Map;function C7(e){return e[$v]||[]}function Qn(e){if(__.has(e))return __.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");k7(t,n,r)};return t._id=e,__.set(e,t),t}function k7(e,t,n){t[wC]===t?t[$v].push({id:e,index:n}):(t[$v]=[{id:e,index:n}],t[wC]=t)}var Ri=Qn("BufferService"),yT=Qn("CoreMouseService"),Mo=Qn("CoreService"),E7=Qn("CharsetService"),Pb=Qn("InstantiationService"),bT=Qn("LogService"),Li=Qn("OptionsService"),ST=Qn("OscLinkService"),T7=Qn("UnicodeService"),gh=Qn("DecorationService"),Hv=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Ms,c=n.getTrimmedLength(),d=-1,p=-1,f=!1;for(let g=0;g<c;g++)if(!(p===-1&&!n.hasContent(g))){if(n.loadCell(g,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=g,d=o.extended.urlId;continue}else f=o.extended.urlId!==d;else p!==-1&&(f=!0);if(f||p!==-1&&g===c-1){let v=this._oscLinkService.getLinkData(d)?.uri;if(v){let b={start:{x:p+1,y:e},end:{x:g+(!f&&g===c-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(v);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:v,range:b,activate:(w,x)=>r?r.activate(w,x,b):A7(w,x),hover:(w,x)=>r?.hover?.(w,x,b),leave:(w,x)=>r?.leave?.(w,x,b)})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=g,d=o.extended.urlId):(p=-1,d=-1)}}t(i)}};Hv=bn([Te(0,Ri),Te(1,Li),Te(2,ST)],Hv);function A7(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
81
|
-
|
|
82
|
-
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var wp=Qn("CharSizeService"),Vr=Qn("CoreBrowserService"),zb=Qn("MouseService"),Yr=Qn("RenderService"),R7=Qn("SelectionService"),wT=Qn("CharacterJoinerService"),ec=Qn("ThemeService"),xT=Qn("LinkProviderService"),L7=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xC.isErrorNoTelemetry(e)?new xC(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 L7;function _f(e){M7(e)||N7.onUnexpectedError(e)}var Fv="Canceled";function M7(e){return e instanceof O7?!0:e instanceof Error&&e.name===Fv&&e.message===Fv}var O7=class extends Error{constructor(){super(Fv),this.name=this.message}};function D7(e){return new Error(`Illegal argument: ${e}`)}var xC=class Uv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Uv)return t;let n=new Uv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Wv=class CT extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,CT.prototype)}};function rs(e,t=0){return e[e.length-(1+t)]}var j7;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(j7||={});function I7(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var kT;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(R){yield R}e.single=r;function o(R){return t(R)?R:r(R)}e.wrap=o;function c(R){return R||n}e.from=c;function*d(R){for(let z=R.length-1;z>=0;z--)yield R[z]}e.reverse=d;function p(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function g(R,z){let O=0;for(let H of R)if(z(H,O++))return!0;return!1}e.some=g;function v(R,z){for(let O of R)if(z(O))return O}e.find=v;function*b(R,z){for(let O of R)z(O)&&(yield O)}e.filter=b;function*S(R,z){let O=0;for(let H of R)yield z(H,O++)}e.map=S;function*w(R,z){let O=0;for(let H of R)yield*z(H,O++)}e.flatMap=w;function*x(...R){for(let z of R)yield*z}e.concat=x;function E(R,z,O){let H=O;for(let F of R)H=z(H,F);return H}e.reduce=E;function*A(R,z,O=R.length){for(z<0&&(z+=R.length),O<0?O+=R.length:O>R.length&&(O=R.length);z<O;z++)yield R[z]}e.slice=A;function L(R,z=Number.POSITIVE_INFINITY){let O=[];if(z===0)return[O,R];let H=R[Symbol.iterator]();for(let F=0;F<z;F++){let ae=H.next();if(ae.done)return[O,e.empty()];O.push(ae.value)}return[O,{[Symbol.iterator](){return H}}]}e.consume=L;async function I(R){let z=[];for await(let O of R)z.push(O);return Promise.resolve(z)}e.asyncToArray=I})(kT||={});function To(e){if(kT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function B7(...e){return cn(()=>To(e))}function cn(e){return{dispose:I7(()=>{e()})}}var ET=class TT{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{To(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?TT.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)}};ET.DISABLE_DISPOSED_WARNING=!1;var Ba=ET,ot=class{constructor(){this._store=new Ba,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)}};ot.None=Object.freeze({dispose(){}});var Fl=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}},Fr=typeof window=="object"?window:globalThis,Gv=class qv{constructor(t){this.element=t,this.next=qv.Undefined,this.prev=qv.Undefined}};Gv.Undefined=new Gv(void 0);var hn=Gv,CC=class{constructor(){this._first=hn.Undefined,this._last=hn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===hn.Undefined}clear(){let e=this._first;for(;e!==hn.Undefined;){let t=e.next;e.prev=hn.Undefined,e.next=hn.Undefined,e=t}this._first=hn.Undefined,this._last=hn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new hn(e);if(this._first===hn.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==hn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==hn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==hn.Undefined&&e.next!==hn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===hn.Undefined&&e.next===hn.Undefined?(this._first=hn.Undefined,this._last=hn.Undefined):e.next===hn.Undefined?(this._last=this._last.prev,this._last.next=hn.Undefined):e.prev===hn.Undefined&&(this._first=this._first.next,this._first.prev=hn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==hn.Undefined;)yield e.element,e=e.next}},P7=globalThis.performance&&typeof globalThis.performance.now=="function",z7=class AT{static create(t){return new AT(t)}constructor(t){this._now=P7&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ci;(e=>{e.None=()=>ot.None;function t($,N){return v($,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n($){return(N,D=null,T)=>{let k=!1,j;return j=$(B=>{if(!k)return j?j.dispose():k=!0,N.call(D,B)},null,T),k&&j.dispose(),j}}e.once=n;function i($,N,D){return f((T,k=null,j)=>$(B=>T.call(k,N(B)),null,j),D)}e.map=i;function r($,N,D){return f((T,k=null,j)=>$(B=>{N(B),T.call(k,B)},null,j),D)}e.forEach=r;function o($,N,D){return f((T,k=null,j)=>$(B=>N(B)&&T.call(k,B),null,j),D)}e.filter=o;function c($){return $}e.signal=c;function d(...$){return(N,D=null,T)=>{let k=B7(...$.map(j=>j(B=>N.call(D,B))));return g(k,T)}}e.any=d;function p($,N,D,T){let k=D;return i($,j=>(k=N(k,j),k),T)}e.reduce=p;function f($,N){let D,T={onWillAddFirstListener(){D=$(k.fire,k)},onDidRemoveLastListener(){D?.dispose()}},k=new we(T);return N?.add(k),k.event}function g($,N){return N instanceof Array?N.push($):N&&N.add($),$}function v($,N,D=100,T=!1,k=!1,j,B){let q,J,P,X=0,Q,Y={leakWarningThreshold:j,onWillAddFirstListener(){q=$(me=>{X++,J=N(J,me),T&&!P&&(ie.fire(J),J=void 0),Q=()=>{let ye=J;J=void 0,P=void 0,(!T||X>1)&&ie.fire(ye),X=0},typeof D=="number"?(clearTimeout(P),P=setTimeout(Q,D)):P===void 0&&(P=0,queueMicrotask(Q))})},onWillRemoveListener(){k&&X>0&&Q?.()},onDidRemoveLastListener(){Q=void 0,q.dispose()}},ie=new we(Y);return B?.add(ie),ie.event}e.debounce=v;function b($,N=0,D){return e.debounce($,(T,k)=>T?(T.push(k),T):[k],N,void 0,!0,void 0,D)}e.accumulate=b;function S($,N=(T,k)=>T===k,D){let T=!0,k;return o($,j=>{let B=T||!N(j,k);return T=!1,k=j,B},D)}e.latch=S;function w($,N,D){return[e.filter($,N,D),e.filter($,T=>!N(T),D)]}e.split=w;function x($,N=!1,D=[],T){let k=D.slice(),j=$(J=>{k?k.push(J):q.fire(J)});T&&T.add(j);let B=()=>{k?.forEach(J=>q.fire(J)),k=null},q=new we({onWillAddFirstListener(){j||(j=$(J=>q.fire(J)),T&&T.add(j))},onDidAddFirstListener(){k&&(N?setTimeout(B):B())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return T&&T.add(q),q.event}e.buffer=x;function E($,N){return(D,T,k)=>{let j=N(new L);return $(function(B){let q=j.evaluate(B);q!==A&&D.call(T,q)},void 0,k)}}e.chain=E;let A=Symbol("HaltChainable");class L{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:A),this}reduce(N,D){let T=D;return this.steps.push(k=>(T=N(T,k),T)),this}latch(N=(D,T)=>D===T){let D=!0,T;return this.steps.push(k=>{let j=D||!N(k,T);return D=!1,T=k,j?k:A}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===A)break;return N}}function I($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.on(N,T),j=()=>$.removeListener(N,T),B=new we({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromNodeEventEmitter=I;function R($,N,D=T=>T){let T=(...q)=>B.fire(D(...q)),k=()=>$.addEventListener(N,T),j=()=>$.removeEventListener(N,T),B=new we({onWillAddFirstListener:k,onDidRemoveLastListener:j});return B.event}e.fromDOMEventEmitter=R;function z($){return new Promise(N=>n($)(N))}e.toPromise=z;function O($){let N=new we;return $.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=O;function H($,N){return $(D=>N.fire(D))}e.forward=H;function F($,N,D){return N(D),$(T=>N(T))}e.runAndSubscribe=F;class ae{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 we(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($,N){return new ae($,N).emitter.event}e.fromObservable=fe;function V($){return(N,D,T)=>{let k=0,j=!1,B={beginUpdate(){k++},endUpdate(){k--,k===0&&($.reportChanges(),j&&(j=!1,N.call(D)))},handlePossibleChange(){},handleChange(){j=!0}};$.addObserver(B),$.reportChanges();let q={dispose(){$.removeObserver(B)}};return T instanceof Ba?T.add(q):Array.isArray(T)&&T.push(q),q}}e.fromObservableLight=V})(ci||={});var Kv=class Vv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Vv._idPool++}`,Vv.all.add(this)}start(t){this._stopWatch=new z7,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}}};Kv.all=new Set,Kv._idPool=0;var $7=Kv,H7=-1,RT=class LT{constructor(t,n,i=(LT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let p=new W7(d,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};RT._idPool=1;var F7=RT,U7=class NT{constructor(t){this.value=t}static create(){let t=new Error;return new NT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
-
`).slice(2).join(`
|
|
88
|
-
`))}},W7=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},G7=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},q7=0,v_=class{constructor(e){this.value=e,this.id=q7++}},K7=2,V7,we=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new F7(t?.onListenerError??_f,this._options?.leakWarningThreshold??H7):void 0,this._perfMon=this._options?._profName?new $7(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new G7(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||_f)(f),ot.None}if(this._disposed)return ot.None;n&&(t=t.bind(n));let r=new v_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=U7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof v_?(this._deliveryQueue??=new Y7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=cn(()=>{o?.(),this._removeListener(r)});return i instanceof Ba?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*K7<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||_f;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof v_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Y7=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Yv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Yv.INSTANCE=new Yv;var $b=Yv;function X7(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}$b.INSTANCE.onDidChangeZoomLevel;function Z7(e){return $b.INSTANCE.getZoomFactor(e)}$b.INSTANCE.onDidChangeFullscreen;var tc=typeof navigator=="object"?navigator.userAgent:"",Xv=tc.indexOf("Firefox")>=0,J7=tc.indexOf("AppleWebKit")>=0,Hb=tc.indexOf("Chrome")>=0,Q7=!Hb&&tc.indexOf("Safari")>=0;tc.indexOf("Electron/")>=0;tc.indexOf("Android")>=0;var y_=!1;if(typeof Fr.matchMedia=="function"){let e=Fr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Fr.matchMedia("(display-mode: fullscreen)");y_=e.matches,X7(Fr,e,({matches:n})=>{y_&&t.matches||(y_=n)})}var Ll="en",Zv=!1,Jv=!1,vf=!1,MT=!1,zd,yf=Ll,kC=Ll,eI,Pr,wo=globalThis,ls;typeof wo.vscode<"u"&&typeof wo.vscode.process<"u"?ls=wo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ls=process);var tI=typeof ls?.versions?.electron=="string",nI=tI&&ls?.type==="renderer";if(typeof ls=="object"){Zv=ls.platform==="win32",Jv=ls.platform==="darwin",vf=ls.platform==="linux",vf&&ls.env.SNAP&&ls.env.SNAP_REVISION,ls.env.CI||ls.env.BUILD_ARTIFACTSTAGINGDIRECTORY,zd=Ll,yf=Ll;let e=ls.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);zd=t.userLocale,kC=t.osLocale,yf=t.resolvedLanguage||Ll,eI=t.languagePack?.translationsConfigFile}catch{}MT=!0}else typeof navigator=="object"&&!nI?(Pr=navigator.userAgent,Zv=Pr.indexOf("Windows")>=0,Jv=Pr.indexOf("Macintosh")>=0,(Pr.indexOf("Macintosh")>=0||Pr.indexOf("iPad")>=0||Pr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,vf=Pr.indexOf("Linux")>=0,Pr?.indexOf("Mobi")>=0,yf=globalThis._VSCODE_NLS_LANGUAGE||Ll,zd=navigator.language.toLowerCase(),kC=zd):console.error("Unable to resolve platform.");var OT=Zv,rr=Jv,iI=vf,EC=MT,cr=Pr,xa=yf,sI;(e=>{function t(){return xa}e.value=t;function n(){return xa.length===2?xa==="en":xa.length>=3?xa[0]==="e"&&xa[1]==="n"&&xa[2]==="-":!1}e.isDefaultVariant=n;function i(){return xa==="en"}e.isDefault=i})(sI||={});var rI=typeof wo.postMessage=="function"&&!wo.importScripts;(()=>{if(rI){let e=[];wo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),wo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var aI=!!(cr&&cr.indexOf("Chrome")>=0);cr&&cr.indexOf("Firefox")>=0;!aI&&cr&&cr.indexOf("Safari")>=0;cr&&cr.indexOf("Edg/")>=0;cr&&cr.indexOf("Android")>=0;var gl=typeof navigator=="object"?navigator:{};EC||document.queryCommandSupported&&document.queryCommandSupported("copy")||gl&&gl.clipboard&&gl.clipboard.writeText,EC||gl&&gl.clipboard&&gl.clipboard.readText;var Fb=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},b_=new Fb,TC=new Fb,AC=new Fb,oI=new Array(230),DT;(e=>{function t(d){return b_.keyCodeToStr(d)}e.toString=t;function n(d){return b_.strToKeyCode(d)}e.fromString=n;function i(d){return TC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return AC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return TC.strToKeyCode(d)||AC.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return b_.keyCodeToStr(d)}e.toElectronAccelerator=c})(DT||={});var lI=class jT{constructor(t,n,i,r,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof jT&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new cI([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},cI=class{constructor(e){if(e.length===0)throw D7("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function uI(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return DT.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Xv)switch(t){case 59:return 85;case 60:if(iI)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(J7&&(rr&&t===93||!rr&&t===92))return 57;return oI[t]||0}var hI=rr?256:2048,dI=512,fI=1024,pI=rr?2048:256,RC=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=uI(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|=hI),this.altKey&&(t|=dI),this.shiftKey&&(t|=fI),this.metaKey&&(t|=pI),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new lI(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},LC=new WeakMap;function mI(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var gI=class{static getSameOriginWindowChain(e){let t=LC.get(e);if(!t){t=[],LC.set(e,t);let n=e,i;do i=mI(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let c=o.window.deref();if(n+=c?.scrollY??0,i+=c?.scrollX??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();n+=d.top,i+=d.left}return{top:n,left:i}}},$d=class{constructor(t,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=gI.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},NC=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(Hb){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,c=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*c):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?Xv&&!rr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Q7&&OT?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*c):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?Xv&&!rr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},IT=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),_I;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof vI?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ci.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:IT})})(_I||={});var vI=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?IT:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ub=class{constructor(t,n){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof n=="number"&&this.setIfNotSet(t,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,n){if(this._isDisposed)throw new Wv("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Wv("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},yI=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Wv("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=cn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},bI;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(bI||={});var MC=class As{static fromArray(t){return new As(n=>{n.emitMany(t)})}static fromPromise(t){return new As(async n=>{n.emitMany(await t)})}static fromPromises(t){return new As(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new As(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new we,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ci.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new As(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return As.map(this,t)}static filter(t,n){return new As(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return As.filter(this,t)}static coalesce(t){return As.filter(t,n=>!!n)}coalesce(){return As.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return As.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())}};MC.EMPTY=MC.fromArray([]);var{getWindow:sr,getWindowId:SI,onDidRegisterWindow:wI}=(function(){let e=new Map,t={window:Fr,disposables:new Ba};e.set(Fr.vscodeWindowId,t);let n=new we,i=new we,r=new we;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return ot.None;let d=new Ba,p={window:c,disposables:d.add(new Ba)};return e.set(c.vscodeWindowId,p),d.add(cn(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(Xe(c,Gn.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(p),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let p=c;return p?.view?p.view.window:Fr},getDocument(c){return sr(c).document}}})(),xI=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Xe(e,t,n,i){return new xI(e,t,n,i)}var OC=function(e,t,n,i){return Xe(e,t,n,i)},Wb,CI=class extends yI{constructor(e){super(),this.defaultTarget=e&&sr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},DC=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){_f(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,r=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),i.set(o,!0);c.length>0;)c.sort(DC.sort),c.shift().execute();i.set(o,!1)};Wb=(o,c,d=0)=>{let p=SI(o),f=new DC(c,d),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(f),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function kI(e){let t=e.getBoundingClientRect(),n=sr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Gn={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"},EI=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=Hi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Hi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Hi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Hi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Hi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Hi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Hi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Hi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Hi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Hi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Hi(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=Hi(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=Hi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Hi(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 Hi(e){return typeof e=="number"?`${e}px`:e}function Pu(e){return new EI(e)}var BT=class{constructor(){this._hooks=new Ba,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(cn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=sr(e)}this._hooks.add(Xe(o,Gn.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Xe(o,Gn.POINTER_UP,c=>this.stopMonitoring(!0)))}};function TI(e,t,n){let i=null,r=null;if(typeof n.value=="function"?(i="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",r=n.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,c)}),this[o]}}var nr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(nr||={});var Cu=class vi extends ot{constructor(){super(),this.dispatched=!1,this.targets=new CC,this.ignoreTargets=new CC,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ci.runAndSubscribe(wI,({window:t,disposables:n})=>{n.add(Xe(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(Xe(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(Xe(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Fr,disposables:this._store}))}static addTarget(t){if(!vi.isTouchDevice())return ot.None;vi.INSTANCE||(vi.INSTANCE=new vi);let n=vi.INSTANCE.targets.push(t);return cn(n)}static ignoreTarget(t){if(!vi.isTouchDevice())return ot.None;vi.INSTANCE||(vi.INSTANCE=new vi);let n=vi.INSTANCE.ignoreTargets.push(t);return cn(n)}static isTouchDevice(){return"ontouchstart"in Fr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(nr.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let d=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let p=this.activeTouches[d.identifier],f=Date.now()-p.initialTimeStamp;if(f<vi.HOLD_DELAY&&Math.abs(p.initialPageX-rs(p.rollingPageX))<30&&Math.abs(p.initialPageY-rs(p.rollingPageY))<30){let g=this.newGestureEvent(nr.Tap,p.initialTarget);g.pageX=rs(p.rollingPageX),g.pageY=rs(p.rollingPageY),this.dispatchEvent(g)}else if(f>=vi.HOLD_DELAY&&Math.abs(p.initialPageX-rs(p.rollingPageX))<30&&Math.abs(p.initialPageY-rs(p.rollingPageY))<30){let g=this.newGestureEvent(nr.Contextmenu,p.initialTarget);g.pageX=rs(p.rollingPageX),g.pageY=rs(p.rollingPageY),this.dispatchEvent(g)}else if(r===1){let g=rs(p.rollingPageX),v=rs(p.rollingPageY),b=rs(p.rollingTimestamps)-p.rollingTimestamps[0],S=g-p.rollingPageX[0],w=v-p.rollingPageY[0],x=[...this.targets].filter(E=>p.initialTarget instanceof Node&&E.contains(p.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,g,Math.abs(w)/b,w>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(nr.End,p.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===nr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>vi.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===nr.Change||t.type===nr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;n.push([r,i])}n.sort((i,r)=>i[0]-r[0]);for(let[i,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,r,o,c,d,p,f){this.handle=Wb(t,()=>{let g=Date.now(),v=g-i,b=0,S=0,w=!0;r+=vi.SCROLL_FRICTION*v,d+=vi.SCROLL_FRICTION*v,r>0&&(w=!1,b=o*r*v),d>0&&(w=!1,S=p*d*v);let x=this.newGestureEvent(nr.Change);x.translationX=b,x.translationY=S,n.forEach(E=>E.dispatchEvent(x)),w||this.inertia(t,n,g,r,o,c+b,d,p,f+S)})}onTouchMove(t){let n=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],d=this.newGestureEvent(nr.Change,c.initialTarget);d.translationX=o.pageX-rs(c.rollingPageX),d.translationY=o.pageY-rs(c.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Cu.SCROLL_FRICTION=-.005,Cu.HOLD_DELAY=700,Cu.CLEAR_TAP_COUNT_TIME=400,bn([TI],Cu,"isTouchDevice",1);var AI=Cu,Gb=class extends ot{onclick(e,t){this._register(Xe(e,Gn.CLICK,n=>t(new $d(sr(e),n))))}onmousedown(e,t){this._register(Xe(e,Gn.MOUSE_DOWN,n=>t(new $d(sr(e),n))))}onmouseover(e,t){this._register(Xe(e,Gn.MOUSE_OVER,n=>t(new $d(sr(e),n))))}onmouseleave(e,t){this._register(Xe(e,Gn.MOUSE_LEAVE,n=>t(new $d(sr(e),n))))}onkeydown(e,t){this._register(Xe(e,Gn.KEY_DOWN,n=>t(new RC(n))))}onkeyup(e,t){this._register(Xe(e,Gn.KEY_UP,n=>t(new RC(n))))}oninput(e,t){this._register(Xe(e,Gn.INPUT,t))}onblur(e,t){this._register(Xe(e,Gn.BLUR,t))}onfocus(e,t){this._register(Xe(e,Gn.FOCUS,t))}onchange(e,t){this._register(Xe(e,Gn.CHANGE,t))}ignoreGesture(e){return AI.ignoreTarget(e)}},jC=11,RI=class extends Gb{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=jC+"px",this.domNode.style.height=jC+"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 BT),this._register(OC(this.bgDomNode,Gn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(OC(this.domNode,Gn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CI),this._pointerdownScheduleRepeatTimer=this._register(new Ub)}_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,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},LI=class Qv{constructor(t,n,i,r,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=r,this.rawScrollTop=d,n<0&&(n=0),r+n>i&&(r=i-n),r<0&&(r=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Qv(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new 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,n){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:p}}},NI=class extends ot{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new LI(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let i;t?i=new BC(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=BC.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},IC=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function S_(e,t){let n=t-e;return function(i){return e+n*DI(i)}}function MI(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var BC=class ey{constructor(t,n,i,r){this.from=t,this.to=n,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,i){if(Math.abs(t-n)>2.5*i){let r,o;return t<n?(r=t+.75*i,o=n-.75*i):(r=t-.75*i,o=n+.75*i),MI(S_(t,r),S_(o,n),.33)}return S_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let i=this.scrollLeft(n),r=this.scrollTop(n);return new IC(i,r,!1)}return new IC(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return ey.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new ey(t,n,r,i)}};function OI(e){return Math.pow(e,3)}function DI(e){return 1-OI(1-e)}var jI=class extends ot{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Ub)}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":"")))}},II=140,PT=class extends Gb{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 jI(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new BT),this._shouldRender=!0,this.domNode=Pu(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(Xe(this.domNode.domNode,Gn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new RI(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Pu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Xe(this.slider.domNode,Gn.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=kI(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),c=Math.abs(o-n);if(OT&&c>II){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},zT=class ty{constructor(t,n,i,r,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ty(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,i,r,o){let c=Math.max(0,i-t),d=Math.max(0,c-2*n),p=r>0&&r>i;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*d/r))),g=(d-f)/(r-i),v=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=ty._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},BI=class extends PT{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new zT(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},PI=class extends PT{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new zT(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},zI=500,PC=50,$I=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},ny=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Hb){let n=sr(t.browserEvent),i=Z7(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let r=null,o=new $I(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),d=Math.abs(n.deltaY),p=Math.max(Math.min(r,c),1),f=Math.max(Math.min(o,d),1),g=Math.max(r,c),v=Math.max(o,d);g%p===0&&v%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ny.INSTANCE=new ny;var HI=ny,FI=class extends Gb{constructor(e,t,n){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=WI(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new PI(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new BI(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Pu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Pu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Pu(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 Ub),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=To(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 NC(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=To(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new NC(n))};this._mouseWheelToDispose.push(Xe(this._listenOnDomNode,Gn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=HI.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let c=!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=PC*r,g=d.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,g)}if(o){let f=PC*o,g=d.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,g)}p=this._scrollable.validateScrollPosition(p),(d.scrollLeft!==p.scrollLeft||d.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,i=n?" left":"",r=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),zI)}},UI=class extends FI{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function WI(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 iy=class extends ot{constructor(e,t,n,i,r,o,c,d){super(),this._bufferService=n,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new we),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=>Wb(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new UI(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(ci.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(cn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(cn(()=>this._styleElement.remove())),this._register(ci.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
89
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};iy=bn([Te(2,Ri),Te(3,Vr),Te(4,yT),Te(5,ec),Te(6,Li),Te(7,Yr)],iy);var sy=class extends ot{constructor(e,t,n,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(cn(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};sy=bn([Te(1,Ri),Te(2,Vr),Te(3,gh),Te(4,Yr)],sy);var GI=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},er={full:0,left:0,center:0,right:0},Ca={full:0,left:0,center:0,right:0},iu={full:0,left:0,center:0,right:0},Uf=class extends ot{constructor(e,t,n,i,r,o,c,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new GI,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(cn(()=>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);Ca.full=this._canvas.width,Ca.left=e,Ca.center=t,Ca.right=e,this._refreshDrawHeightConstants(),iu.full=1,iu.left=1,iu.center=1+Ca.left,iu.right=1+Ca.left+Ca.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(iu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-er[e.position||"full"]/2),Ca[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}))}};Uf=bn([Te(2,Ri),Te(3,gh),Te(4,Yr),Te(5,Li),Te(6,ec),Te(7,Vr)],Uf);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 bf;(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=""))(bf||={});var $T;(e=>e.ST=`${pe.ESC}\\`)($T||={});var ry=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${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),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ry=bn([Te(2,Ri),Te(3,Li),Te(4,Mo),Te(5,Yr)],ry);var Yn=0,Xn=0,Zn=0,yn=0,zC={css:"#00000000",rgba:0},Dn;(e=>{function t(r,o,c,d){return d!==void 0?`#${oo(r)}${oo(o)}${oo(c)}${oo(d)}`:`#${oo(r)}${oo(o)}${oo(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(Dn||={});var Qt;(e=>{function t(p,f){if(yn=(f.rgba&255)/255,yn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,v=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;Yn=S+Math.round((g-S)*yn),Xn=w+Math.round((v-w)*yn),Zn=x+Math.round((b-x)*yn);let E=Dn.toCss(Yn,Xn,Zn),A=Dn.toRgba(Yn,Xn,Zn);return{css:E,rgba:A}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let v=Sf.ensureContrastRatio(p.rgba,f.rgba,g);if(v)return Dn.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[Yn,Xn,Zn]=Sf.toChannels(f),{css:Dn.toCss(Yn,Xn,Zn),rgba:f}}e.opaque=r;function o(p,f){return yn=Math.round(f*255),[Yn,Xn,Zn]=Sf.toChannels(p.rgba),{css:Dn.toCss(Yn,Xn,Zn,yn),rgba:Dn.toRgba(Yn,Xn,Zn,yn)}}e.opacity=o;function c(p,f){return yn=p.rgba&255,o(p,yn*f/255)}e.multiplyOpacity=c;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(Qt||={});var dn;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Yn=parseInt(r.slice(1,2).repeat(2),16),Xn=parseInt(r.slice(2,3).repeat(2),16),Zn=parseInt(r.slice(3,4).repeat(2),16),Dn.toColor(Yn,Xn,Zn);case 5:return Yn=parseInt(r.slice(1,2).repeat(2),16),Xn=parseInt(r.slice(2,3).repeat(2),16),Zn=parseInt(r.slice(3,4).repeat(2),16),yn=parseInt(r.slice(4,5).repeat(2),16),Dn.toColor(Yn,Xn,Zn,yn);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 Yn=parseInt(o[1]),Xn=parseInt(o[2]),Zn=parseInt(o[3]),yn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Dn.toColor(Yn,Xn,Zn,yn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Yn,Xn,Zn,yn]=t.getImageData(0,0,1,1).data,yn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Dn.toRgba(Yn,Xn,Zn,yn),css:r}}e.toColor=i})(dn||={});var xi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,p=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+v*.0722}e.relativeLuminance2=n})(xi||={});var Sf;(e=>{function t(c,d){if(yn=(d&255)/255,yn===1)return d;let p=d>>24&255,f=d>>16&255,g=d>>8&255,v=c>>24&255,b=c>>16&255,S=c>>8&255;return Yn=v+Math.round((p-v)*yn),Xn=b+Math.round((f-b)*yn),Zn=S+Math.round((g-S)*yn),Dn.toRgba(Yn,Xn,Zn)}e.blend=t;function n(c,d,p){let f=xi.relativeLuminance(c>>8),g=xi.relativeLuminance(d>>8);if(Ir(f,g)<p){if(g<f){let S=i(c,d,p),w=Ir(f,xi.relativeLuminance(S>>8));if(w<p){let x=r(c,d,p),E=Ir(f,xi.relativeLuminance(x>>8));return w>E?S:x}return S}let v=r(c,d,p),b=Ir(f,xi.relativeLuminance(v>>8));if(b<p){let S=i(c,d,p),w=Ir(f,xi.relativeLuminance(S>>8));return b>w?v:S}return v}}e.ensureContrastRatio=n;function i(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Ir(xi.relativeLuminance2(b,S,w),xi.relativeLuminance2(f,g,v));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Ir(xi.relativeLuminance2(b,S,w),xi.relativeLuminance2(f,g,v));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,p){let f=c>>24&255,g=c>>16&255,v=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Ir(xi.relativeLuminance2(b,S,w),xi.relativeLuminance2(f,g,v));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Ir(xi.relativeLuminance2(b,S,w),xi.relativeLuminance2(f,g,v));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Sf||={});function oo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ir(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var qI=class extends mh{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Wf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ms}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),r=0,o=0,c=0,d=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==p){if(f-r>1){let g=this._getJoinedRanges(i,c,o,t,r);for(let v=0;v<g.length;v++)n.push(g[v])}r=f,c=o,d=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||Da.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(i,c,o,t,r);for(let g=0;g<f.length;g++)n.push(f[g])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let p=this._characterJoiners[d].handler(o);for(let f=0;f<p.length;f++)Wf._mergeRanges(c,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,i,r),c}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,c=e[i];if(c){for(let d=n;d<this._bufferService.cols;d++){let p=t.getWidth(d),f=t.getString(d).length||Da.length;if(p!==0){if(!r&&c[0]<=o&&(c[0]=d,r=!0),c[1]<=o){if(c[1]=d,c=e[++i],!c)break;c[0]<=o?(c[0]=d,r=!0):r=!1}o+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];if(n){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Wf=bn([Te(0,Ri)],Wf);function KI(e){return 57508<=e&&e<=57558}function VI(e){return 9472<=e&&e<=9631}function YI(e){return KI(e)||VI(e)}function XI(){return{css:{canvas:Hd(),cell:Hd()},device:{canvas:Hd(),cell:Hd(),char:{width:0,height:0,left:0,top:0}}}}function Hd(){return{width:0,height:0}}var ay=class{constructor(e,t,n,i,r,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=c,this._workCell=new Ms,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,c,d,p,f,g){let v=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,E=0,A="",L=0,I=0,R=0,z=0,O=!1,H=0,F=!1,ae=0,fe=0,V=[],$=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,k=N>=fe,j=N,B=this._workCell;if(b.length>0&&N===b[0][0]&&k){let Se=b.shift(),$e=this._isCellInSelection(Se[0],t);for(L=Se[0]+1;L<Se[1];L++)k&&=$e===this._isCellInSelection(L,t);k&&=!n||o<Se[0]||o>=Se[1],k?(T=!0,B=new qI(this._workCell,e.translateToString(!0,Se[0],Se[1]),Se[1]-Se[0]),j=Se[1]-1,D=B.getWidth()):fe=Se[1]}let q=this._isCellInSelection(N,t),J=n&&N===o,P=$&&N>=f&&N<=g,X=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Se=>{X=!0});let Q=B.getChars()||Da;if(Q===" "&&(B.isUnderline()||B.isOverline())&&(Q=" "),ae=D*d-p.get(Q,B.isBold(),B.isItalic()),!x)x=this._document.createElement("span");else if(E&&(q&&F||!q&&!F&&B.bg===I)&&(q&&F&&S.selectionForeground||B.fg===R)&&B.extended.ext===z&&P===O&&ae===H&&!J&&!T&&!X&&k){B.isInvisible()?A+=Da:A+=Q,E++;continue}else E&&(x.textContent=A),x=this._document.createElement("span"),E=0,A="";if(I=B.bg,R=B.fg,z=B.extended.ext,O=P,H=ae,F=q,T&&o>=N&&o<=j&&(o=N),!this._coreService.isCursorHidden&&J&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&V.push("xterm-cursor-blink"),V.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(B.isBold()&&V.push("xterm-bold"),B.isItalic()&&V.push("xterm-italic"),B.isDim()&&V.push("xterm-dim"),B.isInvisible()?A=Da:A=B.getChars()||Da,B.isUnderline()&&(V.push(`xterm-underline-${B.extended.underlineStyle}`),A===" "&&(A=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${mh.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let Se=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&Se<8&&(Se+=8),x.style.textDecorationColor=S.ansi[Se].css}B.isOverline()&&(V.push("xterm-overline"),A===" "&&(A=" ")),B.isStrikethrough()&&V.push("xterm-strikethrough"),P&&(x.style.textDecoration="underline");let Y=B.getFgColor(),ie=B.getFgColorMode(),me=B.getBgColor(),ye=B.getBgColorMode(),ke=!!B.isInverse();if(ke){let Se=Y;Y=me,me=Se;let $e=ie;ie=ye,ye=$e}let Le,ct,je=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Se=>{Se.options.layer!=="top"&&je||(Se.backgroundColorRGB&&(ye=50331648,me=Se.backgroundColorRGB.rgba>>8&16777215,Le=Se.backgroundColorRGB),Se.foregroundColorRGB&&(ie=50331648,Y=Se.foregroundColorRGB.rgba>>8&16777215,ct=Se.foregroundColorRGB),je=Se.options.layer==="top")}),!je&&q&&(Le=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,me=Le.rgba>>8&16777215,ye=50331648,je=!0,S.selectionForeground&&(ie=50331648,Y=S.selectionForeground.rgba>>8&16777215,ct=S.selectionForeground)),je&&V.push("xterm-decoration-top");let Ae;switch(ye){case 16777216:case 33554432:Ae=S.ansi[me],V.push(`xterm-bg-${me}`);break;case 50331648:Ae=Dn.toColor(me>>16,me>>8&255,me&255),this._addStyle(x,`background-color:#${$C((me>>>0).toString(16),"0",6)}`);break;default:ke?(Ae=S.foreground,V.push("xterm-bg-257")):Ae=S.background}switch(Le||B.isDim()&&(Le=Qt.multiplyOpacity(Ae,.5)),ie){case 16777216:case 33554432:B.isBold()&&Y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Y+=8),this._applyMinimumContrast(x,Ae,S.ansi[Y],B,Le,void 0)||V.push(`xterm-fg-${Y}`);break;case 50331648:let Se=Dn.toColor(Y>>16&255,Y>>8&255,Y&255);this._applyMinimumContrast(x,Ae,Se,B,Le,ct)||this._addStyle(x,`color:#${$C(Y.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Ae,S.foreground,B,Le,ct)||ke&&V.push("xterm-fg-257")}V.length&&(x.className=V.join(" "),V.length=0),!J&&!T&&!X&&k?E++:x.textContent=A,ae!==this.defaultSpacing&&(x.style.letterSpacing=`${ae}px`),v.push(x),N=j}return x&&E&&(x.textContent=A),v}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||YI(i.getCode()))return!1;let c=this._getContrastCache(i),d;if(!r&&!o&&(d=c.getColor(t.rgba,n.rgba)),d===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Qt.ensureContrastRatio(r||t,o||n,p),c.setColor((r||t).rgba,(o||n).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};ay=bn([Te(1,wT),Te(2,Li),Te(3,Vr),Te(4,Mo),Te(5,gh),Te(6,ec)],ay);function $C(e,t,n){for(;e.length<n;)e=t+e;return e}var ZI=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,i,r,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},JI=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,c=n[1]-r,d=Math.max(o,0),p=Math.min(c,e.rows-1);if(d>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function QI(){return new JI}var w_="xterm-dom-renderer-owner-",Cs="xterm-rows",Fd="xterm-fg-",HC="xterm-bg-",su="xterm-focus",Ud="xterm-selection",eB=1,oy=class extends ot{constructor(e,t,n,i,r,o,c,d,p,f,g,v,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=f,this._bufferService=g,this._coreService=v,this._coreBrowserService=b,this._themeService=S,this._terminalClass=eB++,this._rowElements=[],this._selectionRenderModel=QI(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Cs),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(Ud),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=XI(),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(ay,document),this._element.classList.add(w_+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(cn(()=>{this._element.classList.remove(w_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ZI(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Cs} 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} .${Cs} { 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} .${Cs} .xterm-dim { color: ${Qt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Cs}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Cs}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Cs}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Cs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Cs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Cs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Cs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Cs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ud} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ud} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ud} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Fd}${o} { color: ${c.css}; }${this._terminalSelector} .${Fd}${o}.xterm-dim { color: ${Qt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${HC}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Fd}257 { color: ${Qt.opaque(e.background).css}; }${this._terminalSelector} .${Fd}257.xterm-dim { color: ${Qt.multiplyOpacity(Qt.opaque(e.background),.5).css}; }${this._terminalSelector} .${HC}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(su),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(su),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];d.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=i===o?e[0]:0,f=o===r?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,p,f));let g=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let v=r===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,v))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${c}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let f=p+n.ydisp,g=this._rowElements[p],v=n.lines.get(f);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,f,f===i,c,d,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${w_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,i,r,o){n<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),i=Math.max(Math.min(i,c),0),r=Math.min(r,this._bufferService.cols);let d=this._bufferService.buffer,p=d.ybase+d.y,f=Math.min(d.x,r-1),g=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+d.ydisp,x=this._rowElements[S],E=d.lines.get(w);if(!x||!E)break;x.replaceChildren(...this._rowFactory.createRow(E,w,w===p,v,b,f,g,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};oy=bn([Te(7,Pb),Te(8,wp),Te(9,Li),Te(10,Ri),Te(11,Mo),Te(12,Vr),Te(13,ec)],oy);var ly=class extends ot{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new nB(this._optionsService))}catch{this._measureStrategy=this._register(new tB(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())}};ly=bn([Te(2,Li)],ly);var HT=class extends ot{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)}},tB=class extends HT{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},nB=class extends HT{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}},iB=class extends ot{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new sB(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(ci.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Xe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Xe(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}},sB=class extends ot{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Fl),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(cn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Xe(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)}},rB=class extends ot{constructor(){super(),this.linkProviders=[],this._register(cn(()=>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 qb(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),c=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-c]}function aB(e,t,n,i,r,o,c,d,p){if(!o)return;let f=qb(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(p?c/2:0))/c),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),i+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),r),f}var cy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return aB(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=qb(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};cy=bn([Te(0,Yr),Te(1,wp)],cy);var oB=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},FT={};_7(FT,{getSafariVersion:()=>cB,isChromeOS:()=>qT,isFirefox:()=>UT,isIpad:()=>uB,isIphone:()=>hB,isLegacyEdge:()=>lB,isLinux:()=>Kb,isMac:()=>Gf,isNode:()=>xp,isSafari:()=>WT,isWindows:()=>GT});var xp=typeof process<"u"&&"title"in process,_h=xp?"node":navigator.userAgent,vh=xp?"node":navigator.platform,UT=_h.includes("Firefox"),lB=_h.includes("Edge"),WT=/^((?!chrome|android).)*safari/i.test(_h);function cB(){if(!WT)return 0;let e=_h.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Gf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vh),uB=vh==="iPad",hB=vh==="iPhone",GT=["Windows","Win16","Win32","WinCE"].includes(vh),Kb=vh.indexOf("Linux")>=0,qT=/\bCrOS\b/.test(_h),KT=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},dB=class extends KT{_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())}}},fB=class extends KT{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},qf=!xp&&"requestIdleCallback"in window?fB:dB,pB=class{constructor(){this._queue=new qf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},uy=class extends ot{constructor(e,t,n,i,r,o,c,d,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new Fl),this._pausedResizeTask=new pB,this._observerDisposable=this._register(new Fl),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 we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new oB((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new mB(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(cn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=cn(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};uy=bn([Te(2,Li),Te(3,wp),Te(4,Mo),Te(5,gh),Te(6,Ri),Te(7,Vr),Te(8,ec)],uy);var mB=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function gB(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return yB(r,o,e,t,n,i)+Cp(o,t,n,i)+bB(r,o,e,t,n,i);let c;if(o===t)return c=r>e?"D":"C",Ju(Math.abs(r-e),Zu(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),p=vB(o>t?e:r,n)+(d-1)*n.cols+1+_B(o>t?r:e);return Ju(p,Zu(c,i))}function _B(e,t){return e-1}function vB(e,t){return t.cols-e}function yB(e,t,n,i,r,o){return Cp(t,i,r,o).length===0?"":Ju(YT(e,t,e,t-Ao(t,r),!1,r).length,Zu("D",o))}function Cp(e,t,n,i){let r=e-Ao(e,n),o=t-Ao(t,n),c=Math.abs(r-o)-SB(e,t,n);return Ju(c,Zu(VT(e,t),i))}function bB(e,t,n,i,r,o){let c;Cp(t,i,r,o).length>0?c=i-Ao(i,r):c=t;let d=i,p=wB(e,t,n,i,r,o);return Ju(YT(e,c,n,d,p==="C",r).length,Zu(p,o))}function SB(e,t,n){let i=0,r=e-Ao(e,n),o=t-Ao(t,n);for(let c=0;c<Math.abs(r-o);c++){let d=VT(e,t)==="A"?-1:1;n.buffer.lines.get(r+d*c)?.isWrapped&&i++}return i}function Ao(e,t){let n=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return n}function wB(e,t,n,i,r,o){let c;return Cp(n,i,r,o).length>0?c=i-Ao(i,r):c=t,e<n&&c<=i||e>=n&&c<i?"C":"D"}function VT(e,t){return e>t?"A":"B"}function YT(e,t,n,i,r,o){let c=e,d=t,p="";for(;(c!==n||d!==i)&&d>=0&&d<o.buffer.lines.length;)c+=r?1:-1,r&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!r&&c<0&&(p+=o.buffer.translateBufferLineToString(d,!1,0,e+1),c=o.cols-1,e=c,d--);return p+o.buffer.translateBufferLineToString(d,!1,e,c)}function Zu(e,t){let n=t?"O":"[";return pe.ESC+n+e}function Ju(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var xB=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 FC(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 x_=50,CB=15,kB=50,EB=500,TB=" ",AB=new RegExp(TB,"g"),hy=class extends ot{constructor(e,t,n,i,r,o,c,d,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ms,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),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 xB(this._bufferService),this._activeSelectionMode=0,this._register(cn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=n.translateBufferLineToString(c,!0,r,o);i.push(d)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),d=n.translateBufferLineToString(o,!0);c?.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(r=>r.replace(AB," ")).join(GT?`\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())),Kb&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=FC(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=qb(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-x_),x_),t/=x_,t/Math.abs(t)+Math.round(t*(CB-1)))}shouldForceSelection(e){return Gf?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(),kB)}_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&&!(Gf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let i=n.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<EB&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let i=gB(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==i&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let c=r.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),p=d,f=e[0]-d,g=0,v=0,b=0,S=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let E=e[0],A=e[0];o.getWidth(E)===0&&(g++,E--),o.getWidth(A)===2&&(v++,A++);let L=o.getString(A).length;for(L>1&&(S+=L-1,p+=L-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,E--):I>1&&(b+=I-1,d-=I-1),d--,E--}for(;A<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(A+1,this._workCell));){o.loadCell(A+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,A++):I>1&&(S+=I-1,p+=I-1),p++,A++}}p++;let w=d+f-g+b,x=Math.min(this._bufferService.cols,p-d+g+v-b-S);if(!(!t&&c.slice(d,p).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let E=r.lines.get(e[1]-1);if(E&&o.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let A=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(A){let L=this._bufferService.cols-A.start;w-=L,x+=L}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=r.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let A=this._getWordAt([0,e[1]+1],!1,!1,!0);A&&(x+=A.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=FC(n,this._bufferService.cols)}};hy=bn([Te(3,Ri),Te(4,Mo),Te(5,zb),Te(6,Li),Te(7,Yr),Te(8,Vr)],hy);var UC=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},WC=class{constructor(){this._color=new UC,this._css=new UC}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},zn=Object.freeze((()=>{let e=[dn.toColor("#2e3436"),dn.toColor("#cc0000"),dn.toColor("#4e9a06"),dn.toColor("#c4a000"),dn.toColor("#3465a4"),dn.toColor("#75507b"),dn.toColor("#06989a"),dn.toColor("#d3d7cf"),dn.toColor("#555753"),dn.toColor("#ef2929"),dn.toColor("#8ae234"),dn.toColor("#fce94f"),dn.toColor("#729fcf"),dn.toColor("#ad7fa8"),dn.toColor("#34e2e2"),dn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],r=t[n/6%6|0],o=t[n%6];e.push({css:Dn.toCss(i,r,o),rgba:Dn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:Dn.toCss(i,i,i),rgba:Dn.toRgba(i,i,i)})}return e})()),fo=dn.toColor("#ffffff"),ku=dn.toColor("#000000"),GC=dn.toColor("#ffffff"),qC=ku,ru={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},RB=fo,dy=class extends ot{constructor(e){super(),this._optionsService=e,this._contrastCache=new WC,this._halfContrastCache=new WC,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:fo,background:ku,cursor:GC,cursorAccent:qC,selectionForeground:void 0,selectionBackgroundTransparent:ru,selectionBackgroundOpaque:Qt.blend(ku,ru),selectionInactiveBackgroundTransparent:ru,selectionInactiveBackgroundOpaque:Qt.blend(ku,ru),scrollbarSliderBackground:Qt.opacity(fo,.2),scrollbarSliderHoverBackground:Qt.opacity(fo,.4),scrollbarSliderActiveBackground:Qt.opacity(fo,.5),overviewRulerBorder:fo,ansi:zn.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=Ft(e.foreground,fo),t.background=Ft(e.background,ku),t.cursor=Qt.blend(t.background,Ft(e.cursor,GC)),t.cursorAccent=Qt.blend(t.background,Ft(e.cursorAccent,qC)),t.selectionBackgroundTransparent=Ft(e.selectionBackground,ru),t.selectionBackgroundOpaque=Qt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ft(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Qt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ft(e.selectionForeground,zC):void 0,t.selectionForeground===zC&&(t.selectionForeground=void 0),Qt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Qt.opacity(t.selectionBackgroundTransparent,.3)),Qt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Qt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ft(e.scrollbarSliderBackground,Qt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ft(e.scrollbarSliderHoverBackground,Qt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ft(e.scrollbarSliderActiveBackground,Qt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ft(e.overviewRulerBorder,RB),t.ansi=zn.slice(),t.ansi[0]=Ft(e.black,zn[0]),t.ansi[1]=Ft(e.red,zn[1]),t.ansi[2]=Ft(e.green,zn[2]),t.ansi[3]=Ft(e.yellow,zn[3]),t.ansi[4]=Ft(e.blue,zn[4]),t.ansi[5]=Ft(e.magenta,zn[5]),t.ansi[6]=Ft(e.cyan,zn[6]),t.ansi[7]=Ft(e.white,zn[7]),t.ansi[8]=Ft(e.brightBlack,zn[8]),t.ansi[9]=Ft(e.brightRed,zn[9]),t.ansi[10]=Ft(e.brightGreen,zn[10]),t.ansi[11]=Ft(e.brightYellow,zn[11]),t.ansi[12]=Ft(e.brightBlue,zn[12]),t.ansi[13]=Ft(e.brightMagenta,zn[13]),t.ansi[14]=Ft(e.brightCyan,zn[14]),t.ansi[15]=Ft(e.brightWhite,zn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=Ft(e.extendedAnsi[i],zn[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};dy=bn([Te(0,Li)],dy);function Ft(e,t){if(e!==void 0)try{return dn.toColor(e)}catch{}return t}var LB=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},NB=class{constructor(){this._services=new LB,this._services.set(Pb,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=C7(e).sort((o,c)=>o.index-c.index),i=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(c)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},MB={trace:0,debug:1,info:2,warn:3,error:4,off:5},OB="xterm.js: ",fy=class extends ot{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=MB[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":OB)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};fy=bn([Te(0,Li)],fy);var KC=class extends ot{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},at=3,Mn=Object.freeze(new mh),Wd=0,C_=2,Eu=class XT{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*at);let r=n||Ms.fromCharData([0,mT,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*at+0],i=n&2097151;return[this._data[t*at+1],n&2097152?this._combined[t]:i?Na(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*at+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*at+0]=t|2097152|n[2]<<22):this._data[t*at+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*at+0]>>22}hasWidth(t){return this._data[t*at+0]&12582912}getFg(t){return this._data[t*at+1]}getBg(t){return this._data[t*at+2]}hasContent(t){return this._data[t*at+0]&4194303}getCodePoint(t){let n=this._data[t*at+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*at+0]&2097152}getString(t){let n=this._data[t*at+0];return n&2097152?this._combined[t]:n&2097151?Na(n&2097151):""}isProtected(t){return this._data[t*at+2]&536870912}loadCell(t,n){return Wd=t*at,n.content=this._data[Wd+0],n.fg=this._data[Wd+1],n.bg=this._data[Wd+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*at+0]=n.content,this._data[t*at+1]=n.fg,this._data[t*at+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*at+0]=n|i<<22,this._data[t*at+1]=r.fg,this._data[t*at+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*at+0];r&2097152?this._combined[t]+=Na(n):r&2097151?(this._combined[t]=Na(r&2097151)+Na(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*at+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new Ms;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new Ms;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*C_<this._data.buffer.byteLength;let i=t*at;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let c=0;c<r.length;c++){let d=parseInt(r[c],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let d=parseInt(o[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*C_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*C_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new XT(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*at+0]&4194303)return t+(this._data[t*at+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*at+0]&4194303||this._data[t*at+2]&50331648)return t+(this._data[t*at+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let c=t._data;if(o)for(let p=r-1;p>=0;p--){for(let f=0;f<at;f++)this._data[(i+p)*at+f]=c[(n+p)*at+f];c[(n+p)*at+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}else for(let p=0;p<r;p++){for(let f=0;f<at;f++)this._data[(i+p)*at+f]=c[(n+p)*at+f];c[(n+p)*at+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}let d=Object.keys(t._combined);for(let p=0;p<d.length;p++){let f=parseInt(d[p],10);f>=n&&(this._combined[f-n+i]=t._combined[f])}}translateToString(t,n,i,r){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;n<i;){let c=this._data[n*at+0],d=c&2097151,p=c&2097152?this._combined[n]:d?Na(d):Da;if(o+=p,r)for(let f=0;f<p.length;++f)r.push(n);n+=c>>22||1}return r&&r.push(n),o}};function DB(e,t,n,i,r,o){let c=[];for(let d=0;d<e.length-1;d++){let p=d,f=e.get(++p);if(!f.isWrapped)continue;let g=[e.get(d)];for(;p<e.length&&f.isWrapped;)g.push(f),f=e.get(++p);if(!o&&i>=d&&i<p){d+=g.length-1;continue}let v=0,b=Qu(g,v,t),S=1,w=0;for(;S<g.length;){let E=Qu(g,S,t),A=E-w,L=n-b,I=Math.min(A,L);g[v].copyCellsFrom(g[S],w,b,I,!1),b+=I,b===n&&(v++,b=0),w+=I,w===E&&(S++,w=0),b===0&&v!==0&&g[v-1].getWidth(n-1)===2&&(g[v].copyCellsFrom(g[v-1],n-1,b++,1,!1),g[v-1].setCell(n-1,r))}g[v].replaceCells(b,n,r);let x=0;for(let E=g.length-1;E>0&&(E>v||g[E].getTrimmedLength()===0);E--)x++;x>0&&(c.push(d+g.length-x),c.push(x)),d+=g.length-1}return c}function jB(e,t){let n=[],i=0,r=t[i],o=0;for(let c=0;c<e.length;c++)if(r===c){let d=t[++i];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,r=t[++i]}else n.push(c);return{layout:n,countRemoved:o}}function IB(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function BB(e,t,n){let i=[],r=e.map((p,f)=>Qu(e,f,t)).reduce((p,f)=>p+f),o=0,c=0,d=0;for(;d<r;){if(r-d<n){i.push(r-d);break}o+=n;let p=Qu(e,c,t);o>p&&(o-=p,c++);let f=e[c].getWidth(o-1)===2;f&&o--;let g=f?n-1:n;i.push(g),d+=g}return i}function Qu(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?n-1:n}var ZT=class JT{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=JT._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),To(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ZT._nextId=1;var PB=ZT,Hn={},po=Hn.B;Hn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Hn.A={"#":"£"};Hn.B=void 0;Hn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Hn.C=Hn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Hn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Hn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Hn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Hn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Hn.E=Hn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Hn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Hn.H=Hn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Hn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var VC=4294967295,YC=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Mn.clone(),this.savedCharset=po,this.markers=[],this._nullCell=Ms.fromCharData([0,mT,1,0]),this._whitespaceCell=Ms.fromCharData([0,Da,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new qf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new KC(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 Ff),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 Ff),this._whitespaceCell}getBlankLine(e,t){return new Eu(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>VC?VC:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Mn);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 KC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Mn),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Eu(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Eu(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let c=this.lines.length-r;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=DB(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Mn),n);if(i.length>0){let r=jB(this.lines,i);IB(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(Mn),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Eu(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Mn),r=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let p=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),p.unshift(d);if(!n){let I=this.ybase+this.y;if(I>=c&&I<c+p.length)continue}let f=p[p.length-1].getTrimmedLength(),g=BB(p,this._cols,e),v=g.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+v):b=Math.max(0,this.lines.length-this.lines.maxLength+v);let S=[];for(let I=0;I<v;I++){let R=this.getBlankLine(Mn,!0);S.push(R)}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 E=p.length-v-1,A=f;for(;E>=0;){let I=Math.min(A,x);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[E],A-I,x-I,I,!0),x-=I,x===0&&(w--,x=g[w]),A-=I,A===0){E--;let R=Math.max(E,0);A=Qu(p,R,this._cols)}}for(let I=0;I<p.length;I++)g[I]<e&&p[I].setCell(g[I],i);let L=v-b;for(;L-- >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 b=0;for(let x=Math.min(this.lines.maxLength-1,p+o-1);x>=0;x--)if(v&&v.start>f+b){for(let E=v.newLines.length-1;E>=0;E--)this.lines.set(x--,v.newLines[E]);x++,c.push({index:f+1,amount:v.newLines.length}),b+=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,n=0,i){let r=this.lines.get(e);return r?r.translateToString(t,n,i):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new PB(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},zB=class extends ot{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),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 YC(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new YC(!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)}},QT=2,eA=1,py=class extends ot{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,QT),this.rows=Math.max(e.rawOptions.rows||0,eA),this.buffers=this._register(new zB(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-r+1;n.lines.shiftElements(r+1,c-1,-1),n.lines.set(o,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};py=bn([Te(0,Li)],py);var _l={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:Gf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},$B=["normal","bold","100","200","300","400","500","600","700","800","900"],HB=class extends ot{constructor(e){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let t={..._l};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(cn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in _l))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in _l))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=_l[e]),!FB(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_l[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=$B.includes(t)?t:_l[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 FB(e){return e==="block"||e==="underline"||e==="bar"}function Tu(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&Tu(e[i],t-1);return n}var XC=Object.freeze({insertMode:!1}),ZC=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),my=class extends ot{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Tu(XC),this.decPrivateModes=Tu(ZC)}reset(){this.modes=Tu(XC),this.decPrivateModes=Tu(ZC)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};my=bn([Te(0,Ri),Te(1,bT),Te(2,Li)],my);var JC={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 k_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var E_=String.fromCharCode,QC={DEFAULT:e=>{let t=[k_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${E_(t[0])}${E_(t[1])}${E_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${k_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${k_(e,!0)};${e.x};${e.y}${t}`}},gy=class extends ot{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(JC))this.addProtocol(i,JC[i]);for(let i of Object.keys(QC))this.addEncoding(i,QC[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let i=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};gy=bn([Te(0,Ri),Te(1,Mo),Te(2,Li)],gy);var T_=[[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]],UB=[[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]],$n;function WB(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var GB=class{constructor(){if(this.version="6",!$n){$n=new Uint8Array(65536),$n.fill(1),$n[0]=0,$n.fill(0,1,32),$n.fill(0,127,160),$n.fill(2,4352,4448),$n[9001]=2,$n[9002]=2,$n.fill(2,11904,42192),$n[12351]=1,$n.fill(2,44032,55204),$n.fill(2,63744,64256),$n.fill(2,65040,65050),$n.fill(2,65072,65136),$n.fill(2,65280,65377),$n.fill(2,65504,65511);for(let e=0;e<T_.length;++e)$n.fill(0,T_[e][0],T_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$n[e]:WB(e,UB)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let r=go.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return go.createPropertyValue(0,n,i)}},go=class wf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let t=new GB;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let d=this.charProperties(c,i),p=wf.extractWidth(d);wf.extractShouldJoin(d)&&(p-=wf.extractWidth(i)),n+=p,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},qB=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 e2(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var au=2147483647,KB=256,tA=class _y{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>KB)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new _y;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)n.addSubParam(r[o]);else n.addParam(r)}return n}clone(){let t=new _y(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>au?au: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>au?au:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&(t[n]=this._subParams.slice(i,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[n-1];i[n-1]=~r?Math.min(r*10+t,au):t}},ou=[],VB=class{constructor(){this._state=0,this._active=ou,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ou}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=ou,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ou,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Sp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=ou,this._id=-1,this._state=0}}},as=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=Sp(t,n,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,n}},lu=[],YB=class{constructor(){this._handlers=Object.create(null),this._active=lu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=lu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=lu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||lu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Sp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=lu,this._ident=0}},Au=new tA;Au.addParam(0);var t2=class{constructor(e){this._handler=e,this._data="",this._params=Au,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Au,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Sp(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Au,this._data="",this._hitLimit=!1,n));return this._params=Au,this._data="",this._hitLimit=!1,t}},XB=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},Ls=160,ZB=(function(){let e=new XB(4095),t=Array.apply(null,Array(256)).map((d,p)=>p),n=(d,p)=>t.slice(d,p),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ls,0,2,0),e.add(Ls,8,5,8),e.add(Ls,6,0,6),e.add(Ls,11,0,11),e.add(Ls,13,13,13),e})(),JB=class extends ot{constructor(e=ZB){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 tA,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(cn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new VB),this._dcsParser=this._register(new YB),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let i=this._escHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,n){let i=0,r=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=d[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=d[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],r=this._transitions.table[this.currentState<<8|(i<160?i:Ls)],r>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Ls){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ls){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ls){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ls){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(c=p[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,p,f,r,d),c;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],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|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Ls){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=d+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Ls){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},QB=/^([\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})$/,eP=/^[\da-f]+$/;function n2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=QB.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),eP.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(n*r,n*r+n),16);i[r]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function A_(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function tP(e,t=16){let[n,i,r]=e;return`rgb:${A_(n,t)}/${A_(i,t)}/${A_(r,t)}`}var nP={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ka=131072,i2=10;function s2(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 r2=5e3,a2=0,iP=class extends ot{constructor(e,t,n,i,r,o,c,d,p=new JB){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w7,this._utf8Decoder=new x7,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Mn.clone(),this._eraseAttrDataInternal=Mn.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),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 vy(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(bf.IND,()=>this.index()),this._parser.setExecuteHandler(bf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new as(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new as(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new as(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new as(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new as(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new as(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new as(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new as(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new as(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new as(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new as(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new as(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 Hn)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 t2((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),r2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${r2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ka&&(o=this._parseStack.position+ka)}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<ka&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ka))),c||this._dirtyRowTracker.clearRange(),e.length>ka)for(let f=o;f<e.length;f+=ka){let g=f+ka<e.length?f+ka: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(n=this._parser.parse(this._parseBuffer,v))return this._preserveStack(i,r,v,f),this._logSlowResolvingAsync(n),n}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,r,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let A=o[String.fromCharCode(i)];A&&(i=A.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=go.extractWidth(w);let x=go.extractShouldJoin(w),E=x?go.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(Na(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-E>d){if(p){let A=v,L=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),E>0&&v instanceof Eu&&v.copyCellsFrom(A,L,0,E,!1);L<d;)A.setCellFromCodepoint(L++,0,1,g)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let A=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-A,i,r);for(let L=r-E;--L>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(v.insertCells(this._activeBuffer.x,r-E,this._activeBuffer.getNullCell(g)),v.getWidth(d-1)===2&&v.setCellFromCodepoint(d-1,0,1,g)),v.setCellFromCodepoint(this._activeBuffer.x++,i,r,g),r>0)for(;--r;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-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,n=>s2(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new t2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new as(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Mn));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,i=go.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),c=new Uint32Array(o.length*n),d=0;for(let f=0;f<o.length;){let g=o.codePointAt(f)||0;c[d++]=g,f+=g>65535?2:1}let p=d;for(let f=1;f<n;++f)c.copyWithin(p,0,d),p+=d;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(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,po),this._charsetService.setgCharset(1,po),this._charsetService.setgCharset(2,po),this._charsetService.setgCharset(3,po);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:p}=this._bufferService,{active:f,alt:g}=d,v=this._optionsService.rawOptions,b=(x,E)=>(c.triggerDataEvent(`${pe.ESC}[${t?"":"?"}${x};${E}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(c.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(v.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,v.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(v.cursorBlink)):w===25?b(w,S(!c.isCursorHidden)):w===45?b(w,S(i.reverseWraparound)):w===66?b(w,S(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,S(r==="VT200")):w===1002?b(w,S(r==="DRAG")):w===1003?b(w,S(r==="ANY")):w===1004?b(w,S(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,S(o==="SGR")):w===1015?b(w,4):w===1016?b(w,S(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,S(f===g)):w===2004?b(w,S(i.bracketedPasteMode)):w===2026?b(w,S(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,n,i,r){return t===2?(e|=50331648,e&=-16777216,e|=mh.fromColorRGB([n,i,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do i[1]===5&&(r=1),i[o+d+1+r]=c[d];while(++d<c.length&&d+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Mn.fg,e.bg=Mn.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,i=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=Mn.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=Mn.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=Mn.fg&16777215,i.bg&=-67108864,i.bg|=Mn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);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,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Mn.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!s2(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>i2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>i2&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let i=n.shift(),r=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(o2(o))if(r==="?")t.push({type:0,index:o});else{let c=n2(r);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,r=n.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=n2(n[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let r=parseInt(n[i]);o2(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,po),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(nP[e[0]],Hn[e[1]]||po),!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=Mn.clone(),this._eraseAttrDataInternal=Mn.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 Ms;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${pe.ESC}${c}${pe.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vy=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&&(a2=e,e=t,t=a2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vy=bn([Te(0,Ri)],vy);function o2(e){return 0<=e&&e<256}var sP=5e7,l2=12,rP=50,aP=class extends ot{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 we),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>sP)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let c=d=>performance.now()-n>=l2?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(n,d);r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=l2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rP&&(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()}},yy=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(p,d)),this._dataByLinkId.set(p.id,p),p.id}let n=e,i=this._getEntryIdKey(n),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};yy=bn([Te(0,Ri)],yy);var c2=!1,oP=class extends ot{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Fl),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new NB,this.optionsService=this._register(new HB(e)),this._instantiationService.setService(Li,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(py)),this._instantiationService.setService(Ri,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(fy)),this._instantiationService.setService(bT,this._logService),this.coreService=this._register(this._instantiationService.createInstance(my)),this._instantiationService.setService(Mo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(gy)),this._instantiationService.setService(yT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(go)),this._instantiationService.setService(T7,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qB),this._instantiationService.setService(E7,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(yy),this._instantiationService.setService(ST,this._oscLinkService),this._inputHandler=this._register(new iP(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ci.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ci.forward(this._bufferService.onResize,this._onResize)),this._register(ci.forward(this.coreService.onData,this._onData)),this._register(ci.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 aP((t,n)=>this._inputHandler.parse(t,n))),this._register(ci.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),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&&!c2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),c2=!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,QT),t=Math.max(t,eA),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(e2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(e2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=cn(()=>{for(let t of e)t.dispose()})}}},lP={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 cP(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=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((!n||i)&&e.altKey&&!e.metaKey){let c=lP[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 n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=pe.US),e.key==="@"&&(r.key=pe.NUL));break}return r}var xn=0,uP=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new qf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new qf,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,o)=>this._getKey(r)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[r]=e[t],t++):i[r]=this._array[n++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(xn=this._search(t),xn===-1)||this._getKey(this._array[xn])!==t)return!1;do if(this._array[xn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(xn),!0;while(++xn<this._array.length&&this._getKey(this._array[xn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[i++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(xn=this._search(e),!(xn<0||xn>=this._array.length)&&this._getKey(this._array[xn])===e))do yield this._array[xn];while(++xn<this._array.length&&this._getKey(this._array[xn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(xn=this._search(e),!(xn<0||xn>=this._array.length)&&this._getKey(this._array[xn])===e))do t(this._array[xn]);while(++xn<this._array.length&&this._getKey(this._array[xn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,r=this._getKey(this._array[i]);if(r>e)n=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},R_=0,u2=0,hP=class extends ot{constructor(){super(),this._decorations=new uP(e=>e?.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(cn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dP(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,r=>{R_=r.options.x??0,u2=R_+(r.options.width??1),e>=R_&&e<u2&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},dP=class extends Ba{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),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=dn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=dn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fP=1e3,pP=class{constructor(e,t=fP){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},h2=20,Kf=class extends ot{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new pP(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(Xe(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(cn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<h2+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===h2+1&&(this._liveRegion.textContent+=zv.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,i=n.lines.length.toString();for(let r=e;r<=t;r++){let o=n.lines.get(n.ydisp+r),c=[],d=o?.translateToString(!0,void 0,void 0,c)||"",p=(n.ydisp+r+1).toString(),f=this._rowElements[r];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let c,d;if(t===0?(c=n,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let r=({node:d,offset:p})=>{let f=d instanceof Text?d.parentNode:d,g=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(f);if(!v)return console.warn("columns is null. Race condition?"),null;let b=p<v.length?v[p]:v.slice(-1)[0]+1;return b>=this._terminal.cols&&(++g,b=0),{row:g,column:b}},o=r(t),c=r(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Kf=bn([Te(1,Pb),Te(2,Vr),Te(3,Yr)],Kf);var by=class extends ot{constructor(e,t,n,i,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(cn(()=>{To(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(Xe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Xe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Xe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Xe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let i=0;i<n.length;i++){let r=n[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let c=o?.map(d=>({link:d}));this._activeProviderReplies?.set(i,c),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let c=r[o],d=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=d;f<=p;f++){if(n.has(f)){r.splice(o--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(c=>this._linkAtPosition(c.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let c=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&mP(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,To(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,r){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:r}}};by=bn([Te(1,zb),Te(2,Yr),Te(3,Ri),Te(4,xT)],by);function mP(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 gP=class extends oP{constructor(e={}){super(e),this._linkifier=this._register(new Fl),this.browser=FT,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Fl),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(hP),this._instantiationService.setService(gh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rB),this._instantiationService.setService(xT,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Hv)),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(ci.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ci.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ci.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ci.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(cn(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let r=Qt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${pe.ESC}]${i};${tP(r)}${$T.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Dn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Dn.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(Kf,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 n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Xe(this.element,"copy",t=>{this.hasSelection()&&b7(t,this._selectionService)}));let e=t=>S7(t,this.textarea,this.coreService,this.optionsService);this._register(Xe(this.textarea,"paste",e)),this._register(Xe(this.element,"paste",e)),UT?this._register(Xe(this.element,"mousedown",t=>{t.button===2&&SC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Xe(this.element,"contextmenu",t=>{SC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Kb&&this._register(Xe(this.element,"auxclick",t=>{t.button===1&&pT(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Xe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Xe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Xe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Xe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Xe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Xe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Xe(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(Xe(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Pv.get()),qT||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(iB,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Vr,this._coreBrowserService),this._register(Xe(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(Xe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ly,this._document,this._helperContainer),this._instantiationService.setService(wp,this._charSizeService),this._themeService=this._instantiationService.createInstance(dy),this._instantiationService.setService(ec,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Wf),this._instantiationService.setService(wT,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(uy,this.rows,this.screenElement)),this._instantiationService.setService(Yr,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(ry,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(cy),this._instantiationService.setService(zb,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(by,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(iy,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(hy,this.element,this.screenElement,i)),this._instantiationService.setService(R7,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(ci.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(sy,this.screenElement)),this._register(Xe(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(Kf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(oy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let d,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,d=o.button<3?o.button:3;break;case"mousedown":p=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let f=o.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,d=4;break;default:return!1}return p===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Xe(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(Xe(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let c=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){fT(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=cP(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===pe.ETX||n.key===pe.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(_P(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(Mn));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),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function _P(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var vP=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},yP=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 Ms)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},d2=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 yP(t)}getNullCell(){return new Ms}},bP=class extends ot{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new d2(this._core.buffers.normal,"normal"),this._alternate=new d2(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)}},SP=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,i)=>t(n,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},wP=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}},xP=["cols","rows"],tr=0,CP=class extends ot{constructor(e){super(),this._core=this._register(new gP(e)),this._addonManager=this._register(new vP),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(xP.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 SP(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wP(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 bP(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
95
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Pv.get()},set promptLabel(e){Pv.set(e)},get tooMuchOutput(){return zv.get()},set tooMuchOutput(e){zv.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 kP(e){let t=!1,n=!1,i=!1,r=!1,o=null,c=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},p=()=>{c!==null&&(clearTimeout(c),c=null),n=!1},f=()=>{p(),n=!0,c=setTimeout(()=>{c=null,n=!1},0)},g=()=>{i=!1,o!==null&&clearTimeout(o),c!==null&&(clearTimeout(c),c=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},v=()=>{t=!1,o===null&&(p(),i=!1)},b=()=>{t=!1,r=!1,p(),d()},S=w=>{if(o===null){if(t||n||TP(w)){i=!0,n&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),i&&g()},onCompositionCancel:v,handleKeyEvent(w){return EP(w)&&w.shiftKey?(w.preventDefault?.(),w.type==="keydown"?(r=!0,S(w)):w.type==="keypress"?(r||S(w),r=!1):w.type==="keyup"&&(r=!1),!1):!0},dispose:b}}function EP(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function TP(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function AP({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,c=!1;const d=()=>{o=!1,c=!1},p=b=>{f2(b)&&(o=!0,c=!1)},f=()=>{o&&(c=!0)},g=b=>{const S=o&&c&&f2(b);if(d(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},v=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),n.addEventListener("mouseup",g),n.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),v.dispose(),t.removeEventListener("mousedown",p,!0),n.removeEventListener("mouseup",g),n.removeEventListener("blur",d))}}}function f2(e){return e.button===0}function RP(e,t){return{activate(n,i){try{const r=new URL(i);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const LP={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:RP((e,t,n)=>window.open(e,t,n),e=>window.confirm(`Do you want to navigate to ${e}?
|
|
96
|
-
|
|
97
|
-
WARNING: This link could potentially be dangerous`)),lineHeight:1},NP="Symbols Nerd Font Mono",Gd=`ui-monospace, "SF Mono", Menlo, "${NP}", monospace`,Vb=14,nA=10,iA=22,MP={min:nA,max:iA},OP="cascadia",eh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Gd}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Gd}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Gd}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Gd}`,meta:"Variable · Adobe mono"}],Bl=eh[0];function DP(e){return eh.find(t=>t.id===e)??Bl}function th(){return{source:"curated",id:OP,customName:"",family:Bl.family,size:Vb}}function Yb(e,t){const n=DP(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:Jb(t)}}function Xb(e,t){const n=BP(e);return{source:"custom",id:null,customName:n,family:Df(n,Bl.family),size:Jb(t)}}function sA(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=Jb(typeof t.size=="number"?t.size:Vb);return t.source==="custom"&&typeof t.customName=="string"?Xb(t.customName,n):typeof t.id=="string"&&IP(t.id)?Yb(t.id,n):null}function Zb(e){if(!e)return th();try{const t=sA(JSON.parse(e));if(t!==null)return t}catch{}return th()}function jP(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function Jb(e){return Number.isFinite(e)?Math.min(iA,Math.max(nA,Math.round(e))):Vb}function IP(e){return eh.some(t=>t.id===e)}function BP(e){return gp(e)}const Vf="fleet-plugin.terminal.renderer",Pl="fleet-plugin.terminal.font",p2="fleet-console.terminalRenderer",m2="fleet-console.terminalFont",Sy=new Set;let Pa=XP(),nh=null,xo=0;function PP(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Vf)!==null||window.localStorage.getItem(Pl)!==null)return;const e=window.localStorage.getItem(p2),t=window.localStorage.getItem(m2),n=e==="webgl"||e==="dom"?e:"webgl",i=Zb(t);window.localStorage.setItem(Vf,n),window.localStorage.setItem(Pl,jP(i)),window.localStorage.removeItem(p2),window.localStorage.removeItem(m2)}catch{}}function zP(e){xo+=1,nh=e,WP()}function rA(){return y.useSyncExternalStore(YP,g2,g2)}function $P(e){KP(e),Ul({renderer:e})}function HP(e){const t=Yb(e,Pa.font.size);xo+=1,Ul({font:t}),kp(t)}function FP(e){const t=Xb(e,Pa.font.size);xo+=1,Ul({font:t}),kp(t)}function UP(e){const t=Pa.font.source==="custom"?Xb(Pa.font.customName,e):Yb(Pa.font.id,e);xo+=1,Ul({font:t}),kp(t)}async function WP(){if(!nh)return;const e=xo;try{const t=await nh.read("terminal");if(t!==null){const n=sA(t.font);if(n!==null){if(e!==xo)return;Ul({font:n});try{window.localStorage.removeItem(Pl)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Pl)}catch{}if(n!==null){const i=Zb(n);if(e!==xo)return;Ul({font:i}),kp(i);try{window.localStorage.removeItem(Pl)}catch{}}}}catch{}}async function kp(e){if(nh)try{await nh.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function GP(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Vf);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function qP(){if(typeof window>"u")return th();try{return Zb(window.localStorage.getItem(Pl))}catch{return th()}}function KP(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Vf,e)}catch{}}function VP(){for(const e of Sy)e()}function Ul(e){Pa={...Pa,...e},VP()}function YP(e){return Sy.add(e),()=>{Sy.delete(e)}}function g2(){return Pa}function XP(){return typeof window>"u"?{renderer:"webgl",font:th()}:(PP(),{renderer:GP(),font:qP()})}function _2({baseY:e,viewportY:t}){return t>=e}function ZP(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:f,viewportY:g}=e.getViewport();n=Math.max(0,f-g)},o=()=>{if(n===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-n)))},c=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{i===null&&(i=e.requestFrame(()=>{i=null,c()}))},p=()=>{t&&(c(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=_2(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,p()},preserveAfterGeometryChange:f=>{f(),c(),d()},restoreAfterOutputParsing:()=>{if(t){p();return}_2(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function JP({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!QP(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function QP(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const e9="Symbols Nerd Font Mono",t9=`1em "${e9}"`,n9=650;let qd=null;function aA(){return qd||(qd=s9(),qd)}async function i9(){await r9(aA(),n9)}async function s9(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(t9)}catch{}}async function r9(e,t){await new Promise(n=>{let i=!1;const r=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(r),n())}})}const a9=80,o9=16,l9=250,c9=1024*1024,u9=120,h9={background:"oklch(16.5% 0.016 245)",foreground:"oklch(94% 0.008 90)",cursor:"oklch(77% 0.085 200)",selectionBackground:"oklch(80% 0.085 78 / 13%)",black:"oklch(13% 0.014 245)",brightBlack:"oklch(29% 0.018 245)",red:"oklch(68% 0.13 25)",green:"oklch(76% 0.11 160)",yellow:"oklch(75% 0.08 90)",blue:"oklch(77% 0.085 200)",magenta:"oklch(70% 0.012 245)",cyan:"oklch(77% 0.085 200)",white:"oklch(94% 0.008 90)",brightRed:"oklch(68% 0.13 25)",brightGreen:"oklch(76% 0.11 160)",brightYellow:"oklch(80% 0.085 78)",brightBlue:"oklch(77% 0.085 200)",brightMagenta:"oklch(70% 0.012 245)",brightCyan:"oklch(77% 0.085 200)",brightWhite:"oklch(94% 0.008 90)"},d9={background:"oklch(23% 0.03 248)",foreground:"oklch(86% 0.018 90)",cursor:"oklch(82% 0.13 195)",selectionBackground:"oklch(78% 0.13 75 / 28%)",black:"oklch(18% 0.045 248)",brightBlack:"oklch(48% 0.03 248)",red:"oklch(72% 0.17 25)",green:"oklch(82% 0.13 195)",yellow:"oklch(86% 0.16 78)",blue:"oklch(70% 0.08 248)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(82% 0.13 195)",white:"oklch(82% 0.018 90)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(88% 0.14 195)",brightYellow:"oklch(90% 0.16 78)",brightBlue:"oklch(78% 0.09 248)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(88% 0.14 195)",brightWhite:"oklch(96% 0.012 88)"},f9={background:"oklch(19% 0.008 252)",foreground:"oklch(85% 0.005 250)",cursor:"oklch(80% 0.105 205)",selectionBackground:"oklch(76% 0.115 62 / 28%)",black:"oklch(16% 0.008 252)",brightBlack:"oklch(46% 0.006 250)",red:"oklch(72% 0.17 25)",green:"oklch(80% 0.11 205)",yellow:"oklch(84% 0.14 64)",blue:"oklch(68% 0.05 250)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(80% 0.11 205)",white:"oklch(81% 0.005 250)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(86% 0.13 205)",brightYellow:"oklch(88% 0.15 66)",brightBlue:"oklch(74% 0.06 250)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(86% 0.13 205)",brightWhite:"oklch(95% 0.003 250)"};function Qb({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,zoom:c=1}){const d=i,{renderer:p,font:f}=rA(),g=y.useRef(null),v=y.useRef(null),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(null),E=y.useRef(null),[A,L]=y.useState(c),I=y.useRef(r);I.current=r;const R=y.useRef(o);R.current=o;const[z,O]=y.useState("connecting"),[H,F]=y.useState(0);y.useEffect(()=>{const V=g.current;if(!V)return;let $=!1,N=null,D=null,T=null;return(async()=>{if(await i9(),$)return;const j=v2(d),B=new CP({...LP,fontFamily:f.family,fontSize:f.size*A,theme:j});v.current=B;const q=new oj;E.current=q,B.loadAddon(q),B.open(V),y2(V,j);const J=AP({terminal:B,selectionTarget:V,windowTarget:window,clipboard:navigator.clipboard});B.loadAddon(new Dj),B.unicode.activeVersion="11";const P=kP(()=>B.input(`
|
|
98
|
-
`)),X=V.querySelector("textarea.xterm-helper-textarea, textarea")??V;X.addEventListener("compositionstart",P.onCompositionStart),X.addEventListener("compositionend",P.onCompositionEnd),X.addEventListener("focusout",P.onCompositionCancel);const Q=JP({getPlatform:()=>navigator.platform,getSelection:()=>B.getSelection(),writeText:je=>navigator.clipboard.writeText(je)});B.attachCustomKeyEventHandler(je=>Q.handleKeyEvent(je)&&P.handleKeyEvent(je));const Y=ZP({getViewport:()=>B.buffer.active,scrollToBottom:()=>p9(B),scrollToLine:je=>m9(B,je),requestFrame:je=>window.requestAnimationFrame(je),cancelFrame:je=>window.cancelAnimationFrame(je)});x.current=Y;const ie=g9(V,X,Y.recordUserViewportChange),me=y9(B,R.current!==!1,Y.restoreAfterOutputParsing);w.current=me;const ye=ej({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:je=>B.onData(Ae=>{Y.resumeFollowing(),je(Ae)}),write:me.write},onExit:()=>I.current?.(),onStatus:(je,Ae)=>{O(Ae?`${je}: ${Ae}`:je)}});b.current=ye;const ke=()=>{Y.preserveAfterGeometryChange(()=>{q.fit(),ye.resize(B.cols,B.rows),B.refresh(0,B.rows-1)})},Le=()=>{D&&clearTimeout(D),D=setTimeout(()=>{D=null,$||ke()},a9)},ct=async()=>{await document.fonts?.ready,!$&&(ke(),ye.start(),R.current!==!1&&B.focus())};N=new ResizeObserver(Le),N.observe(V),ct(),T=()=>{D&&clearTimeout(D),X.removeEventListener("compositionstart",P.onCompositionStart),X.removeEventListener("compositionend",P.onCompositionEnd),X.removeEventListener("focusout",P.onCompositionCancel),P.dispose(),ye.dispose(),J.dispose(),ie.dispose(),me.dispose(),Y.dispose(),v.current=null,b.current=null,w.current=null,x.current=null,E.current=null;try{B.dispose()}catch{}},F(je=>je+1)})(),()=>{$=!0,N?.disconnect(),T?.()}},[e,t,n]),y.useEffect(()=>{w.current?.setActive(o!==!1),o&&(v.current?.focus(),x.current?.resumeFollowing())},[o]),y.useEffect(()=>{const V=v.current;if(!V)return;let $=!1;if(p==="webgl")try{const N=new m7;S.current=N,N.onContextLoss(()=>{if(!$){try{N.dispose()}catch{}S.current===N&&(S.current=null)}}),V.loadAddon(N)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{$=!0;const N=S.current;if(N){S.current=null;try{N.dispose()}catch{}}}},[p,e,H]),y.useEffect(()=>{const V=v.current,$=g.current;if(!V||!$)return;const N=v2(d);V.options.theme=N,y2($,N)},[d,H]),y.useEffect(()=>{const V=v.current;V&&(V.options.fontFamily=f.family,b2(V,E.current,b.current,x.current))},[f.family,H]),y.useEffect(()=>{if(c===A)return;const V=setTimeout(()=>L(c),u9);return()=>clearTimeout(V)},[c,A]),y.useEffect(()=>{const V=v.current;V&&(V.options.fontSize=f.size*A,b2(V,E.current,b.current,x.current))},[A,f.size,H]);const ae=z.startsWith("live"),fe=A===1?void 0:{width:`${A*100}%`,height:`${A*100}%`,transform:`scale(${1/A})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[ae?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),z]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:g,style:fe})})]})})}function v2(e){return e==="carbon"?f9:e==="maritime"?d9:h9}function y2(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function p9(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function m9(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function g9(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const c=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},d=()=>c(),p=()=>{r=!0},f=S=>{r=_9(S,i)},g=()=>{r&&c()},v=()=>{const S=r;r=!1,S&&c()},b=S=>{v9(S)&&c()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",p,{capture:!0,passive:!0}),i.addEventListener("touchend",v),i.addEventListener("touchcancel",v),i.addEventListener("pointerdown",f,!0),i.addEventListener("scroll",g),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",p,!0),i.removeEventListener("touchend",v),i.removeEventListener("touchcancel",v),i.removeEventListener("pointerdown",f,!0),i.removeEventListener("scroll",g),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function _9(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function v9(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function y9(e,t,n){let i=t,r=!1,o=null,c=0,d=[];const p=()=>{o&&(clearTimeout(o),o=null)},f=()=>{if(p(),r||c===0)return;const v=b9(d,c);d=[],c=0,e.write(v,()=>{r||n()})},g=()=>{r||o||c===0||(o=setTimeout(f,i?o9:l9))};return{write:v=>{if(!(r||v.byteLength===0)){if(d.push(v),c+=v.byteLength,c>=c9){f();return}g()}},setActive:v=>{if(i!==v){if(i=v,p(),i){f();return}g()}},dispose:()=>{f(),r=!0,d=[],c=0,p()}}}function b9(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.byteLength;return n}function b2(e,t,n,i){const r=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(r);return}r()}const S9=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class Vs extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function oA(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new Vs(t.status,"Invalid agent state response");return n.agentClis.map(i=>L9(i,t.status))}async function w9(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.clis))throw new Vs(t.status,"Invalid Agent CLI state response");return n}async function x9(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Vs(t.status,"Invalid tenants response");return n.tenants.map(i=>N9(i,t.status))}async function C9(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Vs(t.status,"Invalid jobs response");return n.tenants}async function k9(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new Vs(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Ep(i,t.status))}async function E9(e){const t=await fetch("/api/v1/operations",{signal:e});await Xr(t);const n=await t.json();if(!Array.isArray(n.operations))throw new Vs(t.status,"Invalid operations response");return{operations:n.operations.map(i=>M9(i,t.status))}}async function T9(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await Xr(i),Ep(await i.json(),i.status)}async function A9(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Xr(n),Ep(await n.json(),n.status)}async function R9(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Xr(n)}function Ep(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||wy(n))throw new Vs(t,"Invalid agent session response");return{sessionId:n.sessionId,terminalSessionId:typeof n.terminalSessionId=="string"?n.terminalSessionId:n.sessionId,cwdLabel:n.cwdLabel,label:typeof n.label=="string"?n.label:void 0,cliId:typeof n.cliId=="string"?n.cliId:void 0,cliLabel:typeof n.cliLabel=="string"?n.cliLabel:void 0,status:n.status,turnState:n.turnState==="running"||n.turnState==="ended"?n.turnState:"none",createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function Xr(e){if(!e.ok)throw new Vs(e.status,`Agent plugin request failed: ${e.status}`)}function L9(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new Vs(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function N9(e,t){const n=e;if(!n||typeof n.tenantId!="string"||typeof n.tenantLabel!="string"||typeof n.createdAt!="number"||typeof n.sessions!="number")throw new Vs(t,"Invalid tenant response");return n}function M9(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||wy(n)||wy(n.payload))throw new Vs(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,ts:n.ts}}function wy(e){return xy(e,new Set(S9))}function xy(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>xy(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||xy(i,t))}const O9="active",Cy=new Set(["done","error","aborted"]);function D9(e,t){let n=ky(e,t.jobId,t.updatedAt);for(const i of t.events)n=lA(n,i);return Cy.has(t.status)&&!Cy.has(n.status)&&(n={...n,status:t.status}),n}function lA(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:B9(e.recentEvents,t)};switch(t.type){case"job:registered":return j9(i,n);case"job:finalized":return{...i,status:_n(n.status)??"done",finishedAt:La(n.finishedAt)??t.at,summary:_n(n.summary),error:_n(n.error)};case"track:begin":return vl(i,n,t.id,r=>({...r,startedAt:La(n.startedAt)??t.at,requestPreview:_n(n.requestPreview)}));case"track:status":return vl(i,n,t.id,r=>({...r,status:_n(n.status)??r.status}));case"track:text":return vl(i,n,t.id,r=>{const o=r.text+(_n(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(La(n.textLength)??_n(n.text)?.length??0),latestLine:P9(o)||r.latestLine}});case"track:thought":return vl(i,n,t.id,r=>{const o=r.thought+(_n(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(La(n.textLength)??_n(n.text)?.length??0)}});case"track:tool":return vl(i,n,t.id,r=>({...r,status:"stream",tools:I9(r.tools,n)}));case"track:finalized":return vl(i,n,t.id,r=>{const o=S2(r.text,r.sentTextLength,_n(n.fallbackText),La(n.fallbackTextLength)),c=S2(r.thought,r.sentThoughtLength,_n(n.fallbackThought),La(n.fallbackThoughtLength));return{...r,status:_n(n.status)??"done",finishedAt:La(n.finishedAt)??t.at,error:_n(n.error),text:o.text,sentTextLength:o.sentLength,thought:c.text,sentThoughtLength:c.sentLength}});default:return i}}function ky(e,t,n){return{jobId:t,tenantId:e,status:O9,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Wl(e){return Cy.has(e)}function j9(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,r=e.tracks;for(const o of n){if(!o.trackId)continue;const c=r[o.trackId],d={...c??cA(o.trackId),displayName:o.displayName??c?.displayName??o.trackId,displayCli:o.displayCli??c?.displayCli,model:o.model??c?.model,effort:o.effort??c?.effort,subtitle:o.subtitle??c?.subtitle,kind:o.kind??c?.kind,startedAt:o.startedAt??c?.startedAt};c||(i=[...i,o.trackId]),r={...r,[o.trackId]:d}}return{...e,label:_n(t.label)??e.label,ownerCarrierId:_n(t.ownerCarrierId)??e.ownerCarrierId,kind:_n(t.kind)??e.kind,signatureCli:_n(t.signatureCli)??e.signatureCli,startedAt:La(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function vl(e,t,n,i){const r=_n(t.trackId);if(!r)return e;const o=e.tracks[r],c={...i(o??cA(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:c}}}function cA(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function I9(e,t){const n=_n(t.toolId)??_n(t.id);if(!n)return e;const i={id:n,name:_n(t.name),input:t.input,output:t.output,status:_n(t.status)},r=e.findIndex(o=>o.id===n);return r>=0?[...e.slice(0,r),{...e[r],...i},...e.slice(r+1)]:[...e,i]}function S2(e,t,n,i){return n?t>=(i??n.length)?{text:e,sentLength:t}:{text:n,sentLength:i??n.length}:{text:e,sentLength:t}}function B9(e,t){return[...e,t].slice(-120)}function P9(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
99
|
-
`);return n[n.length-1]?.trim()??""}function _n(e){return typeof e=="string"?e:void 0}function La(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const z9=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function $9(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
|
|
100
|
-
|
|
101
|
-
`);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=F9(r);o&&n.push(o),i=e.indexOf(`
|
|
102
|
-
|
|
103
|
-
`)}return n}}function H9(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const i=t.tenant?.tenantId;return!i||!t.truncation?null:{kind:"truncation",tenantId:i,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const i=x2(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=x2(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:U9(t.reason)}:null}const n=w2(t.event)??w2(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function F9(e){const t=e.split(`
|
|
104
|
-
`),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
105
|
-
`);return!i&&n==="message"?null:{event:n,data:i}}function w2(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 x2(e){try{return Ep(e,200)}catch{return null}}function U9(e){return typeof e=="string"&&z9.has(e)?e:void 0}const e0={droppedCount:0},Ey=new Set;let tn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function W9(){return SE(G9,uA)}function uA(){return tn}function G9(e){return Ey.add(e),()=>{Ey.delete(e)}}function us(e){tn={...tn,...e},Z9()}function hA(e){us({agentClis:e})}function q9(e){const t={};for(const n of e)t[n.sessionId]=n;us({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function Yf(e){const t=!!tn.sessions[e.sessionId];us({sessions:{...tn.sessions,[e.sessionId]:e},sessionOrder:t?tn.sessionOrder:[e.sessionId,...tn.sessionOrder],turnState:{...tn.turnState,[e.sessionId]:e.turnState}})}function dA(e){const{[e]:t,...n}=tn.sessions,{[e]:i,...r}=tn.turnState;us({sessions:n,sessionOrder:tn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:tn.activeTerminalSessionId===e?null:tn.activeTerminalSessionId,turnState:r})}function fA(e){us({activeTerminalSessionId:e})}function K9(e){us({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...tn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&tn.tenantJobs[t])]})}function V9(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=D9(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??e0}}us({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...tn.tenantOrder.filter(n=>t[n])]})}function Y9(e,t){const n=e.tenantId,i=e.jobId??J9(e),r=tn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:e0},o=i?r.jobs[i]??ky(n,i,e.at):ky(n,"__unknown__",e.at),c=lA(o,e),d=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,p={...r,tenantLabel:t??r.tenantLabel,jobOrder:d,jobs:i?{...r.jobs,[i]:c}:r.jobs};return us({tenantJobs:{...tn.tenantJobs,[n]:p},tenantOrder:tn.tenantOrder.includes(n)?tn.tenantOrder:[n,...tn.tenantOrder]}),{job:c,unknownTenant:!tn.tenantJobs[n]}}function X9(e,t,n){const i=tn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:e0};us({tenantJobs:{...tn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function pA(e){const t=e.tenantId;if(!t)return[];const n=tn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function Z9(){for(const e of Ey)e()}function J9(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const C2=250,Q9=5e3,Ty=new Map;function ez(e){const t=new AbortController;return tz(t.signal,e),()=>t.abort()}async function tz(e,t){let n=C2;for(;!e.aborted;){us({connection:"connecting"});try{await rz(e,t);const i=await fetch("/plugins/terminal/agent/events",{signal:e});if(!i.ok||!i.body)throw new Error(`Agent stream failed: ${i.status}`);us({connection:"live",connectionError:null}),n=C2,await nz(i.body.getReader(),e,t),e.aborted||us({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;us({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await oz(n,e),n=Math.min(n*2,Q9)}}async function nz(e,t,n){const i=new TextDecoder,r=$9();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const c of r(i.decode(o.value,{stream:!0}))){const d=H9(c);if(d){if(d.kind==="truncation"&&d.truncation){X9(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){Yf(d.session),Xf(n,d.session.sessionId,t0(d.session));continue}if(d.kind==="attention"&&d.session){Yf(d.session),d.reason!=="idle_prompt"&&Xf(n,d.session.sessionId,"awaiting");continue}d.event&&(Y9(d.event,d.tenantLabel),sz(n,d.event.tenantId))}}}}function t0(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&iz(e)?"running":"idle"}function iz(e){return pA(e).some(t=>!Wl(t.status))}function Xf(e,t,n){const i=Ty.get(t);e.status.set(t,n),Ty.set(t,n),i!==n&&(n==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):n==="idle"&&(i==="running"||i==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function sz(e,t){const{sessions:n}=uA();for(const i of Object.values(n))i.tenantId===t&&Ty.get(i.sessionId)!=="awaiting"&&Xf(e,i.sessionId,t0(i))}async function rz(e,t){const[n,i,r,o,c]=await Promise.all([oA(e),k9(e),x9(e),C9(e),E9(e)]);hA(n),q9(i),K9(r),V9(o);for(const d of i)Xf(t,d.sessionId,t0(d));az(c.operations,t)}function az(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function oz(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const lz=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function cz(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return`${n}m ${i}s`}function uz(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function hz(e){return e.trackOrder.reduce((t,n)=>{const i=e.tracks[n];return i?t+Math.round((i.sentTextLength+i.sentThoughtLength)/4):t},0)}function mA(e){if(e)return lz.has(e)?e:void 0}function dz(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function Tp(e){return e==="err"||e==="error"}function ih(e,t){return!Wl(e)&&dz(t)}function n0(e,t){return Tp(e)?"error":e==="done"||e==="aborted"?e:Wl(t)?t:e}function fz(e,t){const n=new Set(e),i=t.filter(r=>n.has(r)?!1:(n.add(r),!0));return i.length===0?e:[...e,...i]}function pz(e,t,n){const i=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)i.get(o)?.expiresAt!==n&&(i.set(o,{jobId:o,expiresAt:n}),r=!0);return r?[...i.values()]:e}function mz(e,t,n){const i=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>n&&i.has(o.jobId));return r.length===e.length?e:r}function gA(e,t){const n=new Map(e.map(i=>[i.jobId,i]));return t.flatMap(i=>{const r=n.get(i);return r?[r]:[]})}function gz(e){const t=e.flatMap(r=>r.trackOrder.map(o=>({job:r,track:r.tracks[o]}))).filter(r=>!!r.track).sort((r,o)=>o.track.lastEventId-r.track.lastEventId),n=t.filter(({job:r,track:o})=>ih(r.status,o.status)),i=n.length>0?n:t;for(const{job:r,track:o}of i){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(ih(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function _z(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=gA(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class Ap extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function vz(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await i0(t),vA(await t.json(),t.status)}async function yz(e,t,n){const i=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t}),signal:n});return await i0(i),_A(await i.json(),i.status)}async function bz(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await i0(n),_A(await n.json(),n.status)}async function i0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Ap(e.status,t)}function _A(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Ap(t,"Invalid model auth mutation response");return{state:vA(n.state,t)}}function vA(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Ap(t,"Invalid model auth state response");return{providers:n.providers.map(i=>Sz(i,t))}}function Sz(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Ap(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const Ay=new Set;let Ry={loading:!1,state:null,busyCli:null,error:null},Ur=0;function wz(){return y.useSyncExternalStore(xz,k2,k2)}function k2(){return Ry}function xz(e){return Ay.add(e),()=>Ay.delete(e)}async function Cz(e){const t=++Ur;Wr({loading:!0,error:null});try{const n=await vz(e);if(t!==Ur)return;Wr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Ur)return;Wr({loading:!1,error:s0(n)})}}async function kz(e,t){const n=++Ur;Wr({busyCli:e,error:null});try{const i=await yz(e,t);return n!==Ur||(Wr({state:i.state,busyCli:null,error:null}),await yA()),!0}catch(i){return n!==Ur||Wr({busyCli:null,error:s0(i)}),!1}}async function Ez(e){const t=++Ur;Wr({busyCli:e,error:null});try{const n=await bz(e);return t!==Ur||(Wr({state:n.state,busyCli:null,error:null}),await yA()),!0}catch(n){return t!==Ur||Wr({busyCli:null,error:s0(n)}),!1}}async function yA(){try{hA(await oA())}catch{}}function Wr(e){Ry={...Ry,...e};for(const t of Ay)t()}function s0(e){return e instanceof Error?e.message:String(e)}class bA extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function Tz(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await SA(t),wA(await t.json(),t.status)}async function Az(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await SA(n),wA(await n.json(),n.status)}async function SA(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new bA(e.status,t)}function wA(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new bA(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode}}const Ly=new Set;let Zf={loading:!1,state:null,savingField:null,error:null},xf=0;function xA(){return y.useSyncExternalStore(Rz,E2,E2)}function E2(){return Zf}function Rz(e){return Ly.add(e),()=>{Ly.delete(e)}}async function Lz(e){const t=++xf;zl({loading:!0,error:null});try{const n=await Tz(e);if(t!==xf)return;zl({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==xf)return;zl({loading:!1,error:kA(n)})}}async function CA(e,t){const n=Zf.state;if(!n)return!1;xf+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:{codexLaunchMode:i.codexLaunchMode};zl({state:i,savingField:e,error:null});try{const o=await Az(r);return zl({state:o,savingField:null,error:null}),!0}catch(o){return zl({state:n,savingField:null,error:kA(o)}),!1}}function zl(e){Zf={...Zf,...e};for(const t of Ly)t()}function kA(e){return e instanceof Error?e.message:String(e)}const Nz=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],Mz="/plugins/terminal/agent/ticket",Oz="/plugins/terminal/ws",L_="fleet-plugin.terminal.stream-dock-expanded",Dz="fleet-plugin.terminal.stream-dock-collapsed",jz=56,Iz=4e3,Bz={...MP,step:1,defaultValue:14},Pz="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",EA={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Ru(e.payload,"cliLabel")??void 0,render:e=>u.jsx(Uz,{context:e})},TA={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(qz,{})},AA={id:"agent.attention",title:"Agent input waiting"},zz={id:"agent.ended",title:"Agent turn ended"},Kd={id:"terminal",operationKinds:[EA],settingsSections:[TA],notificationKinds:[AA,zz],install:e=>$z(e),closeOperation:async e=>{try{await R9(e)}finally{dA(e)}},launch:async({theaterId:e,kind:t})=>{const n=await T9(e,t.id);return Yf(n),fA(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude"||e.id==="claude-kimi"?u.jsx(c$,{}):e.id==="codex"?u.jsx(u$,{}):u.jsx(l$,{})};function $z(e){return ez({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function RA(e,t){const n=y.useRef(null),i=y.useRef(!0),[r,o]=y.useState(!0),c=y.useCallback(p=>{i.current!==p&&(i.current=p,o(p))},[]);y.useEffect(()=>{const p=n.current;if(!p)return;const f=()=>{const g=p.scrollHeight-p.scrollTop-p.clientHeight;c(g<=jz)};return p.addEventListener("scroll",f,{passive:!0}),()=>p.removeEventListener("scroll",f)},[e,c]),y.useLayoutEffect(()=>{c(!0);const p=n.current;p&&(p.scrollTop=p.scrollHeight)},[e,c]),y.useLayoutEffect(()=>{const p=n.current;!p||!i.current||(p.scrollTop=p.scrollHeight)},[t]);const d=y.useCallback(()=>{const p=n.current;p&&(p.scrollTop=p.scrollHeight,p.focus({preventScroll:!0}),c(!0))},[c]);return{containerRef:n,pinned:r,jumpToLatest:d}}function Hz(){const[e,t]=y.useState(()=>{try{return localStorage.removeItem(Dz),localStorage.getItem(L_)==="true"}catch{return!1}}),n=y.useCallback(i=>{try{i?localStorage.setItem(L_,"true"):localStorage.removeItem(L_)}catch{}t(i)},[]);return[e,n]}function Fz(e,t){const[n,i]=y.useState(Date.now);return y.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":cz((t??n)-e)}function Uz({context:e}){const n=W9().sessions[e.operationId]??t$(e),[i,r]=y.useState(!1),[o,c]=y.useState([]),[d,p]=y.useState([]),f=y.useRef(null),g=y.useRef(null),v=y.useRef(null),b=y.useRef(new Set),S=pA(n),w=S.filter(O=>!Wl(O.status)),x=_z(w,S,d),E=gA(S,o),A=String(i),L=E.map(O=>`${O.jobId}:${O.lastEventId}`).join(","),I=RA(A,L);y.useLayoutEffect(()=>{const O=b.current,H=S.filter(F=>O.has(F.jobId)&&Wl(F.status)).map(F=>F.jobId);b.current=new Set(w.map(F=>F.jobId)),H.length!==0&&p(F=>pz(F,H,Date.now()+Iz))},[w,S]),y.useEffect(()=>{if(d.length===0)return;const O=Math.min(...d.map(F=>F.expiresAt)),H=window.setTimeout(()=>{p(F=>mz(F,S,Date.now()))},Math.max(0,O-Date.now()));return()=>window.clearTimeout(H)},[S,d]),y.useEffect(()=>{i&&c(O=>fz(O,w.map(H=>H.jobId)))},[w,i]);const R=y.useCallback(()=>{r(!1),c([]),v.current?.focus()},[]),z=y.useCallback(()=>{c(x.map(O=>O.jobId)),r(!0)},[x]);return y.useLayoutEffect(()=>{i&&f.current?.focus()},[i]),y.useEffect(()=>{if(!i)return;const O=H=>{if(H.key==="Escape"){H.stopPropagation(),R();return}if(H.key==="Tab"){const F=g.current;if(!F)return;const ae=Array.from(F.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter($=>!$.hasAttribute("disabled")),fe=ae[0],V=ae[ae.length-1];H.shiftKey&&document.activeElement===fe?(H.preventDefault(),V?.focus()):!H.shiftKey&&document.activeElement===V&&(H.preventDefault(),fe?.focus())}};return document.addEventListener("keydown",O,!0),()=>document.removeEventListener("keydown",O,!0)},[i,R]),n.status==="dormant"?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{e$(n.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(Qb,{operationId:n.sessionId,ticketPath:Mz,wsPath:Oz,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>dA(n.sessionId)}),x.length>0?u.jsx(Wz,{activeJobs:x,onOpenDetail:z,detailBtnRef:v}):null,i?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:R}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:R,children:"×"}),u.jsx("div",{ref:I.containerRef,className:"job-overlay-body",tabIndex:-1,children:E.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):E.map(O=>u.jsx(Jz,{job:O},O.jobId))}),I.pinned?null:u.jsx("button",{type:"button",className:"follow-button",onClick:I.jumpToLatest,children:"↓ Follow"})]})]}):null]})}function Wz({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=Hz(),o=e[0],c=Fz(o?.startedAt,o?.finishedAt),d=e.reduce((O,H)=>O+hz(H),0),p=uz(d),f=e.length===1&&o?mA(o.ownerCarrierId):void 0,g=e.length===1&&o?o.label:void 0,v=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",b=gz(e),S=e.map(O=>`${O.jobId}:${O.lastEventId}`).join(","),w=`${i}:${e.map(O=>O.jobId).join(",")}`,{containerRef:x,pinned:E,jumpToLatest:A}=RA(w,S),L=e.some(O=>O.trackOrder.some(H=>{const F=O.tracks[H];return F?ih(O.status,F.status):!1})),I=e.some(O=>!Wl(O.status)),R=e.some(O=>O.status==="error"||O.trackOrder.some(H=>Tp(O.tracks[H]?.status??""))),z=I?"job-dock-dot":R?"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:z,"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:i?{display:"none"}:void 0,"aria-hidden":"true",children:[b.thinking?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):b.text,!i&&L&&b.text?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"job-dock-meta",children:[c?u.jsx("span",{children:c}):null,p?u.jsx("span",{children:p}):null]}),u.jsx("button",{type:"button",className:"job-dock-grip","aria-label":i?"Collapse stream dock":"Expand stream dock","aria-expanded":i,onClick:()=>r(!i),children:i?"▼":"▲"}),u.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:x,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(O=>{const H=e.length>1,F=!H&&O.trackOrder.length===1;return O.trackOrder.map(ae=>{const fe=O.tracks[ae];return fe?u.jsx(Gz,{track:fe,job:O,multiJob:H,singleTrack:F},`${O.jobId}:${ae}`):null})})]}),E?null:u.jsx("button",{type:"button",className:"follow-button",onClick:A,children:"↓ Follow"})]})]})}function Gz({track:e,job:t,multiJob:n,singleTrack:i}){const r=ih(t.status,e.status),c=i$(e.text),d=!c&&r&&!!e.thought,p=r?n$(e):void 0,f=n0(e.status,t.status),g=n||!i,v=n?mA(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":""}${Tp(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 qz(){const[e,t]=y.useState([]),[n,i]=y.useState(null),{renderer:r,font:o}=rA(),c=xA();return y.useEffect(()=>{const d=new AbortController;return w9(d.signal).then(p=>t(p.clis)).catch(p=>{d.signal.aborted||i(p instanceof Error?p.message:String(p))}),()=>d.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsx(Yz,{}),u.jsx(Kz,{}),u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),n?u.jsx("p",{className:"settings-error",children:n}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(d=>u.jsx(Zz,{cli:d,codexLaunchMode:c.state?.codexLaunchMode,disabled:c.savingField!==null,onCodexLaunchModeChange:p=>{CA("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(s$,{terminalFont:o}),u.jsx(r$,{terminalRenderer:r})]})}function Kz(){const e=wz();return y.useEffect(()=>{const t=new AbortController;return Cz(t.signal),()=>t.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[u.jsxs("div",{className:"model-auth-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Kimi Sign-in"}),u.jsx("p",{className:"global-settings-help",children:"Register a Kimi API key to run carriers and terminal sessions through Claude Code against the Kimi endpoint. The key is validated and stored locally, and is never returned to the browser."})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(t=>u.jsx(Vz,{provider:t,busy:e.busyCli===t.cli},t.cli)),u.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function Vz({provider:e,busy:t}){const[n,i]=y.useState(""),r=async()=>{await kz(e.cli,n)&&i("")};return u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"model-auth-row-head",children:[u.jsx("span",{className:"model-auth-name",children:e.displayName}),u.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?u.jsx("div",{className:"model-auth-actions",children:u.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{Ez(e.cli)},children:t?"Working…":"Sign out"})}):u.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[u.jsx("input",{type:"password",className:"model-auth-input",placeholder:"API key",value:n,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":`${e.displayName} API key`,onChange:o=>i(o.target.value)}),u.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function Yz(){const e=xA(),t=e.state,n=e.savingField!==null;return y.useEffect(()=>{const i=new AbortController;return Lz(i.signal),()=>i.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsx(u.Fragment,{children:u.jsx(Xz,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:n,onToggle:()=>{CA("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 Xz({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:c}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:c,children:u.jsx("span",{children:r?n:i})})]})}function Zz({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?u.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[u.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),u.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:n,onClick:()=>i("app-server"),children:"App Server"})]}):null,e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function Jz({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?u.jsx(Qz,{track:n,jobStatus:e.status},n.trackId):null})})]})}function Qz({track:e,jobStatus:t}){const n=o$(e.status,t),i=n==="track-card--live",r=n0(e.status,t);return u.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[u.jsxs("header",{className:"track-card-head",children:[u.jsx("span",{className:"track-card-title",children:e.displayName}),u.jsx("span",{className:"track-card-status",children:r})]}),e.thought?u.jsxs("details",{className:"track-card-thinking",children:[u.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),u.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:u.jsx("pre",{children:e.thought})})]}):null,e.text?u.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[u.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),u.jsxs("pre",{children:[e.text,i?u.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?u.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?u.jsx("ul",{className:"track-card-tools",children:e.tools.map(o=>u.jsx("li",{children:o.name??o.id},o.id))}):null]})}async function e$(e){Yf(await A9(e)),fA(e)}function t$(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Ru(e.operation.payload,"cliId")??void 0,cliLabel:Ru(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Ru(e.operation.payload,"tenantId")??void 0,registrationId:Ru(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Ru(e,t){const n=e[t];return typeof n=="string"?n:null}function n$(e){const t=e.tools.find(n=>n.status!=="completed"&&n.status!=="failed"&&n.status!=="error");return t?t.name??t.id:void 0}function i$(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
106
|
-
`);return n[n.length-1]?.trim()??""}function s$({terminalFont:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!0),[o,c]=y.useState(null),d=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Bl.id:Bl.id}:{source:"system",familyName:e.customName};y.useEffect(()=>{const f=new AbortController;return r(!0),c(null),R5({signal:f.signal}).then(g=>{f.signal.aborted||n(g.fonts.filter(v=>v.monospace).map(v=>({family:v.family,monospace:v.monospace})))}).catch(g=>{f.signal.aborted||a$(g)||(n([]),c("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||r(!1)}),()=>f.abort()},[]);const p=f=>{if(f.source==="system"){FP(f.familyName);return}const g=eh.find(v=>v.id===f.id);g&&HP(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(T5,{builtIns:eh.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:Bl.family,previewText:Pz,size:e.size,sizeRange:Bz,loading:i,error:o,onSelectionChange:p,onSizeCommit:UP})}),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 r$({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:Nz.map(t=>{const n=t.id===e;return u.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>$P(t.id),children:t.label},t.id)})})]})})}function a$(e){return e instanceof DOMException&&e.name==="AbortError"}function o$(e,t){if(ih(t,e))return"track-card--live";const n=n0(e,t);return Tp(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function l$(){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 c$(){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 u$(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}class ur extends Error{constructor(t,n){super(n),this.status=t}status}const h$=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function LA(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await a0(t),NA(await t.json(),t.status)}async function d$(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await a0(t),m$(await t.json(),t.status)}async function N_(e,t,n){return r0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function f$(e,t,n,i){return r0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function p$(e,t,n){return r0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function r0(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await a0(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new ur(r.status,"Invalid carrier settings mutation response");return{state:NA(o.state,r.status)}}async function a0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new ur(e.status,t)}function NA(e,t){MA(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new ur(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>g$(i,t))}}function m$(e,t){MA(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new ur(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>_$(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function g$(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceBackendCount!="number"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new ur(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceBackendCount:n.taskForceBackendCount,taskforce:{backends:n.taskforce.backends.map(i=>y$(i,t))}}}function _$(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new ur(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>v$(i,t)),defaultModel:n.defaultModel}}function v$(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new ur(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new ur(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function y$(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new ur(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function MA(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[r,o]of Object.entries(i)){if(h$.has(r))throw new ur(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const b$={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Ny=new Set;let ui={loading:!1,state:null,options:null,activeCarrierId:null,draft:b$,savingActionId:null,error:null};function OA(){return y.useSyncExternalStore(S$,T2,T2)}function T2(){return ui}function S$(e){return Ny.add(e),()=>{Ny.delete(e)}}async function M_(e){ar({loading:!0,error:null});try{const[t,n]=await Promise.all([LA(e),d$(e)]);DA(t,n)}catch(t){if(e?.aborted)return;ar({loading:!1,error:IA(t)})}}function w$(e){const t=ui.state?.carriers.find(n=>n.carrierId===e);ar({activeCarrierId:e,draft:t?o0(t,ui.options):ui.draft,error:null})}function Nl(e){ar({draft:{...ui.draft,...e},error:null})}function My(e,t){const n=ui.draft.taskforce[e]??{model:"",effort:""};ar({draft:{...ui.draft,taskforce:{...ui.draft.taskforce,[e]:{...n,...t}}},error:null})}function x$(){const e=jA();e&&ar({draft:o0(e,ui.options),error:null})}async function C$(e){const t=jA();return t?k$("save-all",async()=>{const n=ui.draft;let i=null;n.displayName!==t.displayName&&(i=(await N_(t.carrierId,{displayName:n.displayName})).state);const r=n.cliType!==t.cliType;return r&&(i=(await N_(t.carrierId,{cli:n.cliType})).state),(r||n.model!==t.model||(n.effort||"")!==(t.effort||""))&&(i=(await N_(t.carrierId,{model:T$(n)})).state),i=await A$(t,e,i),{state:i??await LA()}}):!1}function DA(e,t){const n=R$(e,ui.activeCarrierId),i=e.carriers.find(r=>r.carrierId===n)??null;ar({loading:!1,state:e,options:t,activeCarrierId:n,draft:i?o0(i,t):ui.draft,error:null})}async function k$(e,t){ar({savingActionId:e,error:null});try{const n=await t();return DA(n.state,ui.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),ar({savingActionId:null}),!0}catch(n){return ar({savingActionId:null,error:IA(n)}),!1}}function o0(e,t){const n=Object.fromEntries((t?.cliTypes??[]).map(i=>{const r=e.taskforce.backends.find(o=>o.cliType===i.id);return[i.id,{model:r?.model??i.defaultModel,effort:r?.effort??E$(i.id,r?.model??i.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:n}}function E$(e,t,n){return n?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function T$(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function jA(){return ui.state?.carriers.find(e=>e.carrierId===ui.activeCarrierId)??null}async function A$(e,t,n){const i=new Set(t.map(r=>r.cliType));for(const r of e.taskforce.backends)i.has(r.cliType)||(n=(await p$(e.carrierId,r.cliType)).state);for(const r of t){const o=e.taskforce.backends.find(c=>c.cliType===r.cliType);o&&o.model===r.model&&(o.effort||"")===(r.effort||"")||(n=(await f$(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return n}function R$(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function ar(e){ui={...ui,...e};for(const t of Ny)t()}function IA(e){return e instanceof Error?e.message:String(e)}const L$=50,N$=2400,M$={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)"},O$={id:"carriers",title:"Carriers",render:()=>u.jsx(D$,{})};function D$(){const e=OA(),t=e.state?.carriers.find(x=>x.carrierId===e.activeCarrierId)??null,n=e.options?.cliTypes.find(x=>x.id===e.draft.cliType)??null,i=n?.models.find(x=>x.modelId===e.draft.model)??null,[r,o]=y.useState(!1),[c,d]=y.useState([]),[p,f]=y.useState("idle"),g=e.savingActionId==="save-all",v=t?$$(t,e.draft,c):!1,b=t?.taskforce.backends.map(x=>`${x.cliType}:${x.model}:${x.effort??""}`).join("|")??"";y.useEffect(()=>{const x=new AbortController;return M_(x.signal),()=>x.abort()},[]),y.useEffect(()=>{o(!1),d(t?.taskforce.backends.map(x=>x.cliType)??[]),f("idle")},[t?.carrierId,b]),y.useEffect(()=>{if(p!=="saved")return;const x=window.setTimeout(()=>f("idle"),N$);return()=>window.clearTimeout(x)},[p]);function S(){t&&(x$(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),f("idle"))}async function w(){if(!t)return;if(f("saving"),!await C$(F$(c,e.draft.taskforce))){f("idle");return}o(!1),f("saved")}return u.jsxs(u.Fragment,{children:[e.error?u.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,u.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(x=>u.jsx(j$,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>w$(x.carrierId)},x.carrierId))]}),t&&e.options&&n?u.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:zA(t.carrierId),children:[u.jsxs("div",{className:"terminal-carriers-detail-head",children:[u.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[u.jsxs("div",{className:"terminal-carriers-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`terminal-carriers-name-line ${r?"is-editing":""}`,children:r?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:e.draft.displayName,maxLength:L$,onChange:x=>Nl({displayName:x.target.value})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Save display name",disabled:g,onClick:()=>{o(!1)},children:u.jsx(W$,{})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Cancel display name edit",onClick:()=>{Nl({displayName:t.displayName}),o(!1)},children:u.jsx(G$,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",onClick:()=>{Nl({displayName:t.displayName}),o(!0)},children:u.jsx(U$,{})})]})}),u.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),u.jsxs("div",{className:"terminal-carriers-detail-actions",children:[u.jsx("div",{className:`terminal-carriers-save-status ${p==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:p==="saving"||g?"Saving…":p==="saved"?"Saved ✓":""}),u.jsxs("div",{className:"terminal-carriers-save-actions",children:[u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${v?"is-dirty":""}`,disabled:!v||g,onClick:()=>{w()},children:"Save"}),u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${v?"is-dirty":""}`,disabled:!v||g,onClick:S,children:"Discard"}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading,onClick:()=>{M_()},children:"Refresh"})]})]})]}),u.jsxs("div",{className:"terminal-carriers-body",children:[u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),u.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),u.jsxs("div",{className:"terminal-carriers-runtime",children:[u.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:u.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"terminal-carriers-select",value:e.draft.cliType,onChange:x=>B$(x.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(x=>u.jsx("option",{value:x.id,children:x.displayName},x.id))})]})}),u.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[u.jsx(BA,{id:"carrier-model",label:"Model",models:n.models,value:e.draft.model,onChange:x=>P$(n,x)}),u.jsx(PA,{id:"carrier-effort",model:i,value:e.draft.effort,onChange:x=>Nl({effort:x})})]})]})]}),u.jsx(I$,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:c,onRowsChange:d})]})]},t.carrierId):u.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[u.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{M_()},children:"Refresh"})]})]})}function j$({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceBackendCount>=n;return u.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:zA(e.carrierId),onClick:i,children:[u.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),u.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?u.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function BA({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:i,disabled:r,onChange:c=>o(c.target.value),children:n.map(c=>u.jsx("option",{value:c.modelId,children:c.name},c.modelId))})]})}function PA({id:e,model:t,value:n,disabled:i=!1,onChange:r}){return t?.effort?u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:n||t.effort.default,disabled:i,onChange:o=>r(o.target.value),children:t.effort.levels.map(o=>u.jsx("option",{value:o,children:o},o))})]}):u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),u.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]})}function I$({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,rows:r,onRowsChange:o}){const c=OA(),d=e.taskforce.backends.length,[p,f]=y.useState(d>0),[g,v]=y.useState(!1),[b,S]=y.useState(""),w=e.taskForceBackendCount>=n,x=t.filter(A=>!r.includes(A.id)),E=b||x[0]?.id||"";return u.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${p?"is-expanded":""}`,children:[u.jsxs("div",{className:"terminal-carriers-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),u.jsx("p",{className:"terminal-carriers-help",children:d>0?`${d} backend${d===1?"":"s"} configured${w?" · active":` · needs ${n}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${n} to activate.`})]}),u.jsx("div",{className:"terminal-carriers-tf-head-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":p,onClick:()=>f(A=>!A),children:p?"Hide":"Configure"})})]}),p?u.jsxs("div",{className:"terminal-carriers-tf-list",children:[r.length===0?u.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend drafted."}):null,r.map(A=>{const L=t.find(O=>O.id===A);if(!L)return null;const I=c.draft.taskforce[L.id]??{model:L.defaultModel,effort:""},R=L.models.find(O=>O.modelId===I.model)??L.models[0]??null,z=e.taskforce.backends.some(O=>O.cliType===L.id);return u.jsxs("div",{className:`terminal-carriers-tf-item ${z?"is-active":""}`,children:[u.jsxs("div",{className:"terminal-carriers-tf-title",children:[u.jsx("span",{className:`terminal-carriers-live-dot ${z?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:L.displayName})]}),u.jsx(BA,{id:`tf-${L.id}-model`,label:"Model",models:L.models,value:I.model,onChange:O=>z$(L,O)}),u.jsx(PA,{id:`tf-${L.id}-effort`,model:R,value:I.effort,onChange:O=>My(L.id,{effort:O})}),u.jsx("div",{className:"terminal-carriers-tf-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:i==="save-all",onClick:()=>o(r.filter(O=>O!==L.id)),children:"Remove"})})]},L.id)}),u.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[g&&x.length>0?u.jsx("select",{className:"terminal-carriers-select terminal-carriers-tf-add-select",value:E,onChange:A=>S(A.target.value),"aria-label":"Task Force CLI to add",children:x.map(A=>u.jsx("option",{value:A.id,children:A.displayName},A.id))}):null,u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:x.length===0||i==="save-all",onClick:()=>{if(!g){v(!0);return}const A=E,L=t.find(R=>R.id===A),I=L?.models.find(R=>R.modelId===L.defaultModel)??L?.models[0]??null;!L||!I||(My(L.id,{model:I.modelId,effort:I.effort?.default??""}),o(r.includes(L.id)?r:[...r,L.id]),S(""),v(!1))},children:"Add"})]})]}):null]})}function B$(e,t){const n=t.find(r=>r.id===e),i=n?.models.find(r=>r.modelId===n.defaultModel)??n?.models[0]??null;Nl({cliType:e,model:i?.modelId??"",effort:i?.effort?.default??""})}function P$(e,t){const n=e.models.find(i=>i.modelId===t);Nl({model:t,effort:n?.effort?.default??""})}function z$(e,t){const n=e.models.find(i=>i.modelId===t);My(e.id,{model:t,effort:n?.effort?.default??""})}function $$(e,t,n){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:H$(e,n,t.taskforce)}function H$(e,t,n){if(t.length!==e.taskforce.backends.length)return!0;const i=new Set(t);for(const r of e.taskforce.backends){if(!i.has(r.cliType))return!0;const o=n[r.cliType];if(!o||o.model!==r.model||(o.effort||"")!==(r.effort||""))return!0}return!1}function F$(e,t){return e.map(n=>{const i=t[n];return i?{cliType:n,model:i.model,...i.effort?{effort:i.effort}:{}}:null}).filter(n=>n!==null)}function zA(e){return{"--cap-color":M$[e]??"var(--brass)"}}function U$(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function W$(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function G$(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const q$="global-shell",K$="/plugins/terminal/global/ticket",V$="/plugins/terminal/ws",Y$=168,X$={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},Z$={id:"global-shell",title:"Shell",icon:J$,preferredExtraWidth:Y$,render:e=>u.jsx("div",{style:X$,children:u.jsx(Qb,{operationId:q$,ticketPath:K$,wsPath:V$,theme:"instrument",active:!0})})};function J$(){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 Q$="/plugins/terminal/shell/ticket",eH="/plugins/terminal/ws",$A={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>y.createElement(tH,{context:e})},O_={id:"terminal",operationKinds:[$A],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(nH,{})};function tH({context:e}){return u.jsx(Qb,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:Q$,wsPath:eH,theme:e.theme,onExit:e.onClose})}function nH(){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 iH=new Set(["agent"]),sH={id:"terminal",operationKinds:[$A,EA],settingsSections:[TA,O$],notificationKinds:[AA],railPanels:[Z$],install:e=>(aA(),zP(e.settings),Kd.install?.(e)),closeOperation:async e=>{const t=await aH(e);if(t?.type==="shell"){await O_.closeOperation?.(e);return}t&&iH.has(t.type)&&await Kd.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?O_.launch?.(e)??{id:""}:Kd.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?O_.renderLaunchIcon?.(e):Kd.renderLaunchIcon?.(e)},rH=[sH];async function aH(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const n=await t.json();return typeof n.operation?.type=="string"?{type:n.operation.type}:null}const ee={ts:"ts",js:"js",json:"json",css:"css",html:"html",md:"md",py:"py",go:"go",rust:"rust",shell:"shell",config:"config",image:"image",data:"data",archive:"archive",binary:"binary",ruby:"ruby",folder:"folder",default:"default"},oH={src:ee.ts,lib:ee.ts,app:ee.ts,test:ee.shell,tests:ee.shell,__tests__:ee.shell,spec:ee.shell,specs:ee.shell,node_modules:ee.binary,vendor:ee.binary,dist:ee.config,build:ee.config,out:ee.config,target:ee.config,docs:ee.md,doc:ee.md,public:ee.data,assets:ee.data,static:ee.data,components:ee.image,scripts:ee.js,styles:ee.css,".git":ee.html,".github":ee.config,".vscode":ee.css},A2={ts:{shape:"angle",tone:ee.ts},tsx:{shape:"angle",tone:ee.ts},mts:{shape:"angle",tone:ee.ts},cts:{shape:"angle",tone:ee.ts},"d.ts":{shape:"angle",tone:ee.ts},js:{shape:"angle",tone:ee.js},jsx:{shape:"angle",tone:ee.js},mjs:{shape:"angle",tone:ee.js},cjs:{shape:"angle",tone:ee.js},json:{shape:"braces",tone:ee.json},jsonc:{shape:"braces",tone:ee.json},json5:{shape:"braces",tone:ee.json},jsonl:{shape:"braces",tone:ee.json},graphql:{shape:"braces",tone:ee.image},gql:{shape:"braces",tone:ee.image},proto:{shape:"braces",tone:ee.go},css:{shape:"hash",tone:ee.css},scss:{shape:"hash",tone:ee.css},sass:{shape:"hash",tone:ee.css},less:{shape:"hash",tone:ee.css},styl:{shape:"hash",tone:ee.css},html:{shape:"markup",tone:ee.html},htm:{shape:"markup",tone:ee.html},xml:{shape:"markup",tone:ee.html},xhtml:{shape:"markup",tone:ee.html},vue:{shape:"markup",tone:ee.shell},svelte:{shape:"markup",tone:ee.rust},astro:{shape:"markup",tone:ee.image},md:{shape:"doc",tone:ee.md},mdx:{shape:"doc",tone:ee.md},markdown:{shape:"doc",tone:ee.md},rst:{shape:"doc",tone:ee.md},txt:{shape:"doc",tone:ee.default},text:{shape:"doc",tone:ee.default},log:{shape:"doc",tone:ee.default},adoc:{shape:"doc",tone:ee.md},pdf:{shape:"doc",tone:ee.ruby},py:{shape:"angle",tone:ee.py},pyi:{shape:"angle",tone:ee.py},pyw:{shape:"angle",tone:ee.py},go:{shape:"angle",tone:ee.go},rs:{shape:"angle",tone:ee.rust},rb:{shape:"angle",tone:ee.ruby},rake:{shape:"angle",tone:ee.ruby},gemspec:{shape:"angle",tone:ee.ruby},java:{shape:"angle",tone:ee.html},kt:{shape:"angle",tone:ee.config},kts:{shape:"angle",tone:ee.config},scala:{shape:"angle",tone:ee.ruby},c:{shape:"angle",tone:ee.ts},h:{shape:"angle",tone:ee.ts},cpp:{shape:"angle",tone:ee.css},cc:{shape:"angle",tone:ee.css},cxx:{shape:"angle",tone:ee.css},hpp:{shape:"angle",tone:ee.css},cs:{shape:"angle",tone:ee.config},php:{shape:"angle",tone:ee.config},swift:{shape:"angle",tone:ee.html},lua:{shape:"angle",tone:ee.ts},dart:{shape:"angle",tone:ee.go},sh:{shape:"terminal",tone:ee.shell},bash:{shape:"terminal",tone:ee.shell},zsh:{shape:"terminal",tone:ee.shell},fish:{shape:"terminal",tone:ee.shell},ps1:{shape:"terminal",tone:ee.css},bat:{shape:"terminal",tone:ee.shell},cmd:{shape:"terminal",tone:ee.shell},yaml:{shape:"gear",tone:ee.config},yml:{shape:"gear",tone:ee.config},toml:{shape:"gear",tone:ee.config},ini:{shape:"gear",tone:ee.config},conf:{shape:"gear",tone:ee.config},cfg:{shape:"gear",tone:ee.config},properties:{shape:"gear",tone:ee.config},env:{shape:"gear",tone:ee.config},editorconfig:{shape:"gear",tone:ee.config},png:{shape:"image",tone:ee.image},jpg:{shape:"image",tone:ee.image},jpeg:{shape:"image",tone:ee.image},gif:{shape:"image",tone:ee.image},webp:{shape:"image",tone:ee.image},svg:{shape:"image",tone:ee.image},ico:{shape:"image",tone:ee.image},bmp:{shape:"image",tone:ee.image},avif:{shape:"image",tone:ee.image},tiff:{shape:"image",tone:ee.image},heic:{shape:"image",tone:ee.image},mp4:{shape:"image",tone:ee.data},mov:{shape:"image",tone:ee.data},webm:{shape:"image",tone:ee.data},mkv:{shape:"image",tone:ee.data},mp3:{shape:"chip",tone:ee.shell},wav:{shape:"chip",tone:ee.shell},flac:{shape:"chip",tone:ee.shell},ogg:{shape:"chip",tone:ee.shell},sql:{shape:"database",tone:ee.data},csv:{shape:"database",tone:ee.data},tsv:{shape:"database",tone:ee.data},db:{shape:"database",tone:ee.data},sqlite:{shape:"database",tone:ee.data},sqlite3:{shape:"database",tone:ee.data},parquet:{shape:"database",tone:ee.data},zip:{shape:"archive",tone:ee.archive},tar:{shape:"archive",tone:ee.archive},gz:{shape:"archive",tone:ee.archive},tgz:{shape:"archive",tone:ee.archive},bz2:{shape:"archive",tone:ee.archive},xz:{shape:"archive",tone:ee.archive},rar:{shape:"archive",tone:ee.archive},"7z":{shape:"archive",tone:ee.archive},zst:{shape:"archive",tone:ee.archive},bin:{shape:"chip",tone:ee.binary},exe:{shape:"chip",tone:ee.binary},dll:{shape:"chip",tone:ee.binary},so:{shape:"chip",tone:ee.binary},dylib:{shape:"chip",tone:ee.binary},wasm:{shape:"chip",tone:ee.config},class:{shape:"chip",tone:ee.binary},lock:{shape:"chip",tone:ee.binary},woff:{shape:"chip",tone:ee.config},woff2:{shape:"chip",tone:ee.config},ttf:{shape:"chip",tone:ee.config},otf:{shape:"chip",tone:ee.config}},lH={dockerfile:{shape:"chip",tone:ee.css},"docker-compose.yml":{shape:"gear",tone:ee.css},"docker-compose.yaml":{shape:"gear",tone:ee.css},makefile:{shape:"gear",tone:ee.html},"cmakelists.txt":{shape:"gear",tone:ee.html},".gitignore":{shape:"gear",tone:ee.html},".gitattributes":{shape:"gear",tone:ee.html},".dockerignore":{shape:"gear",tone:ee.html},".npmignore":{shape:"gear",tone:ee.html},".npmrc":{shape:"gear",tone:ee.ruby},"package.json":{shape:"braces",tone:ee.shell},"tsconfig.json":{shape:"braces",tone:ee.ts},license:{shape:"doc",tone:ee.json},"license.md":{shape:"doc",tone:ee.json},licence:{shape:"doc",tone:ee.json}},cH={shape:"default",tone:ee.default},Oy={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 uH({name:e}){const t=dH(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:Oy[t.shape]})}function hH({name:e,open:t}){const n=oH[e.toLowerCase()]??ee.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?Oy.folderOpen:Oy.folderClosed})}function dH(e){const t=e.toLowerCase(),n=lH[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:ee.config};if(t.startsWith("readme"))return{shape:"doc",tone:ee.md};if(t.endsWith(".d.ts"))return A2["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=A2[r];if(o)return o}return cH}function fH(e,t){return`${e??""}:${t??""}`}function Dy(e,t){const n=Jf(t);if(n===null)return null;const i=e?Jf(e):"";return i===null?null:i?n?`${i}/${n}`:i:n}function Cf(e,t){const n=Jf(t),i=e?Jf(e):"";return n===null||i===null?null:i?n===i?"":n.startsWith(`${i}/`)?n.slice(i.length+1):null:n}function HA(e,t){const n=Cf(e,t.relativePath);if(n===null)return null;const i=n===""||t.parentRelativePath===null?null:Cf(e,t.parentRelativePath);if(n!==""&&t.parentRelativePath!==null&&i===null)return null;const r=[];for(const o of t.entries){const c=Cf(e,o.relativePath);c!==null&&r.push({...o,relativePath:c})}return{...t,relativePath:n,parentRelativePath:i,entries:r}}function pH(e,t){return Cf(e,t)}function Jf(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const n of e.replaceAll("\\","/").split("/"))if(!(!n||n===".")){if(n==="..")return null;t.push(n)}return t.join("/")}const mH=200,Vd=30,R2=5,FA="fleet-console.fileExplorer.showHidden",L2=500;function zs(e,t){return e===t}async function gH({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const c=[],d=new Map(t),p=new Set,f=new Set;let g=0;const v=b=>{for(const S of b)if(!(!vH(S,i)||p.has(S.relativePath))){if(p.size>=L2)return;p.add(S.relativePath),c.push(S)}};for(v(e);c.length>0&&r();){const b=c.shift();if(!b)return;const S=d.get(b.relativePath);if(S){if(f.has(S.relativePath))continue;f.add(S.relativePath),v(S.entries);continue}if(g>=L2)return;g+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(d.set(b.relativePath,w),o(b.relativePath,w),f.has(w.relativePath))continue;f.add(w.relativePath),v(w.entries)}catch{}}}function UA(e,t,n,i,r,o,c,d,p=new Set){const f=[];for(const g of e){if(!d&&g.name.startsWith("."))continue;const v=o.get(g.relativePath),b=v?.entries,S=v?.relativePath??g.relativePath,w=g.kind==="dir"&&p.has(S),x=g.kind==="dir"&&!w&&WA(b??[],o,c,d);if(c&&!g.name.toLowerCase().includes(c)&&!x)continue;const E=i.has(g.relativePath)||!!(c&&x);if(f.push({entry:g,depth:t,isSelected:n===g.relativePath,isExpanded:E,isLoading:r.has(g.relativePath)}),g.kind==="dir"&&E&&!w&&b){const A=new Set(p);A.add(S),f.push(...UA(b,t+1,n,i,r,o,c,d,A))}}return f}function _H({contextKey:e,contextRelPath:t,files:n,theaterId:i,selectedPath:r,onSelect:o}){const[c,d]=y.useState(null),[p,f]=y.useState(null),[g,v]=y.useState(""),[b,S]=y.useState(new Set),[w,x]=y.useState(new Set),[E,A]=y.useState(new Map),[L,I]=y.useState(""),[R,z]=y.useState(0),[O,H]=y.useState(600),[F,ae]=y.useState(()=>yH()),fe=y.useRef(null),V=y.useRef(b);V.current=b;const $=y.useRef(g);$.current=g;const N=y.useRef(n);N.current=n;const D=y.useRef(e);D.current=e;const T=y.useRef(E);T.current=E;const k=y.useRef(0),j=!!L;y.useEffect(()=>{i&&(d(null),f(null),v(""),S(new Set),A(new Map),I(""),z(0))},[e,i]),y.useEffect(()=>{if(!i)return;const Ae=e;n.listFolder(g||void 0).then(Se=>{zs(Ae,D.current)&&(d(Se),f(null))}).catch(Se=>{zs(Ae,D.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")})},[e,i,g,n]),y.useEffect(()=>{const Ae=++k.current;if(!j||!c)return;let Se=!0;const $e=e,Ye=()=>Se&&Ae===k.current&&zs($e,D.current);return gH({entries:c.entries,cachedResults:T.current,files:n,showHidden:F,isCurrent:Ye,onFolderResult:(ht,nt)=>{Ye()&&A(yt=>new Map(yt).set(ht,nt))}}),()=>{Se=!1}},[e,n,j,c,F]),y.useEffect(()=>{const Ae=fe.current;if(!Ae)return;const Se=new ResizeObserver(()=>H(Ae.clientHeight));return Se.observe(Ae),H(Ae.clientHeight),()=>Se.disconnect()},[]),y.useEffect(()=>{if(!i)return;let Ae=!0;const Se=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(i)}`,$e=new EventSource(Se),Ye=()=>{const nt=e;N.current.listFolder($.current||void 0).then(yt=>{zs(nt,D.current)&&(d(yt),f(null))}).catch(()=>{})},ht=()=>{Ye();for(const nt of V.current){const yt=e;N.current.listFolder(nt).then(Tt=>{zs(yt,D.current)&&A(nn=>new Map(nn).set(nt,Tt))}).catch(()=>{})}};return $e.addEventListener("change",nt=>{let yt;try{yt=JSON.parse(nt.data)}catch{return}if(typeof yt!="string")return;const Tt=pH(t,yt);if(Tt!==null&&((Tt===""||Tt===$.current)&&Ye(),Tt!==""&&V.current.has(Tt))){const nn=e;N.current.listFolder(Tt).then(Be=>{zs(nn,D.current)&&A(_e=>new Map(_e).set(Tt,Be))}).catch(()=>{})}}),$e.onopen=()=>{if(Ae){Ae=!1;return}ht()},()=>{$e.close()}},[t,i,n]);const B=y.useCallback(Ae=>{const Se=Ae.relativePath,$e=!b.has(Se);if(S(Ye=>{const ht=new Set(Ye);return ht.has(Se)?(ht.delete(Se),ht):(ht.add(Se),ht)}),$e){const Ye=e;x(ht=>new Set(ht).add(Se)),n.listFolder(Se).then(ht=>{zs(Ye,D.current)&&(A(nt=>new Map(nt).set(Se,ht)),x(nt=>{const yt=new Set(nt);return yt.delete(Se),yt}))}).catch(()=>{zs(Ye,D.current)&&x(ht=>{const nt=new Set(ht);return nt.delete(Se),nt})})}},[e,n,b]),q=y.useCallback(Ae=>{Ae.kind==="dir"?B(Ae):o(Ae)},[B,o]),J=y.useCallback(Ae=>{z(Ae.currentTarget.scrollTop)},[]),P=y.useCallback(()=>{ae(Ae=>{const Se=!Ae;try{localStorage.setItem(FA,Se?"1":"0")}catch{}return Se})},[]),X=y.useCallback(()=>{if(!i)return;const Ae=e;n.listFolder(g||void 0).then(Se=>{zs(Ae,D.current)&&(d(Se),f(null))}).catch(Se=>{zs(Ae,D.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")});for(const Se of b)n.listFolder(Se).then($e=>{zs(Ae,D.current)&&A(Ye=>new Map(Ye).set(Se,$e))}).catch(()=>{})},[e,n,g,b,i]),Q=L.toLowerCase(),Y=y.useMemo(()=>c?UA(c.entries,0,r,b,w,E,Q,F):[],[c,r,b,w,E,Q,F]),ie=!F&&c!==null&&c.entries.length>0&&Y.length===0&&!L,me=Y.length>mH,ye=me?Math.max(0,Math.floor(R/Vd)-R2):0,ke=me?Math.min(Y.length,Math.ceil((R+O)/Vd)+R2):Y.length,Le=Y.slice(ye,ke),ct=Y.length*Vd,je=ye*Vd;return i?p&&!c?u.jsx("div",{className:"fexp-tree-error",children:p}):c?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:L,onChange:Ae=>I(Ae.target.value),"aria-label":"Filter files"}),L&&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:X,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${F?" is-active":""}`,onClick:P,"aria-pressed":F,"aria-label":F?"Hide hidden files":"Show hidden files",title:F?"Hide hidden files":"Show hidden files",children:F?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:fe,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:me?J:void 0,children:[!1,me?u.jsx("div",{style:{height:ct,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${je}px)`},children:Le.map(Ae=>u.jsx(N2,{row:Ae,onEntryClick:q},Ae.entry.relativePath))})}):Le.map(Ae=>u.jsx(N2,{row:Ae,onEntryClick:q},Ae.entry.relativePath)),Y.length===0&&L&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),Y.length===0&&!L&&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 WA(e,t,n,i,r=new Set){for(const o of e)if(!(!i&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(n))return!0;if(o.kind==="dir"){const c=t.get(o.relativePath);if(c&&!r.has(c.relativePath)){const d=new Set(r);if(d.add(c.relativePath),WA(c.entries,t,n,i,d))return!0}}}return!1}function vH(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function N2({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:c}=e,d=n.kind==="dir",p=i*16,f=y.useCallback(()=>t(n),[n,t]);return u.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${d?" is-dir":" is-file"}`,style:{paddingLeft:`${p+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":d?o:void 0,onClick:f,children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:d?u.jsx(hH,{name:n.name,open:o}):u.jsx(uH,{name:n.name})}),u.jsx("span",{className:"fexp-tree-name",children:n.name}),c&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function yH(){try{return localStorage.getItem(FA)==="1"}catch{return!1}}function bH({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 SH(e,t){switch(t){case"typescript":case"javascript":return xH(e);case"json":return CH(e);case"python":return EH(e);case"css":case"scss":case"sass":case"less":return TH(e);case"html":case"xml":return AH(e);case"bash":case"shell":return RH(e);case"yaml":return LH(e);default:return[{kind:"text",value:e}]}}const wH=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 xH(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
107
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=$a(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])||e[n]==="."&&/[0-9]/.test(e[n+1]??"")){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_$]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_$][\w$]*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);wH.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}function CH(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=$a(e,n,'"','"'),c=e.slice(n+r).trimStart().startsWith(":");t.push({kind:c?"attr":"str",value:i}),n+=r;continue}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(e.startsWith("true",n)||e.startsWith("false",n)||e.startsWith("null",n)){const i=e.slice(n).match(/^(true|false|null)/);if(i){t.push({kind:"key",value:i[0]}),n+=i[0].length;continue}}if(/[{}[\]:,]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}const kH=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 EH(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
108
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_]\w*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);kH.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function TH(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
109
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==="."||e[n]==="#"||e[n]===":"){const i=e.slice(n).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(i){t.push({kind:"tag",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z-]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z-][\w-]*/);if(i){const r=i[0];e.slice(n+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function AH(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),r=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="<"){t.push({kind:"punct",value:"<"}),n++,e[n]==="/"&&(t.push({kind:"punct",value:"/"}),n++);const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);i&&(t.push({kind:"tag",value:i[0]}),n+=i[0].length);continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const r=e.slice(n+i[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function RH(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
|
|
110
|
-
`,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:r}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const r=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:i.has(r[0])?"key":"text",value:r[0]}),n+=r[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function LH(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
111
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=$a(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_][\w-]*/);if(i){e.slice(n+i[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:i[0]}):["true","false","null","yes","no","on","off"].includes(i[0])?t.push({kind:"key",value:i[0]}):t.push({kind:"text",value:i[0]}),n+=i[0].length;continue}}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function $a(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
|
|
112
|
-
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function NH({content:e,lang:t,truncated:n}){const i=y.useMemo(()=>MH(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[n&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:i.map((r,o)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function MH(e,t){return e.split(`
|
|
113
|
-
`).map(i=>OH(i,t))}function OH(e,t){return t==="plaintext"||t==="markdown"?M2(e)||" ":SH(e,t).map(i=>{const r=M2(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function M2(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function DH({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 l0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oo=l0();function GA(e){Oo=e}var zu={exec:()=>null};function Et(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let c=typeof o=="string"?o:o.source;return c=c.replace(Ti.caret,"$1"),n=n.replace(r,c),i},getRegex:()=>new RegExp(n,t)};return i}var jH=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ti={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")},IH=/^(?:[ \t]*(?:\n|$))+/,BH=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,PH=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,yh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zH=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,c0=/(?:[*+-]|\d{1,9}[.)])/,qA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,KA=Et(qA).replace(/bull/g,c0).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(),$H=Et(qA).replace(/bull/g,c0).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(),u0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,HH=/^[^\n]+/,h0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,FH=Et(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",h0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UH=Et(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,c0).getRegex(),Rp="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",d0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,WH=Et("^ {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",d0).replace("tag",Rp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),VA=Et(u0).replace("hr",yh).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",Rp).getRegex(),GH=Et(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",VA).getRegex(),f0={blockquote:GH,code:BH,def:FH,fences:PH,heading:zH,hr:yh,html:WH,lheading:KA,list:UH,newline:IH,paragraph:VA,table:zu,text:HH},O2=Et("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",yh).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",Rp).getRegex(),qH={...f0,lheading:$H,table:O2,paragraph:Et(u0).replace("hr",yh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",O2).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",Rp).getRegex()},KH={...f0,html:Et(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",d0).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:zu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Et(u0).replace("hr",yh).replace("heading",` *#{1,6} *[^
|
|
114
|
-
]`).replace("lheading",KA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},VH=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,YH=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,YA=/^( {2,}|\\)\n(?!\s*$)/,XH=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Lp=/[\p{P}\p{S}]/u,p0=/[\s\p{P}\p{S}]/u,XA=/[^\s\p{P}\p{S}]/u,ZH=Et(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,p0).getRegex(),ZA=/(?!~)[\p{P}\p{S}]/u,JH=/(?!~)[\s\p{P}\p{S}]/u,QH=/(?:[^\s\p{P}\p{S}]|~)/u,eF=Et(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",jH?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),JA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,tF=Et(JA,"u").replace(/punct/g,Lp).getRegex(),nF=Et(JA,"u").replace(/punct/g,ZA).getRegex(),QA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iF=Et(QA,"gu").replace(/notPunctSpace/g,XA).replace(/punctSpace/g,p0).replace(/punct/g,Lp).getRegex(),sF=Et(QA,"gu").replace(/notPunctSpace/g,QH).replace(/punctSpace/g,JH).replace(/punct/g,ZA).getRegex(),rF=Et("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,XA).replace(/punctSpace/g,p0).replace(/punct/g,Lp).getRegex(),aF=Et(/\\(punct)/,"gu").replace(/punct/g,Lp).getRegex(),oF=Et(/^<(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(),lF=Et(d0).replace("(?:-->|$)","-->").getRegex(),cF=Et("^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",lF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,uF=Et(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Qf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),eR=Et(/^!?\[(label)\]\[(ref)\]/).replace("label",Qf).replace("ref",h0).getRegex(),tR=Et(/^!?\[(ref)\](?:\[\])?/).replace("ref",h0).getRegex(),hF=Et("reflink|nolink(?!\\()","g").replace("reflink",eR).replace("nolink",tR).getRegex(),D2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,m0={_backpedal:zu,anyPunctuation:aF,autolink:oF,blockSkip:eF,br:YA,code:YH,del:zu,emStrongLDelim:tF,emStrongRDelimAst:iF,emStrongRDelimUnd:rF,escape:VH,link:uF,nolink:tR,punctuation:ZH,reflink:eR,reflinkSearch:hF,tag:cF,text:XH,url:zu},dF={...m0,link:Et(/^!?\[(label)\]\((.*?)\)/).replace("label",Qf).getRegex(),reflink:Et(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qf).getRegex()},jy={...m0,emStrongRDelimAst:sF,emStrongLDelim:nF,url:Et(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",D2).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:Et(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",D2).getRegex()},fF={...jy,br:Et(YA).replace("{2,}","*").getRegex(),text:Et(jy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yd={normal:f0,gfm:qH,pedantic:KH},cu={normal:m0,gfm:jy,breaks:fF,pedantic:dF},pF={"&":"&","<":"<",">":">",'"':""","'":"'"},j2=e=>pF[e];function ir(e,t){if(t){if(Ti.escapeTest.test(e))return e.replace(Ti.escapeReplace,j2)}else if(Ti.escapeTestNoEncode.test(e))return e.replace(Ti.escapeReplaceNoEncode,j2);return e}function I2(e){try{e=encodeURI(e).replace(Ti.percentDecode,"%")}catch{return null}return e}function B2(e,t){let n=e.replace(Ti.findPipe,(o,c,d)=>{let p=!1,f=c;for(;--f>=0&&d[f]==="\\";)p=!p;return p?"|":" |"}),i=n.split(Ti.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(Ti.slashPipe,"|");return i}function uu(e,t,n){let i=e.length;if(i===0)return"";let r=0;for(;r<i&&e.charAt(i-r-1)===t;)r++;return e.slice(0,i-r)}function mF(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function P2(e,t,n,i,r){let o=t.href,c=t.title||null,d=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:c,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,p}function gF(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
115
|
-
`).map(o=>{let c=o.match(n.other.beginningSpace);if(c===null)return o;let[d]=c;return d.length>=r.length?o.slice(r.length):o}).join(`
|
|
116
|
-
`)}var ep=class{options;rules;lexer;constructor(e){this.options=e||Oo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:uu(n,`
|
|
117
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=gF(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=uu(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:uu(t[0],`
|
|
118
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=uu(t[0],`
|
|
119
|
-
`).split(`
|
|
120
|
-
`),i="",r="",o=[];for(;n.length>0;){let c=!1,d=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))d.push(n[p]),c=!0;else if(!c)d.push(n[p]);else break;n=n.slice(p);let f=d.join(`
|
|
121
|
-
`),g=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
122
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
123
|
-
${f}`:f,r=r?`${r}
|
|
124
|
-
${g}`:g;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,o,!0),this.lexer.state.top=v,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
|
|
125
|
-
`+n.join(`
|
|
126
|
-
`),x=this.blockquote(w);o[o.length-1]=x,i=i.substring(0,i.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
|
|
127
|
-
`+n.join(`
|
|
128
|
-
`),x=this.list(w);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,n=w.substring(o.at(-1).raw.length).split(`
|
|
129
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),c=!1;for(;e;){let p=!1,f="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let v=t[2].split(`
|
|
130
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),b=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(b)&&(f+=b+`
|
|
132
|
-
`,e=e.substring(b.length+1),p=!0),!p){let A=this.rules.other.nextBulletRegex(w),L=this.rules.other.hrRegex(w),I=this.rules.other.fencesBeginRegex(w),R=this.rules.other.headingBeginRegex(w),z=this.rules.other.htmlBeginRegex(w);for(;e;){let O=e.split(`
|
|
133
|
-
`,1)[0],H;if(b=O,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),H=b):H=b.replace(this.rules.other.tabCharGlobal," "),I.test(b)||R.test(b)||z.test(b)||A.test(b)||L.test(b))break;if(H.search(this.rules.other.nonSpaceChar)>=w||!b.trim())g+=`
|
|
134
|
-
`+H.slice(w);else{if(S||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(v)||R.test(v)||L.test(v))break;g+=`
|
|
135
|
-
`+b}!S&&!b.trim()&&(S=!0),f+=O+`
|
|
136
|
-
`,e=e.substring(O.length+1),v=H.slice(w)}}r.loose||(c?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0));let x=null,E;this.options.gfm&&(x=this.rules.other.listIsTask.exec(g),x&&(E=x[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!x,checked:E,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 n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=B2(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
137
|
-
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let c of i)this.rules.other.tableAlignRight.test(c)?o.align.push("right"):this.rules.other.tableAlignCenter.test(c)?o.align.push("center"):this.rules.other.tableAlignLeft.test(c)?o.align.push("left"):o.align.push(null);for(let c=0;c<n.length;c++)o.header.push({text:n[c],tokens:this.lexer.inline(n[c]),header:!0,align:o.align[c]});for(let c of r)o.rows.push(B2(c,o.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[p]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
138
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=uu(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=mF(t[2],"()");if(o===-2)return;if(o>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),P2(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return P2(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,o,c,d=r,p=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(c=[...o].length,i[3]||i[4]){d+=c;continue}else if((i[5]||i[6])&&r%3&&!((r+c)%3)){p+=c;continue}if(d-=c,d>0)continue;c=Math.min(c,c+d+p);let g=[...i[0]][0].length,v=e.slice(0,r+i.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 b=v.slice(2,-2);return{type:"strong",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},$s=class Iy{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Oo,this.options.tokenizer=this.options.tokenizer||new ep,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Ti,block:Yd.normal,inline:cu.normal};this.options.pedantic?(n.block=Yd.pedantic,n.inline=cu.pedantic):this.options.gfm&&(n.block=Yd.gfm,this.options.breaks?n.inline=cu.breaks:n.inline=cu.gfm),this.tokenizer.rules=n}static get rules(){return{block:Yd,inline:cu}}static lex(t,n){return new Iy(n).lex(t)}static lexInline(t,n){return new Iy(n).inlineTokens(t)}lex(t){t=t.replace(Ti.carriageReturn,`
|
|
139
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace(Ti.tabCharGlobal," ").replace(Ti.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let c=n.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
140
|
-
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
141
|
-
`)?"":`
|
|
142
|
-
`)+r.raw,c.text+=`
|
|
143
|
-
`+r.text,this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
144
|
-
`)?"":`
|
|
145
|
-
`)+r.raw,c.text+=`
|
|
146
|
-
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let o=t;if(this.options.extensions?.startBlock){let c=1/0,d=t.slice(1),p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(o=t.substring(0,c+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let c=n.at(-1);i&&c?.type==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
147
|
-
`)?"":`
|
|
148
|
-
`)+r.raw,c.text+=`
|
|
149
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r),i=o.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
150
|
-
`)?"":`
|
|
151
|
-
`)+r.raw,c.text+=`
|
|
152
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,r=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=r[2]?r[2].length:0,i=i.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let c=!1,d="";for(;t;){c||(d=""),c=!1;let p;if(this.options.extensions?.inline?.some(g=>(p=g.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let g=n.at(-1);p.type==="text"&&g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,i,d)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let f=t;if(this.options.extensions?.startInline){let g=1/0,v=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},v),typeof b=="number"&&b>=0&&(g=Math.min(g,b))}),g<1/0&&g>=0&&(f=t.substring(0,g+1))}if(p=this.tokenizer.inlineText(f)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(d=p.raw.slice(-1)),c=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},tp=class{options;parser;constructor(e){this.options=e||Oo}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Ti.notSpaceStart)?.[0],r=e.replace(Ti.endingNewline,"")+`
|
|
153
|
-
`;return i?'<pre><code class="language-'+ir(i)+'">'+(n?r:ir(r,!0))+`</code></pre>
|
|
154
|
-
`:"<pre><code>"+(n?r:ir(r,!0))+`</code></pre>
|
|
155
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
156
|
-
${this.parser.parse(e)}</blockquote>
|
|
157
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
158
|
-
`}hr(e){return`<hr>
|
|
159
|
-
`}list(e){let t=e.ordered,n=e.start,i="";for(let c=0;c<e.items.length;c++){let d=e.items[c];i+=this.listitem(d)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
160
|
-
`+i+"</"+r+`>
|
|
161
|
-
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+ir(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
162
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
163
|
-
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let c=0;c<o.length;c++)n+=this.tablecell(o[c]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
164
|
-
<thead>
|
|
165
|
-
`+t+`</thead>
|
|
166
|
-
`+i+`</table>
|
|
167
|
-
`}tablerow({text:e}){return`<tr>
|
|
168
|
-
${e}</tr>
|
|
169
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
170
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ir(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=I2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+ir(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=I2(e);if(r===null)return ir(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${ir(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ir(e.text)}},g0=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""}},Hs=class By{options;renderer;textRenderer;constructor(t){this.options=t||Oo,this.options.renderer=this.options.renderer||new tp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new g0}static parse(t,n){return new By(n).parse(t)}static parseInline(t,n){return new By(n).parseInline(t)}parse(t,n=!0){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=o,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){i+=p||"";continue}}let c=o;switch(c.type){case"space":{i+=this.renderer.space(c);continue}case"hr":{i+=this.renderer.hr(c);continue}case"heading":{i+=this.renderer.heading(c);continue}case"code":{i+=this.renderer.code(c);continue}case"table":{i+=this.renderer.table(c);continue}case"blockquote":{i+=this.renderer.blockquote(c);continue}case"list":{i+=this.renderer.list(c);continue}case"html":{i+=this.renderer.html(c);continue}case"def":{i+=this.renderer.def(c);continue}case"paragraph":{i+=this.renderer.paragraph(c);continue}case"text":{let d=c,p=this.renderer.text(d);for(;r+1<t.length&&t[r+1].type==="text";)d=t[++r],p+=`
|
|
171
|
-
`+this.renderer.text(d);n?i+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):i+=p;continue}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}parseInline(t,n=this.renderer){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=this.options.extensions.renderers[o.type].call({parser:this},o);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=d||"";continue}}let c=o;switch(c.type){case"escape":{i+=n.text(c);break}case"html":{i+=n.html(c);break}case"link":{i+=n.link(c);break}case"image":{i+=n.image(c);break}case"strong":{i+=n.strong(c);break}case"em":{i+=n.em(c);break}case"codespan":{i+=n.codespan(c);break}case"br":{i+=n.br(c);break}case"del":{i+=n.del(c);break}case"text":{i+=n.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},Lu=class{options;block;constructor(e){this.options=e||Oo}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?$s.lex:$s.lexInline}provideParser(){return this.block?Hs.parse:Hs.parseInline}},nR=class{defaults=l0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Hs;Renderer=tp;TextRenderer=g0;Lexer=$s;Tokenizer=ep;Hooks=Lu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let r=i;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let c of o)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=i;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let c=r[o].flat(1/0);n=n.concat(this.walkTokens(c,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...c){let d=r.renderer.apply(this,c);return d===!1&&(d=o.apply(this,c)),d}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new tp(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let c=o,d=n.renderer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new ep(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let c=o,d=n.tokenizer[c],p=r[c];r[c]=(...f)=>{let g=d.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Lu;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let c=o,d=n.hooks[c],p=r[c];Lu.passThroughHooks.has(o)?r[c]=f=>{if(this.defaults.async&&Lu.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}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(c){let d=[];return d.push(o.call(this,c)),r&&(d=d.concat(r.call(this,c))),d}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return $s.lex(e,t??this.defaults)}parser(e,t){return Hs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let c=r.hooks?await r.hooks.preprocess(t):t,d=await(r.hooks?await r.hooks.provideLexer():e?$s.lex:$s.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?Hs.parse:Hs.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?$s.lex:$s.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?Hs.parse:Hs.parseInline)(c,r);return r.hooks&&(d=r.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(e,t){return n=>{if(n.message+=`
|
|
172
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+ir(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Ro=new nR;function Ut(e,t){return Ro.parse(e,t)}Ut.options=Ut.setOptions=function(e){return Ro.setOptions(e),Ut.defaults=Ro.defaults,GA(Ut.defaults),Ut};Ut.getDefaults=l0;Ut.defaults=Oo;Ut.use=function(...e){return Ro.use(...e),Ut.defaults=Ro.defaults,GA(Ut.defaults),Ut};Ut.walkTokens=function(e,t){return Ro.walkTokens(e,t)};Ut.parseInline=Ro.parseInline;Ut.Parser=Hs;Ut.parser=Hs.parse;Ut.Renderer=tp;Ut.TextRenderer=g0;Ut.Lexer=$s;Ut.lexer=$s.lex;Ut.Tokenizer=ep;Ut.Hooks=Lu;Ut.parse=Ut;Ut.options;Ut.setOptions;Ut.use;Ut.walkTokens;Ut.parseInline;Hs.parse;$s.lex;const{entries:iR,setPrototypeOf:z2,isFrozen:_F,getPrototypeOf:vF,getOwnPropertyDescriptor:yF}=Object;let{freeze:Ai,seal:Os,create:Cl}=Object,{apply:Py,construct:zy}=typeof Reflect<"u"&&Reflect;Ai||(Ai=function(t){return t});Os||(Os=function(t){return t});Py||(Py=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];return t.apply(n,r)});zy||(zy=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new t(...i)});const hu=jn(Array.prototype.forEach),bF=jn(Array.prototype.lastIndexOf),$2=jn(Array.prototype.pop),du=jn(Array.prototype.push),SF=jn(Array.prototype.splice),Ci=Array.isArray,Nu=jn(String.prototype.toLowerCase),D_=jn(String.prototype.toString),H2=jn(String.prototype.match),yl=jn(String.prototype.replace),F2=jn(String.prototype.indexOf),wF=jn(String.prototype.trim),xF=jn(Number.prototype.toString),CF=jn(Boolean.prototype.toString),U2=typeof BigInt>"u"?null:jn(BigInt.prototype.toString),W2=typeof Symbol>"u"?null:jn(Symbol.prototype.toString),gn=jn(Object.prototype.hasOwnProperty),fu=jn(Object.prototype.toString),li=jn(RegExp.prototype.test),Xd=kF(TypeError);function jn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Py(e,t,i)}}function kF(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return zy(e,n)}}function st(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Nu;if(z2&&z2(e,null),!Ci(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(_F(t)||(t[i]=o),r=o)}e[r]=!0}return e}function EF(e){for(let t=0;t<e.length;t++)gn(e,t)||(e[t]=null);return e}function Fi(e){const t=Cl(null);for(const[n,i]of iR(e))gn(e,n)&&(Ci(i)?t[n]=EF(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Fi(i):t[n]=i);return t}function TF(e){switch(typeof e){case"string":return e;case"number":return xF(e);case"boolean":return CF(e);case"bigint":return U2?U2(e):"0";case"symbol":return W2?W2(e):"Symbol()";case"undefined":return fu(e);case"function":case"object":{if(e===null)return fu(e);const t=e,n=kl(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:fu(i)}return fu(e)}default:return fu(e)}}function kl(e,t){for(;e!==null;){const i=yF(e,t);if(i){if(i.get)return jn(i.get);if(typeof i.value=="function")return jn(i.value)}e=vF(e)}function n(){return null}return n}function AF(e){try{return li(e,""),!0}catch{return!1}}const G2=Ai(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),j_=Ai(["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"]),I_=Ai(["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"]),RF=Ai(["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"]),B_=Ai(["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"]),LF=Ai(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),q2=Ai(["#text"]),K2=Ai(["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"]),P_=Ai(["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"]),V2=Ai(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Zd=Ai(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),NF=Os(/\{\{[\w\W]*|[\w\W]*\}\}/gm),MF=Os(/<%[\w\W]*|[\w\W]*%>/gm),OF=Os(/\$\{[\w\W]*/gm),DF=Os(/^data-[\-\w.\u00B7-\uFFFF]+$/),jF=Os(/^aria-[\-\w]+$/),sR=Os(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IF=Os(/^(?:\w+script|data):/i),BF=Os(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rR=Os(/^html$/i),PF=Os(/^[a-z][.\w]*(-[.\w]+)+$/i);var Y2=Object.freeze({__proto__:null,ARIA_ATTR:jF,ATTR_WHITESPACE:BF,CUSTOM_ELEMENT:PF,DATA_ATTR:DF,DOCTYPE_NAME:rR,ERB_EXPR:MF,IS_ALLOWED_URI:sR,IS_SCRIPT_OR_DATA:IF,MUSTACHE_EXPR:NF,TMPLIT_EXPR:OF});const pu={element:1,text:3,progressingInstruction:7,comment:8,document:9},zF=function(){return typeof window>"u"?null:window},$F=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},X2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function aR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zF();const t=Me=>aR(Me);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==pu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:d,Element:p,NodeFilter:f,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:v,DOMParser:b,trustedTypes:S}=e,w=p.prototype,x=kl(w,"cloneNode"),E=kl(w,"remove"),A=kl(w,"nextSibling"),L=kl(w,"childNodes"),I=kl(w,"parentNode");if(typeof c=="function"){const Me=n.createElement("template");Me.content&&Me.content.ownerDocument&&(n=Me.content.ownerDocument)}let R,z="";const{implementation:O,createNodeIterator:H,createDocumentFragment:F,getElementsByTagName:ae}=n,{importNode:fe}=i;let V=X2();t.isSupported=typeof iR=="function"&&typeof I=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$,ERB_EXPR:N,TMPLIT_EXPR:D,DATA_ATTR:T,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:q}=Y2;let{IS_ALLOWED_URI:J}=Y2,P=null;const X=st({},[...G2,...j_,...I_,...B_,...q2]);let Q=null;const Y=st({},[...K2,...P_,...V2,...Zd]);let ie=Object.seal(Cl(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}})),me=null,ye=null;const ke=Object.seal(Cl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,ct=!0,je=!1,Ae=!0,Se=!1,$e=!0,Ye=!1,ht=!1,nt=!1,yt=!1,Tt=!1,nn=!1,Be=!0,_e=!1;const We="user-content-";let ut=!0,ds=!1,Fn={},kn=null;const Ni=st({},["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 bi=null;const Ki=st({},["audio","video","img","source","image","track"]);let fr=null;const Vi=st({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fi="http://www.w3.org/1998/Math/MathML",Yt="http://www.w3.org/2000/svg",jt="http://www.w3.org/1999/xhtml";let It=jt,pr=!1,In=null;const fs=st({},[fi,Yt,jt],D_);let ei=st({},["mi","mo","mn","ms","mtext"]),ps=st({},["annotation-xml"]);const js=st({},["title","style","font","a","script"]);let Bt=null;const W=["application/xhtml+xml","text/html"],ce="text/html";let ve=null,ze=null;const Rt=n.createElement("form"),St=function(U){return U instanceof RegExp||U instanceof Function},Re=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ze&&ze===U)return;(!U||typeof U!="object")&&(U={}),U=Fi(U),Bt=W.indexOf(U.PARSER_MEDIA_TYPE)===-1?ce:U.PARSER_MEDIA_TYPE,ve=Bt==="application/xhtml+xml"?D_:Nu,P=gn(U,"ALLOWED_TAGS")&&Ci(U.ALLOWED_TAGS)?st({},U.ALLOWED_TAGS,ve):X,Q=gn(U,"ALLOWED_ATTR")&&Ci(U.ALLOWED_ATTR)?st({},U.ALLOWED_ATTR,ve):Y,In=gn(U,"ALLOWED_NAMESPACES")&&Ci(U.ALLOWED_NAMESPACES)?st({},U.ALLOWED_NAMESPACES,D_):fs,fr=gn(U,"ADD_URI_SAFE_ATTR")&&Ci(U.ADD_URI_SAFE_ATTR)?st(Fi(Vi),U.ADD_URI_SAFE_ATTR,ve):Vi,bi=gn(U,"ADD_DATA_URI_TAGS")&&Ci(U.ADD_DATA_URI_TAGS)?st(Fi(Ki),U.ADD_DATA_URI_TAGS,ve):Ki,kn=gn(U,"FORBID_CONTENTS")&&Ci(U.FORBID_CONTENTS)?st({},U.FORBID_CONTENTS,ve):Ni,me=gn(U,"FORBID_TAGS")&&Ci(U.FORBID_TAGS)?st({},U.FORBID_TAGS,ve):Fi({}),ye=gn(U,"FORBID_ATTR")&&Ci(U.FORBID_ATTR)?st({},U.FORBID_ATTR,ve):Fi({}),Fn=gn(U,"USE_PROFILES")?U.USE_PROFILES&&typeof U.USE_PROFILES=="object"?Fi(U.USE_PROFILES):U.USE_PROFILES:!1,Le=U.ALLOW_ARIA_ATTR!==!1,ct=U.ALLOW_DATA_ATTR!==!1,je=U.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=U.SAFE_FOR_TEMPLATES||!1,$e=U.SAFE_FOR_XML!==!1,Ye=U.WHOLE_DOCUMENT||!1,yt=U.RETURN_DOM||!1,Tt=U.RETURN_DOM_FRAGMENT||!1,nn=U.RETURN_TRUSTED_TYPE||!1,nt=U.FORCE_BODY||!1,Be=U.SANITIZE_DOM!==!1,_e=U.SANITIZE_NAMED_PROPS||!1,ut=U.KEEP_CONTENT!==!1,ds=U.IN_PLACE||!1,J=AF(U.ALLOWED_URI_REGEXP)?U.ALLOWED_URI_REGEXP:sR,It=typeof U.NAMESPACE=="string"?U.NAMESPACE:jt,ei=gn(U,"MATHML_TEXT_INTEGRATION_POINTS")&&U.MATHML_TEXT_INTEGRATION_POINTS&&typeof U.MATHML_TEXT_INTEGRATION_POINTS=="object"?Fi(U.MATHML_TEXT_INTEGRATION_POINTS):st({},["mi","mo","mn","ms","mtext"]),ps=gn(U,"HTML_INTEGRATION_POINTS")&&U.HTML_INTEGRATION_POINTS&&typeof U.HTML_INTEGRATION_POINTS=="object"?Fi(U.HTML_INTEGRATION_POINTS):st({},["annotation-xml"]);const oe=gn(U,"CUSTOM_ELEMENT_HANDLING")&&U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING=="object"?Fi(U.CUSTOM_ELEMENT_HANDLING):Cl(null);if(ie=Cl(null),gn(oe,"tagNameCheck")&&St(oe.tagNameCheck)&&(ie.tagNameCheck=oe.tagNameCheck),gn(oe,"attributeNameCheck")&&St(oe.attributeNameCheck)&&(ie.attributeNameCheck=oe.attributeNameCheck),gn(oe,"allowCustomizedBuiltInElements")&&typeof oe.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=oe.allowCustomizedBuiltInElements),Se&&(ct=!1),Tt&&(yt=!0),Fn&&(P=st({},q2),Q=Cl(null),Fn.html===!0&&(st(P,G2),st(Q,K2)),Fn.svg===!0&&(st(P,j_),st(Q,P_),st(Q,Zd)),Fn.svgFilters===!0&&(st(P,I_),st(Q,P_),st(Q,Zd)),Fn.mathMl===!0&&(st(P,B_),st(Q,V2),st(Q,Zd))),ke.tagCheck=null,ke.attributeCheck=null,gn(U,"ADD_TAGS")&&(typeof U.ADD_TAGS=="function"?ke.tagCheck=U.ADD_TAGS:Ci(U.ADD_TAGS)&&(P===X&&(P=Fi(P)),st(P,U.ADD_TAGS,ve))),gn(U,"ADD_ATTR")&&(typeof U.ADD_ATTR=="function"?ke.attributeCheck=U.ADD_ATTR:Ci(U.ADD_ATTR)&&(Q===Y&&(Q=Fi(Q)),st(Q,U.ADD_ATTR,ve))),gn(U,"ADD_URI_SAFE_ATTR")&&Ci(U.ADD_URI_SAFE_ATTR)&&st(fr,U.ADD_URI_SAFE_ATTR,ve),gn(U,"FORBID_CONTENTS")&&Ci(U.FORBID_CONTENTS)&&(kn===Ni&&(kn=Fi(kn)),st(kn,U.FORBID_CONTENTS,ve)),gn(U,"ADD_FORBID_CONTENTS")&&Ci(U.ADD_FORBID_CONTENTS)&&(kn===Ni&&(kn=Fi(kn)),st(kn,U.ADD_FORBID_CONTENTS,ve)),ut&&(P["#text"]=!0),Ye&&st(P,["html","head","body"]),P.table&&(st(P,["tbody"]),delete me.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=U.TRUSTED_TYPES_POLICY,z=R.createHTML("")}else R===void 0&&(R=$F(S,r)),R!==null&&typeof z=="string"&&(z=R.createHTML(""));Ai&&Ai(U),ze=U},Ee=st({},[...j_,...I_,...RF]),Fe=st({},[...B_,...LF]),Gt=function(U){let oe=I(U);(!oe||!oe.tagName)&&(oe={namespaceURI:It,tagName:"template"});const Ce=Nu(U.tagName),Je=Nu(oe.tagName);return In[U.namespaceURI]?U.namespaceURI===Yt?oe.namespaceURI===jt?Ce==="svg":oe.namespaceURI===fi?Ce==="svg"&&(Je==="annotation-xml"||ei[Je]):!!Ee[Ce]:U.namespaceURI===fi?oe.namespaceURI===jt?Ce==="math":oe.namespaceURI===Yt?Ce==="math"&&ps[Je]:!!Fe[Ce]:U.namespaceURI===jt?oe.namespaceURI===Yt&&!ps[Je]||oe.namespaceURI===fi&&!ei[Je]?!1:!Fe[Ce]&&(js[Ce]||!Ee[Ce]):!!(Bt==="application/xhtml+xml"&&In[U.namespaceURI]):!1},rt=function(U){du(t.removed,{element:U});try{I(U).removeChild(U)}catch{E(U)}},En=function(U,oe){try{du(t.removed,{attribute:oe.getAttributeNode(U),from:oe})}catch{du(t.removed,{attribute:null,from:oe})}if(oe.removeAttribute(U),U==="is")if(yt||Tt)try{rt(oe)}catch{}else try{oe.setAttribute(U,"")}catch{}},ue=function(U){let oe=null,Ce=null;if(nt)U="<remove></remove>"+U;else{const Nt=H2(U,/^[\r\n\t ]+/);Ce=Nt&&Nt[0]}Bt==="application/xhtml+xml"&&It===jt&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const Je=R?R.createHTML(U):U;if(It===jt)try{oe=new b().parseFromString(Je,Bt)}catch{}if(!oe||!oe.documentElement){oe=O.createDocument(It,"template",null);try{oe.documentElement.innerHTML=pr?z:Je}catch{}}const et=oe.body||oe.documentElement;return U&&Ce&&et.insertBefore(n.createTextNode(Ce),et.childNodes[0]||null),It===jt?ae.call(oe,Ye?"html":"body")[0]:Ye?oe.documentElement:et},pt=function(U){return H.call(U.ownerDocument||U,U,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},wt=function(U){return U instanceof v&&(typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||!(U.attributes instanceof g)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function")},Ue=function(U){return typeof d=="function"&&U instanceof d};function be(Me,U,oe){hu(Me,Ce=>{Ce.call(t,U,oe,ze)})}const Lt=function(U){let oe=null;if(be(V.beforeSanitizeElements,U,null),wt(U))return rt(U),!0;const Ce=ve(U.nodeName);if(be(V.uponSanitizeElement,U,{tagName:Ce,allowedTags:P}),$e&&U.hasChildNodes()&&!Ue(U.firstElementChild)&&li(/<[/\w!]/g,U.innerHTML)&&li(/<[/\w!]/g,U.textContent)||$e&&U.namespaceURI===jt&&Ce==="style"&&Ue(U.firstElementChild)||U.nodeType===pu.progressingInstruction||$e&&U.nodeType===pu.comment&&li(/<[/\w]/g,U.data))return rt(U),!0;if(me[Ce]||!(ke.tagCheck instanceof Function&&ke.tagCheck(Ce))&&!P[Ce]){if(!me[Ce]&&pi(Ce)&&(ie.tagNameCheck instanceof RegExp&&li(ie.tagNameCheck,Ce)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ce)))return!1;if(ut&&!kn[Ce]){const Je=I(U)||U.parentNode,et=L(U)||U.childNodes;if(et&&Je){const Nt=et.length;for(let sn=Nt-1;sn>=0;--sn){const rn=x(et[sn],!0);Je.insertBefore(rn,A(U))}}}return rt(U),!0}return U instanceof p&&!Gt(U)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&li(/<\/no(script|embed|frames)/i,U.innerHTML)?(rt(U),!0):(Se&&U.nodeType===pu.text&&(oe=U.textContent,hu([$,N,D],Je=>{oe=yl(oe,Je," ")}),U.textContent!==oe&&(du(t.removed,{element:U.cloneNode()}),U.textContent=oe)),be(V.afterSanitizeElements,U,null),!1)},Pt=function(U,oe,Ce){if(ye[oe]||Be&&(oe==="id"||oe==="name")&&(Ce in n||Ce in Rt))return!1;const Je=Q[oe]||ke.attributeCheck instanceof Function&&ke.attributeCheck(oe,U);if(!(ct&&!ye[oe]&&li(T,oe))){if(!(Le&&li(k,oe))){if(!Je||ye[oe]){if(!(pi(U)&&(ie.tagNameCheck instanceof RegExp&&li(ie.tagNameCheck,U)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(U))&&(ie.attributeNameCheck instanceof RegExp&&li(ie.attributeNameCheck,oe)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(oe,U))||oe==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&li(ie.tagNameCheck,Ce)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ce))))return!1}else if(!fr[oe]){if(!li(J,yl(Ce,B,""))){if(!((oe==="src"||oe==="xlink:href"||oe==="href")&&U!=="script"&&F2(Ce,"data:")===0&&bi[U])){if(!(je&&!li(j,yl(Ce,B,"")))){if(Ce)return!1}}}}}}return!0},ti=st({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),pi=function(U){return!ti[Nu(U)]&&li(q,U)},Yi=function(U){be(V.beforeSanitizeAttributes,U,null);const{attributes:oe}=U;if(!oe||wt(U))return;const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let Je=oe.length;for(;Je--;){const et=oe[Je],{name:Nt,namespaceURI:sn,value:rn}=et,ge=ve(Nt),Ie=rn;let Pe=Nt==="value"?Ie:wF(Ie);if(Ce.attrName=ge,Ce.attrValue=Pe,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,be(V.uponSanitizeAttribute,U,Ce),Pe=Ce.attrValue,_e&&(ge==="id"||ge==="name")&&F2(Pe,We)!==0&&(En(Nt,U),Pe=We+Pe),$e&&li(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){En(Nt,U);continue}if(ge==="attributename"&&H2(Pe,"href")){En(Nt,U);continue}if(Ce.forceKeepAttr)continue;if(!Ce.keepAttr){En(Nt,U);continue}if(!Ae&&li(/\/>/i,Pe)){En(Nt,U);continue}Se&&hu([$,N,D],an=>{Pe=yl(Pe,an," ")});const xt=ve(U.nodeName);if(!Pt(xt,ge,Pe)){En(Nt,U);continue}if(R&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!sn)switch(S.getAttributeType(xt,ge)){case"TrustedHTML":{Pe=R.createHTML(Pe);break}case"TrustedScriptURL":{Pe=R.createScriptURL(Pe);break}}if(Pe!==Ie)try{sn?U.setAttributeNS(sn,Nt,Pe):U.setAttribute(Nt,Pe),wt(U)?rt(U):$2(t.removed)}catch{En(Nt,U)}}be(V.afterSanitizeAttributes,U,null)},mi=function(U){let oe=null;const Ce=pt(U);for(be(V.beforeSanitizeShadowDOM,U,null);oe=Ce.nextNode();)be(V.uponSanitizeShadowNode,oe,null),Lt(oe),Yi(oe),oe.content instanceof o&&mi(oe.content);be(V.afterSanitizeShadowDOM,U,null)};return t.sanitize=function(Me){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},oe=null,Ce=null,Je=null,et=null;if(pr=!Me,pr&&(Me="<!-->"),typeof Me!="string"&&!Ue(Me)&&(Me=TF(Me),typeof Me!="string"))throw Xd("dirty is not a string, aborting");if(!t.isSupported)return Me;if(ht||Re(U),t.removed=[],typeof Me=="string"&&(ds=!1),ds){const rn=Me.nodeName;if(typeof rn=="string"){const ge=ve(rn);if(!P[ge]||me[ge])throw Xd("root node is forbidden and cannot be sanitized in-place")}}else if(Me instanceof d)oe=ue("<!---->"),Ce=oe.ownerDocument.importNode(Me,!0),Ce.nodeType===pu.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?oe=Ce:oe.appendChild(Ce);else{if(!yt&&!Se&&!Ye&&Me.indexOf("<")===-1)return R&&nn?R.createHTML(Me):Me;if(oe=ue(Me),!oe)return yt?null:nn?z:""}oe&&nt&&rt(oe.firstChild);const Nt=pt(ds?Me:oe);for(;Je=Nt.nextNode();)Lt(Je),Yi(Je),Je.content instanceof o&&mi(Je.content);if(ds)return Me;if(yt){if(Se){oe.normalize();let rn=oe.innerHTML;hu([$,N,D],ge=>{rn=yl(rn,ge," ")}),oe.innerHTML=rn}if(Tt)for(et=F.call(oe.ownerDocument);oe.firstChild;)et.appendChild(oe.firstChild);else et=oe;return(Q.shadowroot||Q.shadowrootmode)&&(et=fe.call(i,et,!0)),et}let sn=Ye?oe.outerHTML:oe.innerHTML;return Ye&&P["!doctype"]&&oe.ownerDocument&&oe.ownerDocument.doctype&&oe.ownerDocument.doctype.name&&li(rR,oe.ownerDocument.doctype.name)&&(sn="<!DOCTYPE "+oe.ownerDocument.doctype.name+`>
|
|
173
|
-
`+sn),Se&&hu([$,N,D],rn=>{sn=yl(sn,rn," ")}),R&&nn?R.createHTML(sn):sn},t.setConfig=function(){let Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(Me),ht=!0},t.clearConfig=function(){ze=null,ht=!1},t.isValidAttribute=function(Me,U,oe){ze||Re({});const Ce=ve(Me),Je=ve(U);return Pt(Ce,Je,oe)},t.addHook=function(Me,U){typeof U=="function"&&du(V[Me],U)},t.removeHook=function(Me,U){if(U!==void 0){const oe=bF(V[Me],U);return oe===-1?void 0:SF(V[Me],oe,1)[0]}return $2(V[Me])},t.removeHooks=function(Me){V[Me]=[]},t.removeAllHooks=function(){V=X2()},t}var $u=aR(),z_,Z2;function HF(){if(Z2)return z_;Z2=1;function e(W){return W instanceof Map?W.clear=W.delete=W.set=function(){throw new Error("map is read-only")}:W instanceof Set&&(W.add=W.clear=W.delete=function(){throw new Error("set is read-only")}),Object.freeze(W),Object.getOwnPropertyNames(W).forEach(ce=>{const ve=W[ce],ze=typeof ve;(ze==="object"||ze==="function")&&!Object.isFrozen(ve)&&e(ve)}),W}class t{constructor(ce){ce.data===void 0&&(ce.data={}),this.data=ce.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(W){return W.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(W,...ce){const ve=Object.create(null);for(const ze in W)ve[ze]=W[ze];return ce.forEach(function(ze){for(const Rt in ze)ve[Rt]=ze[Rt]}),ve}const r="</span>",o=W=>!!W.scope,c=(W,{prefix:ce})=>{if(W.startsWith("language:"))return W.replace("language:","language-");if(W.includes(".")){const ve=W.split(".");return[`${ce}${ve.shift()}`,...ve.map((ze,Rt)=>`${ze}${"_".repeat(Rt+1)}`)].join(" ")}return`${ce}${W}`};class d{constructor(ce,ve){this.buffer="",this.classPrefix=ve.classPrefix,ce.walk(this)}addText(ce){this.buffer+=n(ce)}openNode(ce){if(!o(ce))return;const ve=c(ce.scope,{prefix:this.classPrefix});this.span(ve)}closeNode(ce){o(ce)&&(this.buffer+=r)}value(){return this.buffer}span(ce){this.buffer+=`<span class="${ce}">`}}const p=(W={})=>{const ce={children:[]};return Object.assign(ce,W),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 ve=p({scope:ce});this.add(ve),this.stack.push(ve)}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,ve){return typeof ve=="string"?ce.addText(ve):ve.children&&(ce.openNode(ve),ve.children.forEach(ze=>this._walk(ce,ze)),ce.closeNode(ve)),ce}static _collapse(ce){typeof ce!="string"&&ce.children&&(ce.children.every(ve=>typeof ve=="string")?ce.children=[ce.children.join("")]:ce.children.forEach(ve=>{f._collapse(ve)}))}}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,ve){const ze=ce.root;ve&&(ze.scope=`language:${ve}`),this.add(ze)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function v(W){return W?typeof W=="string"?W:W.source:null}function b(W){return x("(?=",W,")")}function S(W){return x("(?:",W,")*")}function w(W){return x("(?:",W,")?")}function x(...W){return W.map(ve=>v(ve)).join("")}function E(W){const ce=W[W.length-1];return typeof ce=="object"&&ce.constructor===Object?(W.splice(W.length-1,1),ce):{}}function A(...W){return"("+(E(W).capture?"":"?:")+W.map(ze=>v(ze)).join("|")+")"}function L(W){return new RegExp(W.toString()+"|").exec("").length-1}function I(W,ce){const ve=W&&W.exec(ce);return ve&&ve.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function z(W,{joinWith:ce}){let ve=0;return W.map(ze=>{ve+=1;const Rt=ve;let St=v(ze),Re="";for(;St.length>0;){const Ee=R.exec(St);if(!Ee){Re+=St;break}Re+=St.substring(0,Ee.index),St=St.substring(Ee.index+Ee[0].length),Ee[0][0]==="\\"&&Ee[1]?Re+="\\"+String(Number(Ee[1])+Rt):(Re+=Ee[0],Ee[0]==="("&&ve++)}return Re}).map(ze=>`(${ze})`).join(ce)}const O=/\b\B/,H="[a-zA-Z]\\w*",F="[a-zA-Z_]\\w*",ae="\\b\\d+(\\.\\d+)?",fe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",V="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",N=(W={})=>{const ce=/^#![ ]*\//;return W.binary&&(W.begin=x(ce,/.*\b/,W.binary,/\b.*/)),i({scope:"meta",begin:ce,end:/$/,relevance:0,"on:begin":(ve,ze)=>{ve.index!==0&&ze.ignoreMatch()}},W)},D={begin:"\\\\[\\s\\S]",relevance:0},T={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},k={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/},B=function(W,ce,ve={}){const ze=i({scope:"comment",begin:W,end:ce,contains:[]},ve);ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Rt=A("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ze.contains.push({begin:x(/[ ]+/,"(",Rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ze},q=B("//","$"),J=B("/\\*","\\*/"),P=B("#","$"),X={scope:"number",begin:ae,relevance:0},Q={scope:"number",begin:fe,relevance:0},Y={scope:"number",begin:V,relevance:0},ie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},me={scope:"title",begin:H,relevance:0},ye={scope:"title",begin:F,relevance:0},ke={begin:"\\.\\s*"+F,relevance:0};var ct=Object.freeze({__proto__:null,APOS_STRING_MODE:T,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:Y,BINARY_NUMBER_RE:V,COMMENT:B,C_BLOCK_COMMENT_MODE:J,C_LINE_COMMENT_MODE:q,C_NUMBER_MODE:Q,C_NUMBER_RE:fe,END_SAME_AS_BEGIN:function(W){return Object.assign(W,{"on:begin":(ce,ve)=>{ve.data._beginMatch=ce[1]},"on:end":(ce,ve)=>{ve.data._beginMatch!==ce[1]&&ve.ignoreMatch()}})},HASH_COMMENT_MODE:P,IDENT_RE:H,MATCH_NOTHING_RE:O,METHOD_GUARD:ke,NUMBER_MODE:X,NUMBER_RE:ae,PHRASAL_WORDS_MODE:j,QUOTE_STRING_MODE:k,REGEXP_MODE:ie,RE_STARTERS_RE:$,SHEBANG:N,TITLE_MODE:me,UNDERSCORE_IDENT_RE:F,UNDERSCORE_TITLE_MODE:ye});function je(W,ce){W.input[W.index-1]==="."&&ce.ignoreMatch()}function Ae(W,ce){W.className!==void 0&&(W.scope=W.className,delete W.className)}function Se(W,ce){ce&&W.beginKeywords&&(W.begin="\\b("+W.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",W.__beforeBegin=je,W.keywords=W.keywords||W.beginKeywords,delete W.beginKeywords,W.relevance===void 0&&(W.relevance=0))}function $e(W,ce){Array.isArray(W.illegal)&&(W.illegal=A(...W.illegal))}function Ye(W,ce){if(W.match){if(W.begin||W.end)throw new Error("begin & end are not supported with match");W.begin=W.match,delete W.match}}function ht(W,ce){W.relevance===void 0&&(W.relevance=1)}const nt=(W,ce)=>{if(!W.beforeMatch)return;if(W.starts)throw new Error("beforeMatch cannot be used with starts");const ve=Object.assign({},W);Object.keys(W).forEach(ze=>{delete W[ze]}),W.keywords=ve.keywords,W.begin=x(ve.beforeMatch,b(ve.begin)),W.starts={relevance:0,contains:[Object.assign(ve,{endsParent:!0})]},W.relevance=0,delete ve.beforeMatch},yt=["of","and","for","in","not","or","if","then","parent","list","value"],Tt="keyword";function nn(W,ce,ve=Tt){const ze=Object.create(null);return typeof W=="string"?Rt(ve,W.split(" ")):Array.isArray(W)?Rt(ve,W):Object.keys(W).forEach(function(St){Object.assign(ze,nn(W[St],ce,St))}),ze;function Rt(St,Re){ce&&(Re=Re.map(Ee=>Ee.toLowerCase())),Re.forEach(function(Ee){const Fe=Ee.split("|");ze[Fe[0]]=[St,Be(Fe[0],Fe[1])]})}}function Be(W,ce){return ce?Number(ce):_e(W)?0:1}function _e(W){return yt.includes(W.toLowerCase())}const We={},ut=W=>{console.error(W)},ds=(W,...ce)=>{console.log(`WARN: ${W}`,...ce)},Fn=(W,ce)=>{We[`${W}/${ce}`]||(console.log(`Deprecated as of ${W}. ${ce}`),We[`${W}/${ce}`]=!0)},kn=new Error;function Ni(W,ce,{key:ve}){let ze=0;const Rt=W[ve],St={},Re={};for(let Ee=1;Ee<=ce.length;Ee++)Re[Ee+ze]=Rt[Ee],St[Ee+ze]=!0,ze+=L(ce[Ee-1]);W[ve]=Re,W[ve]._emit=St,W[ve]._multi=!0}function bi(W){if(Array.isArray(W.begin)){if(W.skip||W.excludeBegin||W.returnBegin)throw ut("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),kn;if(typeof W.beginScope!="object"||W.beginScope===null)throw ut("beginScope must be object"),kn;Ni(W,W.begin,{key:"beginScope"}),W.begin=z(W.begin,{joinWith:""})}}function Ki(W){if(Array.isArray(W.end)){if(W.skip||W.excludeEnd||W.returnEnd)throw ut("skip, excludeEnd, returnEnd not compatible with endScope: {}"),kn;if(typeof W.endScope!="object"||W.endScope===null)throw ut("endScope must be object"),kn;Ni(W,W.end,{key:"endScope"}),W.end=z(W.end,{joinWith:""})}}function fr(W){W.scope&&typeof W.scope=="object"&&W.scope!==null&&(W.beginScope=W.scope,delete W.scope)}function Vi(W){fr(W),typeof W.beginScope=="string"&&(W.beginScope={_wrap:W.beginScope}),typeof W.endScope=="string"&&(W.endScope={_wrap:W.endScope}),bi(W),Ki(W)}function fi(W){function ce(Re,Ee){return new RegExp(v(Re),"m"+(W.case_insensitive?"i":"")+(W.unicodeRegex?"u":"")+(Ee?"g":""))}class ve{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ee,Fe){Fe.position=this.position++,this.matchIndexes[this.matchAt]=Fe,this.regexes.push([Fe,Ee]),this.matchAt+=L(Ee)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ee=this.regexes.map(Fe=>Fe[1]);this.matcherRe=ce(z(Ee,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ee){this.matcherRe.lastIndex=this.lastIndex;const Fe=this.matcherRe.exec(Ee);if(!Fe)return null;const Gt=Fe.findIndex((En,ue)=>ue>0&&En!==void 0),rt=this.matchIndexes[Gt];return Fe.splice(0,Gt),Object.assign(Fe,rt)}}class ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ee){if(this.multiRegexes[Ee])return this.multiRegexes[Ee];const Fe=new ve;return this.rules.slice(Ee).forEach(([Gt,rt])=>Fe.addRule(Gt,rt)),Fe.compile(),this.multiRegexes[Ee]=Fe,Fe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ee,Fe){this.rules.push([Ee,Fe]),Fe.type==="begin"&&this.count++}exec(Ee){const Fe=this.getMatcher(this.regexIndex);Fe.lastIndex=this.lastIndex;let Gt=Fe.exec(Ee);if(this.resumingScanAtSamePosition()&&!(Gt&&Gt.index===this.lastIndex)){const rt=this.getMatcher(0);rt.lastIndex=this.lastIndex+1,Gt=rt.exec(Ee)}return Gt&&(this.regexIndex+=Gt.position+1,this.regexIndex===this.count&&this.considerAll()),Gt}}function Rt(Re){const Ee=new ze;return Re.contains.forEach(Fe=>Ee.addRule(Fe.begin,{rule:Fe,type:"begin"})),Re.terminatorEnd&&Ee.addRule(Re.terminatorEnd,{type:"end"}),Re.illegal&&Ee.addRule(Re.illegal,{type:"illegal"}),Ee}function St(Re,Ee){const Fe=Re;if(Re.isCompiled)return Fe;[Ae,Ye,Vi,nt].forEach(rt=>rt(Re,Ee)),W.compilerExtensions.forEach(rt=>rt(Re,Ee)),Re.__beforeBegin=null,[Se,$e,ht].forEach(rt=>rt(Re,Ee)),Re.isCompiled=!0;let Gt=null;return typeof Re.keywords=="object"&&Re.keywords.$pattern&&(Re.keywords=Object.assign({},Re.keywords),Gt=Re.keywords.$pattern,delete Re.keywords.$pattern),Gt=Gt||/\w+/,Re.keywords&&(Re.keywords=nn(Re.keywords,W.case_insensitive)),Fe.keywordPatternRe=ce(Gt,!0),Ee&&(Re.begin||(Re.begin=/\B|\b/),Fe.beginRe=ce(Fe.begin),!Re.end&&!Re.endsWithParent&&(Re.end=/\B|\b/),Re.end&&(Fe.endRe=ce(Fe.end)),Fe.terminatorEnd=v(Fe.end)||"",Re.endsWithParent&&Ee.terminatorEnd&&(Fe.terminatorEnd+=(Re.end?"|":"")+Ee.terminatorEnd)),Re.illegal&&(Fe.illegalRe=ce(Re.illegal)),Re.contains||(Re.contains=[]),Re.contains=[].concat(...Re.contains.map(function(rt){return jt(rt==="self"?Re:rt)})),Re.contains.forEach(function(rt){St(rt,Fe)}),Re.starts&&St(Re.starts,Ee),Fe.matcher=Rt(Fe),Fe}if(W.compilerExtensions||(W.compilerExtensions=[]),W.contains&&W.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return W.classNameAliases=i(W.classNameAliases||{}),St(W)}function Yt(W){return W?W.endsWithParent||Yt(W.starts):!1}function jt(W){return W.variants&&!W.cachedVariants&&(W.cachedVariants=W.variants.map(function(ce){return i(W,{variants:null},ce)})),W.cachedVariants?W.cachedVariants:Yt(W)?i(W,{starts:W.starts?i(W.starts):null}):Object.isFrozen(W)?i(W):W}var It="11.11.1";class pr extends Error{constructor(ce,ve){super(ce),this.name="HTMLInjectionError",this.html=ve}}const In=n,fs=i,ei=Symbol("nomatch"),ps=7,js=function(W){const ce=Object.create(null),ve=Object.create(null),ze=[];let Rt=!0;const St="Could not find the language '{}', did you forget to load/include a language module?",Re={disableAutodetect:!0,name:"Plain text",contains:[]};let Ee={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function Fe(ge){return Ee.noHighlightRe.test(ge)}function Gt(ge){let Ie=ge.className+" ";Ie+=ge.parentNode?ge.parentNode.className:"";const Pe=Ee.languageDetectRe.exec(Ie);if(Pe){const xt=U(Pe[1]);return xt||(ds(St.replace("{}",Pe[1])),ds("Falling back to no-highlight mode for this block.",ge)),xt?Pe[1]:"no-highlight"}return Ie.split(/\s+/).find(xt=>Fe(xt)||U(xt))}function rt(ge,Ie,Pe){let xt="",an="";typeof Ie=="object"?(xt=ge,Pe=Ie.ignoreIllegals,an=Ie.language):(Fn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Fn("10.7.0",`Please use highlight(code, options) instead.
|
|
174
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),an=ge,xt=Ie),Pe===void 0&&(Pe=!0);const gi={code:xt,language:an};sn("before:highlight",gi);const Xi=gi.result?gi.result:En(gi.language,gi.code,Pe);return Xi.code=gi.code,sn("after:highlight",Xi),Xi}function En(ge,Ie,Pe,xt){const an=Object.create(null);function gi(xe,Oe){return xe.keywords[Oe]}function Xi(){if(!Ke.keywords){Tn.addText(Mt);return}let xe=0;Ke.keywordPatternRe.lastIndex=0;let Oe=Ke.keywordPatternRe.exec(Mt),Qe="";for(;Oe;){Qe+=Mt.substring(xe,Oe.index);const mt=ni.case_insensitive?Oe[0].toLowerCase():Oe[0],un=gi(Ke,mt);if(un){const[ms,oc]=un;if(Tn.addText(Qe),Qe="",an[mt]=(an[mt]||0)+1,an[mt]<=ps&&(Zr+=oc),ms.startsWith("_"))Qe+=Oe[0];else{const xh=ni.classNameAliases[ms]||ms;Zi(Oe[0],xh)}}else Qe+=Oe[0];xe=Ke.keywordPatternRe.lastIndex,Oe=Ke.keywordPatternRe.exec(Mt)}Qe+=Mt.substring(xe),Tn.addText(Qe)}function Mi(){if(Mt==="")return;let xe=null;if(typeof Ke.subLanguage=="string"){if(!ce[Ke.subLanguage]){Tn.addText(Mt);return}xe=En(Ke.subLanguage,Mt,!0,wh[Ke.subLanguage]),wh[Ke.subLanguage]=xe._top}else xe=pt(Mt,Ke.subLanguage.length?Ke.subLanguage:null);Ke.relevance>0&&(Zr+=xe.relevance),Tn.__addSublanguage(xe._emitter,xe.language)}function Kt(){Ke.subLanguage!=null?Mi():Xi(),Mt=""}function Zi(xe,Oe){xe!==""&&(Tn.startScope(Oe),Tn.addText(xe),Tn.endScope())}function bh(xe,Oe){let Qe=1;const mt=Oe.length-1;for(;Qe<=mt;){if(!xe._emit[Qe]){Qe++;continue}const un=ni.classNameAliases[xe[Qe]]||xe[Qe],ms=Oe[Qe];un?Zi(ms,un):(Mt=ms,Xi(),Mt=""),Qe++}}function jo(xe,Oe){return xe.scope&&typeof xe.scope=="string"&&Tn.openNode(ni.classNameAliases[xe.scope]||xe.scope),xe.beginScope&&(xe.beginScope._wrap?(Zi(Mt,ni.classNameAliases[xe.beginScope._wrap]||xe.beginScope._wrap),Mt=""):xe.beginScope._multi&&(bh(xe.beginScope,Oe),Mt="")),Ke=Object.create(xe,{parent:{value:Ke}}),Ke}function sc(xe,Oe,Qe){let mt=I(xe.endRe,Qe);if(mt){if(xe["on:end"]){const un=new t(xe);xe["on:end"](Oe,un),un.isMatchIgnored&&(mt=!1)}if(mt){for(;xe.endsParent&&xe.parent;)xe=xe.parent;return xe}}if(xe.endsWithParent)return sc(xe.parent,Oe,Qe)}function Io(xe){return Ke.matcher.regexIndex===0?(Mt+=xe[0],1):(Jr=!0,0)}function Pp(xe){const Oe=xe[0],Qe=xe.rule,mt=new t(Qe),un=[Qe.__beforeBegin,Qe["on:begin"]];for(const ms of un)if(ms&&(ms(xe,mt),mt.isMatchIgnored))return Io(Oe);return Qe.skip?Mt+=Oe:(Qe.excludeBegin&&(Mt+=Oe),Kt(),!Qe.returnBegin&&!Qe.excludeBegin&&(Mt=Oe)),jo(Qe,xe),Qe.returnBegin?0:Oe.length}function Oi(xe){const Oe=xe[0],Qe=Ie.substring(xe.index),mt=sc(Ke,xe,Qe);if(!mt)return ei;const un=Ke;Ke.endScope&&Ke.endScope._wrap?(Kt(),Zi(Oe,Ke.endScope._wrap)):Ke.endScope&&Ke.endScope._multi?(Kt(),bh(Ke.endScope,xe)):un.skip?Mt+=Oe:(un.returnEnd||un.excludeEnd||(Mt+=Oe),Kt(),un.excludeEnd&&(Mt=Oe));do Ke.scope&&Tn.closeNode(),!Ke.skip&&!Ke.subLanguage&&(Zr+=Ke.relevance),Ke=Ke.parent;while(Ke!==mt.parent);return mt.starts&&jo(mt.starts,xe),un.returnEnd?0:Oe.length}function rc(){const xe=[];for(let Oe=Ke;Oe!==ni;Oe=Oe.parent)Oe.scope&&xe.unshift(Oe.scope);xe.forEach(Oe=>Tn.openNode(Oe))}let Ua={};function Bo(xe,Oe){const Qe=Oe&&Oe[0];if(Mt+=xe,Qe==null)return Kt(),0;if(Ua.type==="begin"&&Oe.type==="end"&&Ua.index===Oe.index&&Qe===""){if(Mt+=Ie.slice(Oe.index,Oe.index+1),!Rt){const mt=new Error(`0 width match regex (${ge})`);throw mt.languageName=ge,mt.badRule=Ua.rule,mt}return 1}if(Ua=Oe,Oe.type==="begin")return Pp(Oe);if(Oe.type==="illegal"&&!Pe){const mt=new Error('Illegal lexeme "'+Qe+'" for mode "'+(Ke.scope||"<unnamed>")+'"');throw mt.mode=Ke,mt}else if(Oe.type==="end"){const mt=Oi(Oe);if(mt!==ei)return mt}if(Oe.type==="illegal"&&Qe==="")return Mt+=`
|
|
175
|
-
`,1;if(ac>1e5&&ac>Oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Mt+=Qe,Qe.length}const ni=U(ge);if(!ni)throw ut(St.replace("{}",ge)),new Error('Unknown language: "'+ge+'"');const Sh=fi(ni);let Po="",Ke=xt||Sh;const wh={},Tn=new Ee.__emitter(Ee);rc();let Mt="",Zr=0,mr=0,ac=0,Jr=!1;try{if(ni.__emitTokens)ni.__emitTokens(Ie,Tn);else{for(Ke.matcher.considerAll();;){ac++,Jr?Jr=!1:Ke.matcher.considerAll(),Ke.matcher.lastIndex=mr;const xe=Ke.matcher.exec(Ie);if(!xe)break;const Oe=Ie.substring(mr,xe.index),Qe=Bo(Oe,xe);mr=xe.index+Qe}Bo(Ie.substring(mr))}return Tn.finalize(),Po=Tn.toHTML(),{language:ge,value:Po,relevance:Zr,illegal:!1,_emitter:Tn,_top:Ke}}catch(xe){if(xe.message&&xe.message.includes("Illegal"))return{language:ge,value:In(Ie),illegal:!0,relevance:0,_illegalBy:{message:xe.message,index:mr,context:Ie.slice(mr-100,mr+100),mode:xe.mode,resultSoFar:Po},_emitter:Tn};if(Rt)return{language:ge,value:In(Ie),illegal:!1,relevance:0,errorRaised:xe,_emitter:Tn,_top:Ke};throw xe}}function ue(ge){const Ie={value:In(ge),illegal:!1,relevance:0,_top:Re,_emitter:new Ee.__emitter(Ee)};return Ie._emitter.addText(ge),Ie}function pt(ge,Ie){Ie=Ie||Ee.languages||Object.keys(ce);const Pe=ue(ge),xt=Ie.filter(U).filter(Ce).map(Kt=>En(Kt,ge,!1));xt.unshift(Pe);const an=xt.sort((Kt,Zi)=>{if(Kt.relevance!==Zi.relevance)return Zi.relevance-Kt.relevance;if(Kt.language&&Zi.language){if(U(Kt.language).supersetOf===Zi.language)return 1;if(U(Zi.language).supersetOf===Kt.language)return-1}return 0}),[gi,Xi]=an,Mi=gi;return Mi.secondBest=Xi,Mi}function wt(ge,Ie,Pe){const xt=Ie&&ve[Ie]||Pe;ge.classList.add("hljs"),ge.classList.add(`language-${xt}`)}function Ue(ge){let Ie=null;const Pe=Gt(ge);if(Fe(Pe))return;if(sn("before:highlightElement",{el:ge,language:Pe}),ge.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ge);return}if(ge.children.length>0&&(Ee.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(ge)),Ee.throwUnescapedHTML))throw new pr("One of your code blocks includes unescaped HTML.",ge.innerHTML);Ie=ge;const xt=Ie.textContent,an=Pe?rt(xt,{language:Pe,ignoreIllegals:!0}):pt(xt);ge.innerHTML=an.value,ge.dataset.highlighted="yes",wt(ge,Pe,an.language),ge.result={language:an.language,re:an.relevance,relevance:an.relevance},an.secondBest&&(ge.secondBest={language:an.secondBest.language,relevance:an.secondBest.relevance}),sn("after:highlightElement",{el:ge,result:an,text:xt})}function be(ge){Ee=fs(Ee,ge)}const Lt=()=>{pi(),Fn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Pt(){pi(),Fn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ti=!1;function pi(){function ge(){pi()}if(document.readyState==="loading"){ti||window.addEventListener("DOMContentLoaded",ge,!1),ti=!0;return}document.querySelectorAll(Ee.cssSelector).forEach(Ue)}function Yi(ge,Ie){let Pe=null;try{Pe=Ie(W)}catch(xt){if(ut("Language definition for '{}' could not be registered.".replace("{}",ge)),Rt)ut(xt);else throw xt;Pe=Re}Pe.name||(Pe.name=ge),ce[ge]=Pe,Pe.rawDefinition=Ie.bind(null,W),Pe.aliases&&oe(Pe.aliases,{languageName:ge})}function mi(ge){delete ce[ge];for(const Ie of Object.keys(ve))ve[Ie]===ge&&delete ve[Ie]}function Me(){return Object.keys(ce)}function U(ge){return ge=(ge||"").toLowerCase(),ce[ge]||ce[ve[ge]]}function oe(ge,{languageName:Ie}){typeof ge=="string"&&(ge=[ge]),ge.forEach(Pe=>{ve[Pe.toLowerCase()]=Ie})}function Ce(ge){const Ie=U(ge);return Ie&&!Ie.disableAutodetect}function Je(ge){ge["before:highlightBlock"]&&!ge["before:highlightElement"]&&(ge["before:highlightElement"]=Ie=>{ge["before:highlightBlock"](Object.assign({block:Ie.el},Ie))}),ge["after:highlightBlock"]&&!ge["after:highlightElement"]&&(ge["after:highlightElement"]=Ie=>{ge["after:highlightBlock"](Object.assign({block:Ie.el},Ie))})}function et(ge){Je(ge),ze.push(ge)}function Nt(ge){const Ie=ze.indexOf(ge);Ie!==-1&&ze.splice(Ie,1)}function sn(ge,Ie){const Pe=ge;ze.forEach(function(xt){xt[Pe]&&xt[Pe](Ie)})}function rn(ge){return Fn("10.7.0","highlightBlock will be removed entirely in v12.0"),Fn("10.7.0","Please use highlightElement now."),Ue(ge)}Object.assign(W,{highlight:rt,highlightAuto:pt,highlightAll:pi,highlightElement:Ue,highlightBlock:rn,configure:be,initHighlighting:Lt,initHighlightingOnLoad:Pt,registerLanguage:Yi,unregisterLanguage:mi,listLanguages:Me,getLanguage:U,registerAliases:oe,autoDetection:Ce,inherit:fs,addPlugin:et,removePlugin:Nt}),W.debugMode=function(){Rt=!1},W.safeMode=function(){Rt=!0},W.versionString=It,W.regex={concat:x,lookahead:b,either:A,optional:w,anyNumberOfTimes:S};for(const ge in ct)typeof ct[ge]=="object"&&e(ct[ge]);return Object.assign(W,ct),W},Bt=js({});return Bt.newInstance=()=>js({}),z_=Bt,Bt.HighlightJS=Bt,Bt.default=Bt,z_}var FF=HF();const ks=vb(FF);function J2(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(d);const p={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},v={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],A={match:/(\/[a-z._-]+)+/},L=["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"],R=["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"],z=["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:E,built_in:[...L,...I,"set","shopt",...R,...z]},contains:[S,e.SHEBANG(),w,v,o,c,A,d,p,f,g,n]}}const Q2="[A-Za-z$_][0-9A-Za-z$_]*",UF=["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"],WF=["true","false","null","undefined","NaN","Infinity"],oR=["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"],lR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],cR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],GF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qF=[].concat(cR,oR,lR);function ek(e){const t=e.regex,n=(B,{after:q})=>{const J="</"+B[0].slice(1);return B.input.indexOf(J,q)!==-1},i=Q2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,q)=>{const J=B[0].length+B.index,P=B.input[J];if(P==="<"||P===","){q.ignoreMatch();return}P===">"&&(n(B,{after:J})||q.ignoreMatch());let X;const Q=B.input.substring(J);if(X=Q.match(/^\s*=/)){q.ignoreMatch();return}if((X=Q.match(/^\s+extends\s+/))&&X.index===0){q.ignoreMatch();return}}},d={$pattern:Q2,keyword:UF,literal:WF,built_in:qF,"variable.language":GF},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},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},L={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,{match:/\$\d+/},v];b.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const R=[].concat(L,b.contains),z=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(R)}]),O={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:z},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...oR,...lR]}},ae={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(B){return t.concat("(?!",B.join("|"),")")}const N={match:t.concat(/\b/,$([...cR,"super","import"].map(B=>`${B}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:z,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ae,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,L,{match:/\$\d+/},v,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,e.REGEXP_MODE,{className:"function",begin:k,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:z}]}]},{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:[O,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},N,V,H,T,{match:/\$[(.]/}]}}function KF(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function tk(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},v=e.inherit(f,{contains:[]}),b=e.inherit(g,{contains:[]});f.contains.push(b),g.contains.push(v);let S=[n,p];return[f,g,v,b].forEach(A=>{A.contains=A.contains.concat(S)}),S=S.concat(f,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,o,f,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,p,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function nk(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},g={begin:/\{\{/,relevance:0},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]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},A={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,x,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,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[A]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,A,v]}]}}const np="[A-Za-z$_][0-9A-Za-z$_]*",uR=["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"],hR=["true","false","null","undefined","NaN","Infinity"],dR=["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"],fR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],pR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],mR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],gR=[].concat(pR,dR,fR);function VF(e){const t=e.regex,n=(B,{after:q})=>{const J="</"+B[0].slice(1);return B.input.indexOf(J,q)!==-1},i=np,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,q)=>{const J=B[0].length+B.index,P=B.input[J];if(P==="<"||P===","){q.ignoreMatch();return}P===">"&&(n(B,{after:J})||q.ignoreMatch());let X;const Q=B.input.substring(J);if(X=Q.match(/^\s*=/)){q.ignoreMatch();return}if((X=Q.match(/^\s+extends\s+/))&&X.index===0){q.ignoreMatch();return}}},d={$pattern:np,keyword:uR,literal:hR,built_in:gR,"variable.language":mR},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},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},L={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,{match:/\$\d+/},v];b.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const R=[].concat(L,b.contains),z=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(R)}]),O={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:z},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...dR,...fR]}},ae={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(B){return t.concat("(?!",B.join("|"),")")}const N={match:t.concat(/\b/,$([...pR,"super","import"].map(B=>`${B}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:z,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ae,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,L,{match:/\$\d+/},v,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,e.REGEXP_MODE,{className:"function",begin:k,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:z}]}]},{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:[O,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},N,V,H,T,{match:/\$[(.]/}]}}function ik(e){const t=e.regex,n=VF(e),i=np,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},c={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:np,keyword:uR.concat(p),literal:hR,built_in:gR.concat(r),"variable.language":mR},g={className:"meta",begin:"@"+i},v=(x,E,A)=>{const L=x.contains.findIndex(I=>I.label===E);if(L===-1)throw new Error("can not find mode to replace");x.contains.splice(L,1,A)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(g);const b=n.contains.find(x=>x.scope==="attr"),S=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,S]),n.contains=n.contains.concat([g,o,c,S]),v(n,"shebang",e.SHEBANG()),v(n,"use_strict",d);const w=n.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const YF=/\[\[wiki:([^\]]+)\]\]/g,XF=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,ZF=/^(\S[^:]*?):[ \t]*(.*)$/,JF=new nR({gfm:!0,breaks:!1}),sk={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},$_=dU();function sh(e,t={}){const{entries:n,content:i}=tU(e),r=sU(i,t.resolveWikiLink),o=JF.parse(r,{async:!1}),c=iU(n),d=$u.sanitize(c+o,sk),p=new DOMParser().parseFromString(d,"text/html");return aU(p,t.omitDuplicateTitle),rU(p),oU(p),cU(p),{html:$u.sanitize(p.body.innerHTML,sk),toc:uU(p)}}function QF(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function eU(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new TextDecoder().decode(n)}function tU(e){const t=XF.exec(e);return t?{entries:nU(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function nU(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=ZF.exec(i);if(r){const[,d="",p=""]=r;t.push({key:d.trim(),value:p.trim()});continue}const o=t[t.length-1];if(!o)continue;const c=i.trim();o.value=o.value?`${o.value} ${c}`:c}return t}function iU(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${Hu(n.key)}</dt><dd>${Hu(n.value)}</dd>`).join("")}</dl>`}function sU(e,t){return e.replace(YF,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return Hu(`[[wiki:${r}]]`);const o=t(r);if(o===null)return Hu(`[[wiki:${r}]]`);const c=Hu(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${c}</a>`})}function rU(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=mU(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function aU(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||rk(n.textContent??"")===rk(t)&&n.remove()}function oU(e){for(const t of e.querySelectorAll("pre > code")){const n=fU(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const c=e.createElement("div");c.className="diagram-block",c.setAttribute("data-mermaid-source",QF(i)),c.setAttribute("data-diagram-state","pending"),r.replaceWith(c);continue}const o=hU(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(lU(e,n||"text"),r.firstChild)}}function lU(e,t){const n=e.createElement("div");n.className="code-block-toolbar";const i=e.createElement("span");i.className="code-block-dots",i.setAttribute("aria-hidden","true");for(let c=0;c<3;c++)i.append(e.createElement("span"));const r=e.createElement("span");r.className="code-block-language",r.textContent=t;const o=e.createElement("button");return o.className="copy-code",o.type="button",o.dataset.action="copy-code",o.setAttribute("aria-label",`Copy ${t} code`),o.textContent="Copy",n.append(i,r,o),n}function cU(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";pU(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function uU(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 hU(e,t){return t&&$_.getLanguage(t)?$_.highlight(e,{language:t}).value:$_.highlightAuto(e).value}function dU(){return ks.registerLanguage("bash",J2),ks.registerLanguage("sh",J2),ks.registerLanguage("javascript",ek),ks.registerLanguage("js",ek),ks.registerLanguage("json",KF),ks.registerLanguage("markdown",tk),ks.registerLanguage("md",tk),ks.registerLanguage("python",nk),ks.registerLanguage("py",nk),ks.registerLanguage("typescript",ik),ks.registerLanguage("ts",ik),ks}function fU(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function pU(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function mU(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function rk(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Hu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const gU="modulepreload",_U=function(e){return"/console/"+e},ak={},vU=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(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(n.map(f=>{if(f=_U(f),f in ak)return;ak[f]=!0;const g=f.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":gU,g||(b.as="script"),b.crossOrigin="",b.href=f,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return r.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},yU=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",bU=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),SU=/^on/i,wU={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},ok="diagramInteractionBound",xU=/^oklch\s*\(\s*([^)]+)\s*\)$/i,CU=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Rs=[25,50,75,100,125,150,200],kU=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let H_=null;const lk=new WeakSet;let EU=0,TU=0,rh=null;function Ma(e){const t=e.trim();if(!t)return t;const n=YU(t);return n?XU(n):t}function _0(e){if(lk.has(e))return;lk.add(e),ck(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){rh&&!rh.trigger.isConnected&&Mu(!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&&ck(e)}).observe(t,{childList:!0,subtree:!0})}function ck(e){const t=e.querySelectorAll(yU);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",AU(n))}async function AU(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=eU(t)}catch{F_(e,"Invalid diagram source");return}if(!n.trim()){F_(e,"Empty diagram source");return}try{const i=await LU(),r=`mermaid-diagram-${++EU}`,{svg:o}=await i.render(r,n);e.innerHTML=RU(o),OU(e,o),DU(e),jU(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);F_(e,r)}}function F_(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function RU(e){const t=(n,i)=>{SU.test(i.attrName)&&(i.keepAttr=!1)};$u.addHook("uponSanitizeAttribute",t);try{return $u.sanitize(e,wU)}finally{$u.removeHook("uponSanitizeAttribute",t)}}async function LU(){return H_||(H_=(async()=>{const e=await vU(()=>import("./mermaid.core-C5QhuJDM.js").then(n=>n.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:NU(),themeCSS:MU(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),H_}function NU(){const e=getComputedStyle(document.documentElement),t=(x,E)=>{const A=e.getPropertyValue(x).trim();return Ma(A||E)},n=(x,E)=>e.getPropertyValue(x).trim()||E,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),c=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),p=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),v=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,c,p,Ma("oklch(70% 0.11 68)"),d,Ma("oklch(76% 0.09 205)"),o,Ma("oklch(68% 0.14 30)"),g,Ma("oklch(62% 0.08 228)"),Ma("oklch(52% 0.05 248)")],w=Object.fromEntries(kU.map((x,E)=>[x,S[E]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:v,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:v,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:d,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:v,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:v,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function MU(){const e=getComputedStyle(document.documentElement),t=(f,g)=>{const v=e.getPropertyValue(f).trim();return Ma(v||g)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),c=Ma("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
|
|
176
|
-
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
177
|
-
stroke: ${n};
|
|
178
|
-
fill: ${d};
|
|
179
|
-
}
|
|
180
|
-
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
181
|
-
stroke: ${r};
|
|
182
|
-
}
|
|
183
|
-
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
184
|
-
fill: ${p};
|
|
185
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
186
|
-
}
|
|
187
|
-
.pieCircle {
|
|
188
|
-
stroke: ${n};
|
|
189
|
-
stroke-width: 1.35px;
|
|
190
|
-
opacity: 0.96;
|
|
191
|
-
filter: drop-shadow(0 0 1.5px ${c});
|
|
192
|
-
}
|
|
193
|
-
.pieOuterCircle {
|
|
194
|
-
stroke: ${i};
|
|
195
|
-
opacity: 0.7;
|
|
196
|
-
}
|
|
197
|
-
.slice, .legend text, .pieTitleText {
|
|
198
|
-
fill: ${p};
|
|
199
|
-
paint-order: stroke;
|
|
200
|
-
stroke: ${o};
|
|
201
|
-
stroke-width: 3px;
|
|
202
|
-
stroke-linejoin: round;
|
|
203
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
204
|
-
}
|
|
205
|
-
.slice {
|
|
206
|
-
font-weight: 600;
|
|
207
|
-
letter-spacing: 0.04em;
|
|
208
|
-
font-style: italic;
|
|
209
|
-
}
|
|
210
|
-
.pieTitleText {
|
|
211
|
-
font-weight: 600;
|
|
212
|
-
letter-spacing: 0.12em;
|
|
213
|
-
font-style: italic;
|
|
214
|
-
}
|
|
215
|
-
.legend text {
|
|
216
|
-
font-weight: 500;
|
|
217
|
-
letter-spacing: 0.03em;
|
|
218
|
-
}
|
|
219
|
-
.legend rect {
|
|
220
|
-
rx: 999px;
|
|
221
|
-
ry: 999px;
|
|
222
|
-
opacity: 0.9;
|
|
223
|
-
stroke: ${o};
|
|
224
|
-
stroke-width: 1.5px;
|
|
225
|
-
paint-order: stroke;
|
|
226
|
-
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
|
|
227
|
-
}
|
|
228
|
-
`}function OU(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,r.length);for(let c=0;c<o;c++){const d=i[c],p=r[c];if(!d||!p)continue;const f=d.getAttribute("href")??d.getAttribute("xlink:href")??"",g=vR(f);g&&p.setAttribute("href",g)}}function DU(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:r,width:o,height:c}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(c)||i<0||r<0||o<=0||c<=0||t.setAttribute("viewBox",`${Ml(i)} ${Ml(r)} ${Ml(o)} ${Ml(c)}`)}function jU(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),qU(e),e.dataset[ok]!=="true"&&(e.dataset[ok]="true",e.addEventListener("click",IU),e.addEventListener("keydown",BU))}function IU(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||ip(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),_R(t))}function BU(e){if(e.key!=="Enter"&&e.key!==" "||ip(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),_R(t))}function _R(e){const t=e.querySelector("svg");if(!t)return;Mu(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++TU,o=`diagram-lightbox-title-${r}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const c=document.createElement("div");c.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const p=document.createElement("h2");p.id=o,p.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const v=Jd("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=Jd("+","Zoom in","in"),w=Jd("Fit","Fit diagram to viewport","fit"),x=Jd("Reset","Reset diagram zoom","reset");g.append(v,b,S,w,x);const E=document.createElement("div");E.className="diagram-lightbox__viewport";const A=$U(t),L=t.cloneNode(!0);L.removeAttribute("style"),FU(L,`diagram-lightbox-svg-${r}`),E.append(L),d.append(p,g,f),c.append(d,E),i.append(c),document.body.append(i);const I=new PU(E,L,b,A);v.addEventListener("click",()=>I.zoomOut()),S.addEventListener("click",()=>I.zoomIn()),w.addEventListener("click",()=>I.fit()),x.addEventListener("click",()=>I.reset());const R=UU(i),z=F=>{(F.target===i||F.target===f)&&Mu(!0)},O=F=>{if(F.key==="Escape"){F.preventDefault(),Mu(!0);return}I.handleKeyboard(F)||F.key==="Tab"&&GU(F,i)},H={dialog:i,trigger:e,inertStates:R,onClick:z,onKeyDown:O,cleanupPanZoom:()=>I.destroy()};n&&(H.onCancel=F=>{F.preventDefault(),Mu(!0)},i.addEventListener("cancel",H.onCancel),i.showModal()),i.addEventListener("click",z),document.addEventListener("keydown",O,!0),rh=H,I.fit(),f.focus()}function Jd(e,t,n){const i=document.createElement("button");return i.className="diagram-lightbox__zoom-button",i.type="button",i.dataset.zoomAction=n,i.setAttribute("aria-label",t),i.textContent=e,i}class PU{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Rs.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,Rs.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Rs.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Rs.findIndex(d=>d>r),c=o===-1?Rs.length-1:Math.max(0,o-1);this.applyZoom(c),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-n)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(Qd(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Qd(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=Qd(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Ml(this.baseSize.width*i)),this.svg.setAttribute("height",Ml(this.baseSize.height*i)),this.readout.textContent=`${n}%`}zoomAroundViewportCenter(t){const n=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,n.left+n.width/2,n.top+n.height/2)}zoomAroundPoint(t,n,i){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,c=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+n-c.left,p=this.viewport.scrollTop+i-c.top;this.applyZoom(t),this.viewport.scrollLeft=d/r*this.svgWidth-(n-c.left),this.viewport.scrollTop=p/o*this.svgHeight-(i-c.top)}onPointerDown=t=>{if(t.button!==0||ip(t.target))return;const n=t.pointerId??1;if(this.pointers.set(n,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:n},this.viewport.setPointerCapture?.(n)};onPointerMove=t=>{const n=t.pointerId??1;if(this.pointers.has(n)&&this.pointers.set(n,t),this.pinchStart&&this.pointers.size>=2){const i=this.pointerDistance()/this.pinchStart.distance,r=Qd(this.pinchStart.zoomIndex)*i;this.applyZoom(HU(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Rs.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{ip(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Rs.indexOf(200)?Rs.indexOf(100):Rs.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function zU(e){const t=uk(e.getAttribute("width")),n=uk(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=i[2],o=i[3],c=r!==void 0&&Number.isFinite(r)&&r>0?r:null,d=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??c??800,height:n??d??600}}function $U(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:zU(e)}function uk(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function Ml(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function HU(e){let t=0,n=Number.POSITIVE_INFINITY;return Rs.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function Qd(e){return Rs[e]??Rs[0]}function FU(e,t){const n=e.getAttribute("id")??"";e.setAttribute("id",t);const i=e.querySelector("style");!n||!i?.textContent||(i.textContent=i.textContent.split(`#${n}`).join(`#${t}`))}function Mu(e){const t=rh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),WU(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),rh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function UU(e){const t=[];for(const n of Array.from(document.body.children))!(n instanceof HTMLElement)||n===e||(t.push({element:n,ariaHidden:n.getAttribute("aria-hidden"),inert:n.inert}),n.inert=!0,n.setAttribute("aria-hidden","true"));return t}function WU(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 GU(e,t){const n=Array.from(t.querySelectorAll(bU)).filter(VU);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function qU(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function ip(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!KU(t)}function KU(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function VU(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function vR(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let i;try{i=new URL(t)}catch{return null}return i.origin!==window.location.origin?null:vR(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let r;try{r=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(r)?`/entry/${encodeURIComponent(r)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function YU(e){const t=xU.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",c=r.trim().split(/[\s,]+/).filter(Boolean);if(c.length!==3)return null;const[d,p,f]=c;if(!d||!p||!f)return null;const g=U_(d,1),v=U_(p,.4),b=ZU(f);if(g===null||v===null||b===null)return null;let S=1;if(i>=0){const w=U_(o,1);if(w===null)return null;S=w}return{L:g,C:v,h:b,alpha:S}}function XU(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),r=e.L,o=r+.3963377774*n+.2158037573*i,c=r-.1055613458*n-.0638541728*i,d=r-.0894841775*n-1.291485548*i,p=o**3,f=c**3,g=d**3,v=4.0767416621*p-3.3077115913*f+.2309699292*g,b=-1.2684380046*p+2.6097574011*f-.3413193965*g,S=-.0041960863*p-.7034186147*f+1.707614701*g,w=ef(W_(v)),x=ef(W_(b)),E=ef(W_(S));if(e.alpha<1){const A=ef(e.alpha);return`#${lo(w)}${lo(x)}${lo(E)}${lo(A)}`}return`#${lo(w)}${lo(x)}${lo(E)}`}function U_(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function ZU(e){const t=CU.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function W_(e){const t=Math.max(0,Math.min(1,e));return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function ef(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function lo(e){return e.toString(16).padStart(2,"0")}const JU=new Set([".png",".jpg",".jpeg",".webp",".gif"]),QU=new Set(["img.shields.io"]),eW=/^[a-z][a-z0-9+.-]*:/i;function hk(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||eW.test(n))return null;const i=yR(n);if(!i)return null;const r=iW(i);return r===null?null:sW(r,t)}function tW(e){const t=yR(e).toLowerCase();return[...JU].some(n=>t.endsWith(n))}function dk(e,t,n=null){const i=n?`${n.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${i}${t}`)}`}function nW(e){try{const t=new URL(e);return t.protocol==="https:"&&QU.has(t.hostname)}catch{return!1}}function yR(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function iW(e){try{return decodeURI(e)}catch{return null}}function sW(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),r=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${r}/${n}`,c=[];for(const d of o.split("/"))if(!(!d||d===".")){if(d===".."){if(c.length===0)return null;c.pop();continue}c.push(d)}return c.length>0?c.join("/"):null}function rW({content:e,onOpenPath:t,relativePath:n,theaterId:i,contextRelPath:r,truncated:o}){const c=y.useMemo(()=>{const b=sh(e).html,S=new DOMParser().parseFromString(b,"text/html");return G_(S.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i,contextRelPath:r}),S.body.innerHTML},[e,n,i,r]),d=y.useRef(null);y.useEffect(()=>{const b=d.current;if(!b)return;_0(b),G_(b,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,contextRelPath:r});const S=new MutationObserver(()=>G_(b,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,contextRelPath:r}));return S.observe(b,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>S.disconnect()},[c,n,i,r]);const p=y.useCallback(b=>{const S=b.target.closest('[data-action="copy-code"]');if(!S)return;const w=S.closest("pre")?.getAttribute("data-code");if(!w)return;navigator.clipboard?.writeText(w);const x=S.textContent;S.textContent="Copied",window.setTimeout(()=>{S.textContent=x},1200)},[]),f=y.useCallback(b=>{const w=b.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(b.preventDefault(),t(x))},[t]),g=y.useCallback(b=>{if(b.key!=="Enter"&&b.key!==" ")return;const w=b.target.closest("[data-fexp-open-path]");if(!w)return;const x=w.dataset.fexpOpenPath;x&&(b.preventDefault(),t(x))},[t]),v=y.useCallback(b=>{p(b),f(b)},[p,f]);return u.jsxs("div",{className:"fexp-md-wrap",children:[o&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:d,className:"markdown-body",onClick:v,onKeyDown:g,dangerouslySetInnerHTML:{__html:c}})]})}function G_(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=hk(i,t.currentRelativePath);r?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",r),n.removeAttribute("aria-disabled")):i&&!/^(https?:|mailto:|#)/i.test(i)&&(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const i=n.getAttribute("src")??"",r=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&i===dk(t.theaterId,r,t.contextRelPath)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&nW(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=hk(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&tW(o)){n.setAttribute("src",dk(t.theaterId,o,t.contextRelPath)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&aW(n)}}function aW(e){const t=e.getAttribute("alt")?.trim(),n=e.ownerDocument.createElement("span");n.className="fexp-md-blocked-image",n.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(n)}const oW=360,v0=248,y0=200,sp=160,rp=4;function lW(e){return e-y0-rp>=sp}function cW(e,t,n){const i=n-y0-rp;return i<sp?e:Math.max(sp,Math.min(i,e-t))}function uW(e){const t=y0+rp;return`minmax(0, 1fr) ${rp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function hW(e){return e?oW:null}const bR="fleet-console.file-explorer.treePaneWidth",b0={selectedPath:null,viewState:{kind:"none"}},dW={...b0,treePaneWidth:v0},SR=new Map,fk=new Map,$y=new Set;let ap=_W();function fW(e){return y.useSyncExternalStore(gW,()=>mW(e),()=>dW)}function pk(e,t){e&&CR(e,{selectedPath:t})}function Ea(e,t){e&&CR(e,{viewState:t})}function pW(e){ap=kR(e);try{localStorage.setItem(bR,String(ap))}catch{}wR()}function wR(){for(const e of $y)e()}function xR(e){return SR.get(e)??b0}function mW(e){const t=e??"__none__",n=e!=null?xR(e):b0,i=fk.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===ap)return i;const r={...n,treePaneWidth:ap};return fk.set(t,r),r}function CR(e,t){SR.set(e,{...xR(e),...t}),wR()}function gW(e){return $y.add(e),()=>{$y.delete(e)}}function _W(){try{return kR(Number(localStorage.getItem(bR)))}catch{return v0}}function kR(e){return!Number.isFinite(e)||e<=0?v0:Math.max(sp,Math.round(e))}const vW=new Set([".png",".jpg",".jpeg",".webp",".gif"]),yW={id:"file-explorer",title:"Files",icon:wW,pathAware:!0,render:e=>u.jsx(SW,{...e})};function bW(e,t){return{listFolder:async n=>{if(!e)throw new Error("no_theater");const i=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:Dy(t,n??"")})});if(!i.ok){const c=await i.json();throw new Error(c.error??"list_failed")}const r=await i.json(),o=HA(t,r);if(!o)throw new Error("context_boundary");return o}}}function SW(e){const{theaterId:t}=e,n=e.pathContext.relPath,i=fH(t,n),{selectedPath:r,viewState:o,treePaneWidth:c}=fW(i),d=y.useRef(c);d.current=c;const p=y.useRef(null),[f,g]=y.useState(!1),v=y.useMemo(()=>bW(t,n),[t,n]),b=y.useCallback(async(A,L)=>{if(!t){Ea(t,{kind:"error",message:"no_theater"});return}pk(i,A);const I=L??A.split("/").filter(Boolean).at(-1)??A,R=I.slice(I.lastIndexOf(".")).toLowerCase();if(vW.has(R)){const z=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(Dy(n,A)??"")}`:"";Ea(i,{kind:"image",relativePath:A,name:I,src:z});return}Ea(i,{kind:"loading"});try{const z=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:Dy(n,A)})});if(!z.ok){const F=await z.json();throw new Error(F.error??"read_failed")}const O=await z.json();if(O.binary){Ea(i,{kind:"binary",name:I});return}const H=HA(n,{relativePath:O.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(H===void 0)throw new Error("context_boundary");Ea(i,{kind:"code",relativePath:H,content:O.content,lang:O.lang,truncated:O.truncated})}catch(z){const O=z instanceof Error?z.message:"Unable to load file";O==="binary_file"?Ea(i,{kind:"binary",name:I}):Ea(i,{kind:"error",message:O})}},[n,i,t]),S=y.useCallback(async A=>{A.kind==="file"&&await b(A.relativePath,A.name)},[b]),w=y.useCallback(()=>{Ea(i,{kind:"none"}),pk(i,null)},[i]),x=y.useCallback(A=>{A.preventDefault();const L=p.current;if(!L)return;const I=L.getBoundingClientRect().width;if(!lW(I))return;const R=A.clientX,z=d.current;g(!0);const O=F=>{const ae=F.clientX-R,fe=cW(z,ae,I);d.current=fe,pW(fe)},H=()=>{document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",H),g(!1)};document.addEventListener("pointermove",O),document.addEventListener("pointerup",H)},[]),E=o.kind!=="none";return y.useLayoutEffect(()=>{e.requestExtraWidth?.(hW(E))},[e,E]),u.jsxs("div",{ref:p,className:`fexp-root${E?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:E?{gridTemplateColumns:uW(c)}:void 0,children:[E&&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(rW,{content:o.content,onOpenPath:b,relativePath:o.relativePath,theaterId:t,truncated:o.truncated,contextRelPath:n}),o.kind==="code"&&o.lang!=="markdown"&&u.jsx(NH,{content:o.content,lang:o.lang,truncated:o.truncated}),o.kind==="image"&&u.jsx(DH,{src:o.src,name:o.name}),o.kind==="binary"&&u.jsx(bH,{name:o.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:x,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(_H,{files:v,theaterId:t,contextKey:i,contextRelPath:n,selectedPath:r,onSelect:S},i)})]})}function wW(){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 xW={id:"file-explorer",railPanels:[yW]},CW=[xW],kW={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function EW(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(n)}return t}function ER({files:e,selectedPath:t,onSelect:n}){const i=EW(e);return u.jsx(TR,{node:i,depth:0,selectedPath:t,onSelect:n})}function TR({node:e,depth:t,selectedPath:n,onSelect:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>u.jsx(TW,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>u.jsx(AW,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function TW({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(!1),d=y.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=n*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(TR,{node:f,depth:n+1,selectedPath:i,onSelect:r})]})}function AW({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=y.useCallback(()=>i(e),[e,i]),c=t*16+12,d=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`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:kW[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 mk="fleet-console.diff.changesCollapsed",RW={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function LW(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function NW(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function MW({ctx:e,viewMode:t,selectedPath:n,subPath:i,onSelect:r,filterText:o}){const[c,d]=y.useState({kind:"loading"}),[p,f]=y.useState(0),[g,v]=y.useState(()=>NW(mk));y.useEffect(()=>{if(!e.theaterId){d({kind:"error",message:"no_theater"});return}let E=!1;return d({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:i})}).then(async A=>{if(!A.ok){const R=(await A.json()).error??"git_failed";E||d(R==="no_git_repo"||R==="git_unavailable"?{kind:"notice",reason:R}:{kind:"error",message:R});return}const L=await A.json();E||d({kind:"ok",files:L.files})}).catch(A=>{E||d({kind:"error",message:A instanceof Error?A.message:"unknown"})}),()=>{E=!0}},[e.theaterId,i,p]);const b=y.useCallback(()=>f(E=>E+1),[]),S=y.useCallback(()=>{v(E=>{const A=!E;try{localStorage.setItem(mk,A?"1":"0")}catch{}return A})},[]),w=y.useMemo(()=>c.kind==="ok"?LW(c.files,o):[],[o,c]);if(c.kind==="loading")return u.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(c.kind==="notice"){const E=c.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",A=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:E}),u.jsx("span",{className:"diff-notice-body",children:A}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:b,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:b,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(ER,{files:w,selectedPath:n,onSelect:r}):w.map(E=>u.jsx(AR,{entry:E,isSelected:E.path===n,onSelect:r},E.path))})]})})}function AR({entry:e,isSelected:t,onSelect:n}){const i=y.useCallback(()=>n(e),[e,n]),r=e.path.endsWith("/")?e.path.slice(0,-1):e.path,o=r.lastIndexOf("/"),c=o>=0?r.slice(0,o+1):"",d=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return u.jsxs("button",{type:"button",className:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":RW[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 RR(e,t){return JSON.stringify([e,t])}const Hy=12,bl=28,q_=3,OW=5,gk=["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 mu(e){return e*Hy+6}function co(e){return gk[e%gk.length]??"var(--ink-fog)"}function DW({node:e,laneCount:t,collapsed:n=!1}){const i=Math.max(t,1),r=n?10:0,o=i*Hy+r,c=mu(e.lane),d=bl/2;return u.jsxs("svg",{width:o,height:bl,viewBox:`0 0 ${o} ${bl}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(p=>u.jsx("line",{x1:mu(p),y1:0,x2:mu(p),y2:bl,stroke:co(p),strokeWidth:1.5},`pt-${p}`)),e.connectAbove&&u.jsx("line",{x1:c,y1:0,x2:c,y2:d-q_,stroke:co(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:c,y1:d+q_,x2:c,y2:bl,stroke:co(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(p=>u.jsx("line",{x1:mu(p),y1:0,x2:c,y2:d,stroke:co(p),strokeWidth:1.5,strokeLinecap:"round"},`mf-${p}`)),e.branchToLanes.map(p=>u.jsx("line",{x1:c,y1:d,x2:mu(p),y2:bl,stroke:co(p),strokeWidth:1.5,strokeLinecap:"round"},`bt-${p}`)),e.isHead&&u.jsx("circle",{cx:c,cy:d,r:OW,fill:"none",stroke:co(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:c,cy:d,r:q_,fill:co(e.lane)}),n&&u.jsx("text",{x:i*Hy+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const K_=8;function jW(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,r=0;for(let o=0;o<e.length;o++){const c=e[o],d=c.fullHash,p=[...c.parents],f=[];for(let x=0;x<t.length;x++)t[x]===d&&f.push(x);let g,v=!1;const b=[];if(f.length===0){const x=t.indexOf(null);x>=0?g=x:t.length<K_?(g=t.length,t.push(null)):(i=!0,g=K_-1,t[g]=null,v=!0)}else{g=Math.min(...f);for(const x of f)x!==g&&(b.push(x),t[x]=null)}const S=[];if(p.length===0)t[g]=null;else{t[g]=v?null:p[0]??null;for(const x of p.slice(1))if(!(t.indexOf(x)>=0)){const A=t.indexOf(null);if(A>=0)t[A]=x,S.push(A);else if(t.length<K_){const L=t.length;t.push(x),S.push(L)}else i=!0}}const w=t.map((x,E)=>({h:x,i:E})).filter(({h:x,i:E})=>x!==null&&E!==g).map(({i:x})=>x);r=Math.max(r,g,...S,...w),n.push({lane:g,isHead:c.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[g]===p[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}const IW=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 BW(e){let t="",n=0;const i=(r,o)=>`<span class="diff-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,c=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(c,n));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[n-1]??"")){const o=n;for(;n<e.length&&/[0-9.xXa-fA-F]/.test(e[n]);)n++;t+=i("number",e.slice(o,n));continue}if(/[A-Za-z_$]/.test(r)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const c=e.slice(o,n);t+=IW.has(c)?i("keyword",c):/^[A-Z]/.test(c)?i("type",c):c;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const PW=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,zW=/^diff --git a\/(.+) b\/(.+)$/;function $W(e){if(!e)return[];const t=e.split(`
|
|
229
|
-
`);t[t.length-1]===""&&t.pop();const n=[];let i=0,r=0,o=!0;for(const c of t)if(!c.startsWith("\\")){if(c.startsWith("diff --git ")){const d=zW.exec(c),p=d?.[1],f=d?.[2]??c,g=p!==void 0&&p!==f?p:void 0;n.push({kind:"file-label",text:f,oldPath:g}),o=!0;continue}if(o){if(c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("rename from ")||c.startsWith("rename to ")||c.startsWith("similarity index")||c.startsWith("dissimilarity index")){n.push({kind:"meta",text:c});continue}if(c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ "))continue;if(!c.startsWith("@@")){c!==""&&n.push({kind:"ctx",text:` ${c}`});continue}}if(c.startsWith("@@")){o=!1;const d=PW.exec(c);if(d){i=parseInt(d[1]??"0",10),r=parseInt(d[2]??"0",10);const p=d[3]?.trimEnd()??"",f=`@@ -${d[1]??""} +${d[2]??""} @@${p?` ${p.trimStart()}`:""}`;n.push({kind:"hunk-label",text:f})}else n.push({kind:"hunk-label",text:c});continue}c.startsWith("+")?n.push({kind:"add",text:c,newLine:r++}):c.startsWith("-")?n.push({kind:"del",text:c,oldLine:i++}):n.push({kind:"ctx",text:c,oldLine:i++,newLine:r++})}return n}function tf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function LR({ctx:e,file:t,mode:n,subPath:i,commit:r}){const[o,c]=y.useState({kind:"loading"});if(y.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let g=!1;return c({kind:"loading"}),r?e.api.fetch("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 b=await v.json();g||c({kind:"ok",result:b})}).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:n,subPath:i})}).then(async v=>{if(!v.ok)throw new Error((await v.json()).error??"git_failed");const b=await v.json();g||c({kind:"ok",result:b})}).catch(v=>{g||c({kind:"error",message:v instanceof Error?v.message:"unknown"})}),()=>{g=!0}},[e.api,e.theaterId,t.oldPath,t.path,n,i,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=$W(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:tf(g.text)}}):g.kind==="meta"?u.jsx("td",{colSpan:4,className:"diff-line-meta",dangerouslySetInnerHTML:{__html:tf(g.text)}}):g.kind==="file-label"?u.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:tf(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:BW(tf(g.text.length>0?g.text.slice(1):g.text))}})]})},v))})})})]})}function NR(e,t=new Date){const n=new Date(e*1e3);if(!Number.isFinite(n.getTime()))return"—";const i=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),c=Math.round((r-o)/864e5);return c===0?`Today ${i}`:c===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function S0(e){const t=[];for(const n of e.refs)if(n==="HEAD")t.push({label:"HEAD",kind:"head"});else if(n.startsWith("HEAD -> refs/heads/"))t.push({label:n.slice(19),kind:"branch"});else if(n.startsWith("HEAD -> "))t.push({label:n.slice(8),kind:"branch"});else if(n.startsWith("tag: refs/tags/"))t.push({label:n.slice(15),kind:"tag"});else if(n.startsWith("tag: "))t.push({label:n.slice(5),kind:"tag"});else if(n.startsWith("refs/remotes/")){const i=n.slice(13);i.endsWith("/HEAD")||t.push({label:i,kind:"remote"})}else n.startsWith("refs/worktrees/")?t.push({label:n.slice(15),kind:"worktree"}):n.startsWith("refs/heads/")?t.push({label:n.slice(11),kind:"branch"}):t.push({label:n,kind:"branch"});return t}const MR=140,OR=140,qr=4,DR=null;function HW({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const c=n-r-o;return c<i?DR:Math.max(i,Math.min(c,e-t))}function FW(e){const t=MR+qr;return`minmax(0, 1fr) ${qr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function UW(e){const t=OR+qr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${qr}px minmax(0, 1fr)`}function jR(e,t,n,i,r,o=qr){const c=n-r-o;return c<i?DR:Math.max(i,Math.min(c,e+t))}function WW(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${qr}px minmax(120px, 1fr)`}function GW(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${qr}px minmax(140px, 1fr)`}function IR({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",c),t.removeEventListener("blur",c)},c=()=>{r&&(r=!1,o(),i())},d=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),t.addEventListener("blur",c),d}const qW=400,BR="fleet-console.history.listPaneWidth",_k="fleet-console.history.headerHeight",vk="fleet-console.history.fileListWidth",PR="fleet-console.history.filesView",KW=360,zR=220,VW=214,YW=180;function XW(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function ZW(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.subject.toLowerCase().includes(n)||i.authorName.toLowerCase().includes(n)||i.shortHash.toLowerCase().includes(n)||i.fullHash.toLowerCase().includes(n)||i.refs.some(r=>r.toLowerCase().includes(n))||S0(i).some(r=>r.label.toLowerCase().includes(n))):e}function JW(e){return e==="Escape"}function yk({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 QW({entry:e,checkouts:t,selected:n,graphNode:i,laneCount:r,layoutCollapsed:o,onSelect:c}){const d=S0(e),p=XW(e,t);return u.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>c(e),children:[u.jsx("span",{className:"history-commit-subject",children:e.subject}),u.jsx("span",{className:"history-commit-sha",children:e.shortHash}),u.jsx("span",{className:"history-commit-time",children:NR(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(yk,{current:g.isCurrent}),f.label]},`${f.kind}:${f.label}`)}),p&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(yk,{current:p.isCurrent}),"detached"]})]}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(DW,{node:i,laneCount:r,collapsed:o})})]})}function eG({ctx:e,target:t,onSelectCommit:n,onClose:i}){const[r,o]=y.useState({kind:"loading"}),[c,d]=y.useState("details"),[p,f]=y.useState(null),[g,v]=y.useState(!1),[b,S]=y.useState(()=>Fy(_k,VW)),[w,x]=y.useState(()=>Fy(vk,YW)),[E,A]=y.useState(rG),L=y.useRef(null),I=y.useRef(null),R=y.useRef(null),z=y.useRef(b),O=y.useRef(w),H=y.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??"",subPath:e.pathContext.relPath??""}),[t.fullHash,e.theaterId,e.pathContext.relPath]);y.useEffect(()=>{let 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 V=>{if(!V.ok)throw new Error((await V.json()).error??"git_failed");return V.json()}).then(V=>{fe||(o({kind:"ok",result:V}),f(V.files[0]?.path??null))}).catch(V=>{fe||o({kind:"error",message:V instanceof Error?V.message:"unknown"})}),()=>{fe=!0}},[e.api,e.pathContext.relPath,e.theaterId,t.fullHash]),y.useEffect(()=>()=>R.current?.(),[]);const F=y.useCallback((fe,V)=>{fe.preventDefault();const $=V==="y"?L.current:I.current;if(!$)return;const N=V==="y"?z.current:O.current,D=V==="y"?fe.clientY:fe.clientX,T=V==="y"?$.getBoundingClientRect().height:$.getBoundingClientRect().width;R.current?.(),R.current=IR({documentTarget:document,windowTarget:window,onMove:k=>{const j=k,B=jR(N,(V==="y"?j.clientY:j.clientX)-D,T,120,120);B!==null&&(V==="y"?(z.current=B,S(B)):(O.current=B,x(B)))},onFinish:()=>{const k=V==="y"?z.current:O.current;try{localStorage.setItem(V==="y"?_k:vk,String(k))}catch{}R.current=null}})},[]),ae=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:V}=r.result,$=V.find(q=>q.path===p)??V[0]??null,N=V.reduce((q,J)=>q+J.additions,0),D=V.reduce((q,J)=>q+J.deletions,0),T=t.entry,k=(q,J)=>{f(q.path),J&&d("changes")},j=q=>{A(q);try{localStorage.setItem(PR,q)}catch{}},B=()=>{const q=navigator.clipboard?.writeText(t.fullHash);q&&q.then(()=>{v(!0),window.setTimeout(()=>v(!1),1200)}).catch(()=>{})};return c==="details"?u.jsxs("div",{ref:L,className:"history-details-tab",style:{gridTemplateRows:WW(b)},children:[u.jsx(tG,{meta:fe,entry:T,fullHash:t.fullHash,copied:g,onCopy:B,onParent:q=>n({fullHash:q})}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:q=>F(q,"y")}),u.jsx(bk,{files:V,selectedPath:p,additions:N,deletions:D,viewMode:E,onViewMode:j,onSelect:q=>k(q,!0)})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:I,className:"history-changes-columns",style:{gridTemplateColumns:GW(w)},children:[u.jsx(bk,{files:V,selectedPath:p,additions:N,deletions:D,viewMode:E,onViewMode:j,onSelect:q=>k(q,!1)}),u.jsx("div",{className:"history-divider",onPointerDown:q=>F(q,"x")}),$?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-diff-head",children:[u.jsx("span",{title:$.path,children:$.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":"Previous file",disabled:V.indexOf($)===0,onClick:()=>k(V[V.indexOf($)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":"Next file",disabled:V.indexOf($)===V.length-1,onClick:()=>k(V[V.indexOf($)+1],!1),children:"›"})]})]}),u.jsx(LR,{ctx:e,file:$,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=>{JW(fe.key)&&(fe.preventDefault(),i())},children:[u.jsxs("div",{className:"history-segmented",children:[u.jsx("button",{type:"button","aria-pressed":c==="details",onClick:()=>d("details"),children:"Details"}),u.jsxs("button",{type:"button","aria-pressed":c==="changes",onClick:()=>d("changes"),children:["Changes ",r.kind==="ok"&&u.jsx("span",{children:r.result.files.length})]}),u.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:i,children:"✕"})]}),ae]})}function tG({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return u.jsxs("div",{className:"history-inspector-head",children:[u.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&u.jsx("pre",{className:"history-inspector-message",children:e.body}),u.jsxs("div",{className:"history-author",children:[u.jsx("span",{className:"history-avatar",children:aG(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??NR(e.authorAt)})]}),u.jsxs("div",{className:"history-inspector-ids",children:[u.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,u.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(c=>u.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(c.full),children:["parent ",c.short]},c.full))]}),t&&u.jsx("div",{className:"history-ref-chips",children:S0(t).map(c=>u.jsx("span",{className:`history-badge history-badge--${c.kind}`,children:c.label},`${c.kind}:${c.label}`))})]})}function bk({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:c}){return u.jsxs("section",{className:"history-commit-files",children:[u.jsxs("div",{className:"history-files-title",children:[u.jsx("span",{className:"history-files-label",children:"Changed files"}),u.jsxs("span",{className:"history-files-stats",children:[e.length," ",u.jsxs("i",{children:["+",n]})," ",u.jsxs("em",{children:["−",i]})]}),u.jsxs("div",{className:"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(ER,{files:e,selectedPath:t,onSelect:c}):e.map(d=>u.jsx(AR,{entry:d,isSelected:d.path===t,onSelect:c},d.path))})]})}function nG({ctx:e}){return u.jsx(iG,{ctx:e},RR(e.theaterId,e.pathContext.relPath))}function iG({ctx:e}){const[t,n]=y.useState({kind:"loading"}),[i,r]=y.useState(null),[o,c]=y.useState(""),[d,p]=y.useState(0),[f,g]=y.useState(sG),v=y.useRef(null),b=y.useRef(null),S=y.useRef(f),w=e.pathContext.relPath??"";y.useEffect(()=>{if(!e.theaterId){n({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let L=!1;return n({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=>{L||n({kind:"ok",commits:I.commits,checkouts:I.checkouts,truncated:I.truncated??!1})}).catch(I=>{L||n({kind:"error",message:I instanceof Error?I.message:"unknown"})}),()=>{L=!0}},[e.api,e.theaterId,d,w]),y.useLayoutEffect(()=>(e.requestExtraWidth?.(i?qW:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,i]),y.useEffect(()=>()=>b.current?.(),[]);const x=y.useCallback(L=>{L.preventDefault();const I=v.current;if(!I)return;const R=S.current,z=L.clientX,O=I.getBoundingClientRect().width;b.current?.(),b.current=IR({documentTarget:document,windowTarget:window,onMove:H=>{const F=jR(R,H.clientX-z,O,zR,OR,qr);F!==null&&(S.current=F,g(F))},onFinish:()=>{try{localStorage.setItem(BR,String(S.current))}catch{}b.current=null}})},[]),E=y.useMemo(()=>t.kind==="ok"?ZW(t.commits,o):[],[o,t]),A=t.kind==="ok"?jW(E):null;return u.jsxs("div",{ref:v,className:"history-root",style:i?{gridTemplateColumns:UW(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:L=>c(L.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?`${E.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(L=>L+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&&E.length===0&&u.jsx("div",{className:"history-empty",children:"No matching items"}),t.kind==="ok"&&A&&E.map((L,I)=>u.jsx(QW,{entry:L,checkouts:t.checkouts,selected:i?.fullHash===L.fullHash,graphNode:A.nodes[I],laneCount:A.activeLaneCount,layoutCollapsed:A.collapsed,onSelect:R=>r({fullHash:R.fullHash,entry:R})},L.fullHash)),t.kind==="ok"&&(t.truncated||t.commits.length>=200)&&u.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),i&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"history-divider",onPointerDown:x}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(eG,{ctx:e,target:i,onSelectCommit:r,onClose:()=>r(null)})})]})]})}function sG(){return Fy(BR,KW,zR)}function rG(){try{const e=localStorage.getItem(PR);if(e==="list"||e==="tree")return e}catch{}return"list"}function Fy(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function aG(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}function oG(){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 lG={id:"history",title:"History",icon:()=>u.jsx(oG,{}),pathAware:!0,render:e=>u.jsx(nG,{ctx:e})},Uy=new Set;let w0={file:null};function $R(){for(const e of Uy)e()}function cG(e){return Uy.add(e),()=>{Uy.delete(e)}}function Sk(){return w0}function uG(e,t){const n=y.useSyncExternalStore(cG,Sk,Sk);return!n.file||n.file.theaterId!==e||n.file.subPath!==t?null:n.file}function hG(e,t,n){w0={file:{entry:e,subPath:t,theaterId:n}},$R()}function wk(){w0={file:null},$R()}const HR="fleet-console.diff.viewMode",FR="fleet-console.diff.listPaneWidth",dG=400,fG=248,UR=220;function pG(){try{const e=localStorage.getItem(HR);if(e==="list"||e==="tree")return e}catch{}return"list"}function mG(){try{const e=localStorage.getItem(FR),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(UR,t)}catch{}return fG}function gG(e){return e.entry.status==="U"?"untracked":"unified"}function _G({ctx:e}){const t=RR(e.theaterId,e.pathContext.relPath);return u.jsx(vG,{ctx:e},t)}function vG({ctx:e}){const[t,n]=y.useState(pG),[i,r]=y.useState(""),o=e.pathContext.relPath??"",c=uG(e.theaterId??null,o),[d,p]=y.useState(mG),f=y.useRef(d),g=y.useRef(null),[v,b]=y.useState(!1);y.useLayoutEffect(()=>()=>wk(),[]);const S=y.useCallback(L=>{e.theaterId&&hG(L,o,e.theaterId)},[e.theaterId,o]),w=y.useCallback(()=>wk(),[]),x=y.useCallback(L=>{n(L);try{localStorage.setItem(HR,L)}catch{}},[]),E=y.useCallback(L=>{L.preventDefault();const I=g.current;if(!I)return;const R=I.getBoundingClientRect().width,z=L.clientX,O=f.current;b(!0);const H=ae=>{const fe=HW({startWidth:O,dx:ae.clientX-z,containerWidth:R,listPaneMinWidth:UR,hunkPaneMinWidth:MR,dividerWidth:qr});fe!==null&&(f.current=fe,p(fe))},F=()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",F),b(!1);try{localStorage.setItem(FR,String(f.current))}catch{}};document.addEventListener("pointermove",H),document.addEventListener("pointerup",F)},[]);y.useLayoutEffect(()=>(e.requestExtraWidth?.(c?dG:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,c]);const A=c?gG(c):null;return u.jsxs("div",{ref:g,className:`diff-root${c?" has-hunk":""}${v?" is-dragging":""}`,style:c?{gridTemplateColumns:FW(d)}:void 0,children:[c&&A?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(LR,{ctx:e,file:c.entry,mode:A,subPath:c.subPath})]}):null,c?u.jsx("div",{className:"diff-divider",onPointerDown:E,"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:i,onChange:L=>r(L.target.value)}),i?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(MW,{ctx:e,viewMode:t,selectedPath:c?.entry.path??null,subPath:o,onSelect:S,filterText:i})]})]})}function yG(){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 bG={id:"diff",title:"Diff",icon:()=>u.jsx(yG,{}),pathAware:!0,render:e=>u.jsx(_G,{ctx:e})},SG={id:"diff",railPanels:[bG,lG]},wG=[SG],nf=["claude-code","codex","cursor","opencode"],xG={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},CG="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function kG({source:e,skill:t,theaterId:n,relPath:i,onCancel:r,onStarted:o,jobLog:c}){const[d,p]=y.useState(n?"project":"global"),[f,g]=y.useState(!0),[v,b]=y.useState(new Set(nf)),{status:S,start:w}=c,x=S==="running",E=S==="done",A=S==="error",L=y.useCallback(()=>{g(!0),b(new Set(nf))},[]),I=y.useCallback(z=>{g(!1),b(O=>{const H=new Set(O);return H.has(z)?H.delete(z):H.add(z),H})},[]),R=y.useCallback(()=>{const z=f?nf:Array.from(v);if(z.length===0)return;const O={source:e,skill:t,scope:d,agents:z};d==="project"&&n&&(O.theaterId=n,O.relPath=i),w("/plugins/skills/install",O),o(d)},[f,v,e,t,d,n,i,w,o]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${d==="project"?" is-active":""}`,onClick:()=>p("project"),disabled:!n||x||E,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${d==="global"?" is-active":""}`,onClick:()=>p("global"),disabled:x||E,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:L,disabled:x||E,children:"All agents"}),nf.map(z=>u.jsx("button",{type:"button",className:`skills-agent-chip${!f&&v.has(z)?" is-active":""}`,onClick:()=>I(z),disabled:x||E,children:xG[z]},z))]}),u.jsx("p",{className:"skills-permission-warning",children:CG}),!x&&!E&&!A&&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:R,disabled:!f&&v.size===0,children:"Install now"})]})]})}const EG=4e3;function WR({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:c}){const[d,p]=y.useState(!1),f=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{e==="running"&&p(!1)},[e]),y.useEffect(()=>{const E=f.current;E&&(E.scrollTop=E.scrollHeight)},[t]),y.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{p(!1),o()},EG),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,o]);const v=y.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),p(!1),o()},[o]),b=y.useCallback(()=>p(E=>!E),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",x=e==="running"?n:e==="done"?i:r;return u.jsxs("div",{className:"skills-dock",children:[d&&u.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((E,A)=>u.jsx("div",{className:"skills-dock-log-line",children:E},A)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${d?" is-open":""}`,"aria-expanded":d,onClick:b,onKeyDown:E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),b())},children:[u.jsx("span",{className:S,"aria-hidden":"true"}),u.jsx("span",{className:w,"aria-live":"polite",children:x}),e==="running"&&t.length>0&&u.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:E=>{E.stopPropagation(),v()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[c!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:E=>{E.stopPropagation(),c()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:E=>{E.stopPropagation(),v()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const TG={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},Wy=new Set;let Jn=TG;function Fa(){for(const e of Wy)e()}function AG(e){return Wy.add(e),()=>{Wy.delete(e)}}function xk(){return Jn}function x0(){return y.useSyncExternalStore(AG,xk,xk)}function sf(e){Jn={...Jn,activeTab:e},Fa()}function Ck(e){Jn={...Jn,scope:e},Fa()}function RG(e){Jn={...Jn,filterText:e},Fa()}function LG(e){Jn={...Jn,searchQuery:e},Fa()}function El(e,t){Jn={...Jn,searchResults:e,searchLoading:t},Fa()}function op(e,t){return JSON.stringify([e,t])}function Gy(e,t){return e.installedContextKey===t}function V_(e,t,n){Jn.installedContextKey===e&&(Jn={...Jn,installedList:t,installedLoading:n},Fa())}function qy(e){Jn={...Jn,installFormOpenId:e},Fa()}function NG(e){Jn={...Jn,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Fa()}const kk=750;function GR(){const[e,t]=y.useState({status:"idle",lines:[]}),n=y.useRef(null),i=y.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);y.useEffect(()=>()=>i(),[i]);const r=y.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=y.useCallback((c,d)=>{i(),t({status:"running",lines:[]}),(async()=>{const p=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).catch(()=>null);if(!p?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await p.json();let g=0;const v=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${g}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();g=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{v()},kk):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{v()},kk)})()},[i]);return{...e,start:o,reset:r}}const MG=300,kf=2;function OG(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function DG(e){if(e.length<kf){El([],!1);return}El([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){El([],!1);return}const n=await t.json();El(n.skills??[],!1)}catch{El([],!1)}}function jG({result:e,theaterId:t,relPath:n,isFormOpen:i,onInstallClick:r,onReadMore:o,onInstallStarted:c,jobLog:d}){const p={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${i?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>o(p,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:OG(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:r,children:i?"Cancel":"Install"})}),i&&u.jsx(kG,{source:e.source,skill:e.name,theaterId:t,relPath:n,onCancel:r,onStarted:f=>c(e.name,f),jobLog:d})]})}function IG({theaterId:e,relPath:t,onReadMore:n,onInstallSuccess:i}){const{searchQuery:r,searchResults:o,searchLoading:c,installFormOpenId:d}=x0(),p=y.useRef(null),f=GR(),[g,v]=y.useState(null),b=y.useCallback(w=>{if(LG(w),p.current&&clearTimeout(p.current),w.length<kf){El([],!1);return}p.current=setTimeout(()=>{DG(w)},MG)},[]);y.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),y.useEffect(()=>{f.status!=="done"||!g||(i(g.name,g.scope),qy(null),v(null))},[f.status,g,i]);const S=g?`Installing ${g.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:r,onChange:w=>b(w.target.value),"aria-label":"Search skills registry"}),c&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!c&&r.length>=kf&&o.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',r,'".']}),!c&&r.length>0&&r.length<kf&&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(jG,{result:w,theaterId:e,relPath:t,isFormOpen:d===w.id,onInstallClick:()=>qy(d===w.id?null:w.id),onReadMore:n,onInstallStarted:(x,E)=>v({name:x,scope:E}),jobLog:f},w.id))})]}),u.jsx(WR,{status:f.status,lines:f.lines,runningLabel:S,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const BG=2600;function PG({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,c]=y.useState(!1),d=y.useRef(null),p=y.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),f=y.useCallback(()=>{o?(p(),c(!1),i?.(e.name,e.scope)):(c(!0),d.current=setTimeout(()=>c(!1),BG))},[o,p,i,e.name,e.scope]);return y.useEffect(()=>()=>p(),[p]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[n&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>n(e.scope),disabled:r,children:r?"Updating…":"Update all"}),i&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:f,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function zG(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",i=await fetch(`/plugins/skills/list${n}`);return i.ok?(await i.json()).skills??[]:[]}function $G({theaterId:e,relPath:t,onReadMore:n,refreshKey:i}){const r=x0(),{scope:o,filterText:c}=r,d=op(e,t),p=Gy(r,d)?r.installedList:[],f=Gy(r,d)&&r.installedLoading,g=GR(),v=y.useRef(null),b=y.useCallback((I,R)=>{const z=op(I,R);V_(z,[],!0),zG(I,R).then(O=>V_(z,O,!1)).catch(()=>V_(z,[],!1))},[]);y.useEffect(()=>{b(e,t)},[e,t,b,i]),y.useEffect(()=>{(g.status==="done"||g.status==="error")&&b(e,t)},[g.status,e,t,b]);const S=y.useCallback(I=>{const R=I;v.current=R;const z={scope:R};R==="project"&&e&&(z.theaterId=e,z.relPath=t),g.start("/plugins/skills/update",z)},[e,t,g]),w=y.useCallback((I,R)=>{const z={scope:R,skill:I};R==="project"&&e&&(z.theaterId=e,z.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)}).then(()=>b(e,t)).catch(()=>null)},[e,t,b]),x=y.useCallback(()=>{v.current&&S(v.current)},[S]),E=o==="project"&&!e?"global":o,A=p.filter(I=>I.scope!==E?!1:c?I.name.toLowerCase().includes(c.toLowerCase()):!0),L=g.status==="running"&&v.current===E;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${E==="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${E==="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=>RG(I.target.value),"aria-label":"Filter installed skills"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&A.length===0&&u.jsx("div",{className:"skills-empty-state",children:c?"No skills match the filter.":`No ${E} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:A.map(I=>u.jsx(PG,{skill:I,onReadMore:n,onUpdate:S,onRemove:w,isUpdating:L},`${I.scope}:${I.name}`))})]}),u.jsx(WR,{status:g.status,lines:g.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:g.reset,onRetry:x})]})}function Y_(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";n&&!/^(https?:|mailto:|#)/i.test(n)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function HG({content:e}){const t=y.useMemo(()=>{const r=sh(e).html,o=new DOMParser().parseFromString(r,"text/html");return Y_(o.body),o.body.innerHTML},[e]),n=y.useRef(null);y.useEffect(()=>{const r=n.current;if(!r)return;Y_(r);const o=new MutationObserver(()=>Y_(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const i=y.useCallback(r=>{const o=r.target.closest('[data-action="copy-code"]');if(!o)return;const c=o.closest("pre")?.getAttribute("data-code");if(!c)return;navigator.clipboard?.writeText(c);const d=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=d},1200)},[]);return u.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const FG=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),UG="Skills run with full agent permissions. Review before use.";function WG(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(FG)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function GG({skill:e,isInstalled:t,theaterId:n,relPath:i,onClose:r,onInstall:o}){const[c,d]=y.useState(null),[p,f]=y.useState(!1),g=y.useRef(null),v=y.useRef(null),b=y.useRef(null);if(y.useEffect(()=>{e&&g.current===null&&(g.current=document.activeElement)},[e]),y.useEffect(()=>{if(!e){d(null);return}f(!0),d(null);let w=!1;return(async()=>{try{let E;if(t){const L={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(L.theaterId=n,L.relPath=i),E=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)})}else E=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n,relPath:i})});if(w)return;if(!E.ok){f(!1);return}const A=await E.json();w||(d(A.markdown??""),f(!1))}catch{w||f(!1)}})(),()=>{w=!0}},[e,t,n,i]),y.useEffect(()=>{if(!e)return;const w=x=>{x.key==="Escape"?(x.preventDefault(),r()):x.key==="Tab"&&WG(x,b.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]),y.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const S=e.displayPath||e.source||null;return Ha.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:r,"aria-hidden":"true",children:u.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:w=>w.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&u.jsx("span",{className:"skills-overlay-meta",children:S}),u.jsx("button",{ref: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(HG,{content:c})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:UG}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{r(),o()},children:"Install"})]})]})}),document.body)}const qG=3200;function KG({message:e,onDismiss:t}){return y.useEffect(()=>{if(!e)return;const n=setTimeout(t,qG);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function VG({ctx:e}){const t=op(e.theaterId,e.pathContext.relPath);return u.jsx(YG,{ctx:e},t)}function YG({ctx:e}){const{theaterId:t}=e,n=x0(),{activeTab:i}=n,r=op(e.theaterId,e.pathContext.relPath),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(0),v=Gy(n,r)?n.installedList.length:0;y.useLayoutEffect(()=>{NG(r)},[r]);const b=y.useCallback(E=>{c({skill:E,isInstalled:!0})},[]),S=y.useCallback((E,A)=>{c({skill:E,isInstalled:!1,registryId:A})},[]),w=y.useCallback((E,A)=>{p(`Installed ${E} to ${A}`),g(L=>L+1),sf("installed")},[]),x=y.useCallback(()=>{o?.registryId&&(qy(o.registryId),sf("find")),c(null)},[o]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>sf("installed"),children:["Installed",v>0?` ${v}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>sf("find"),children:"Find"})]}),i==="installed"?u.jsx($G,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:b,refreshKey:f}):u.jsx(IG,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,onInstallSuccess:w}),u.jsx(KG,{message:d,onDismiss:()=>p(null)}),u.jsx(GG,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>c(null),onInstall:x})]})}function XG(){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 ZG={id:"skills",title:"Skills",icon:XG,pathAware:!0,render:e=>u.jsx(VG,{ctx:e})},JG={id:"skills",railPanels:[ZG]},QG=[JG],qR=[...rH,...CW,...wG,...QG],eq=VR(qR),KR=y.createContext(eq),tq=KR.Provider;async function nq(){const e=[...qR],t=new Set(e.map(i=>i.id)),n=await iq();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await sq(i);if(r){if(t.has(r.id)){console.warn(`Skipping external plugin with duplicate id: ${r.id}`);continue}t.add(r.id),e.push(r)}}return VR(e)}function nc(){return y.useContext(KR)}async function iq(){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(aq):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function sq(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return rq(n)?n:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function VR(e){const t=new Set,n=[];for(const i of e)for(const r of i.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),n.push(r)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function rq(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function aq(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 oq=288,lq=520,gu=12;function YR({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:c,onClose:d}){const p=y.useRef(null),f=y.useRef(null);return y.useEffect(()=>{const g=b=>{p.current?.contains(b.target)||d()},v=b=>{b.key==="Escape"&&d()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",v)}},[d]),y.useEffect(()=>{f.current?.focus()},[]),u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:uq(e,t,n),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:f,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(cq,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Canvas controls"})})]}),u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((g,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(b=>{const S=b.disabled===!0||!r;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>c(g.id,b),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(g.id,b)??u.jsx(hq,{})}),u.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${g.id}:${b.id}`)})]},g.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function cq(){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 uq(e,t,n){const i=t?Math.max(gu,Math.min(e.x,t.width-oq-gu)):e.x;if(n==="above")return{left:i,bottom:Math.max(gu,e.y)};const r=t?Math.max(gu,Math.min(e.y,t.height-lq-gu)):e.y;return{left:i,top:r}}function hq(){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 XR(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const rf="directory-browser-sectors";function ZR({open:e,onCancel:t,onConfirm:n}){const[i,r]=y.useState(null),[o,c]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(""),[v,b]=y.useState(""),[S,w]=y.useState(0),x=y.useRef(null),E=y.useRef(null),A=async(T,k)=>{c(T),p(null),g(""),w(0);try{const j=await N4(T,k);r(j)}catch(j){if(j instanceof DOMException&&j.name==="AbortError")return;p(j instanceof Vt?j.message:String(j))}finally{c(null)}};y.useEffect(()=>{if(!e)return;const T=new AbortController;return A(null,T.signal),()=>T.abort()},[e]),y.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const L=i?.entries??[],I=y.useMemo(()=>{const T=f.trim().toLowerCase();return T===""?L:L.filter(k=>k.name.toLowerCase().includes(T))},[L,f]),R=y.useMemo(()=>i?dq(i):[],[i]),z=i?Ek(i.path):null,O=i?.roots??[],H=O.length>1,F=I.length===0?-1:Math.min(S,I.length-1);if(y.useEffect(()=>{if(F<0)return;E.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"nearest"})},[F,i?.path]),!e)return null;const ae=T=>{T.accessible&&o===null&&A(T.path)},fe=()=>{i?.parentPath!=null&&o===null&&A(i.parentPath)},V=()=>{const T=v.trim();T!==""&&o===null&&A(T)},$=i?.path??null,N=F>=0?`${rf}-${F}`:void 0,D=T=>{switch(T.key){case"Escape":f!==""?g(""):t();return;case"ArrowDown":T.preventDefault(),w(k=>Math.min(k+1,Math.max(I.length-1,0)));return;case"ArrowUp":T.preventDefault(),w(k=>Math.max(k-1,0));return;case"Enter":{T.preventDefault();const k=I[F];k&&ae(k);return}case"Backspace":f===""&&(T.preventDefault(),fe());return;default:return}};return Ha.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(mq,{})}),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:O.map(T=>{const k=z!=null&&Ek(T)===z;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${k?"is-active":""}`,"aria-current":k?"location":void 0,disabled:o!==null,title:T,onClick:()=>{o===null&&A(T)},onKeyDown:j=>j.stopPropagation(),children:pq(T)},T)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:R.map((T,k)=>{const j=k===R.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[k>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:()=>{A(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(_q,{})}),u.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":rf,value:f,spellCheck:!1,autoComplete:"off",onChange:T=>{g(T.target.value),w(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:fe,children:[u.jsx(vq,{}),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=>b(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Enter"&&(T.preventDefault(),V())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:v.trim()===""||o!==null,onClick:V,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:rf,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":N,ref:E,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,k)=>u.jsxs("div",{id:`${rf}-${k}`,"data-index":k,role:"option","aria-selected":k===F,"aria-disabled":!T.accessible,className:`directory-browser-sector ${k===F?"is-active":""} ${T.accessible?"":"is-locked"}`,title:T.path,onClick:()=>{w(k),ae(T)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(gq,{})}),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(yq,{})," Locked"]})]},T.path))}),i?.truncated?u.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),u.jsx("span",{className:"directory-browser-target-path",title:$??"",children:$??"Loading…"})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:$===null||o!==null,onClick:()=>$&&n($),children:"Add Theater"})]})]})]})]}),document.body)}function dq(e){if(fq(e)==="/"){const c=[{label:"/",path:"/"}];let d="";for(const p of e.path.split("/").filter(Boolean))d+=`/${p}`,c.push({label:p,path:d});return c}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",r=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const c of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${c}`,r.push({label:c,path:o});return r}function fq(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function Ek(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function pq(e){return e.replace(/[\\/]+$/,"")||e}function mq(){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 gq(){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 _q(){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 vq(){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 yq(){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 Np=[{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 Lo(e){return Np.find(t=>t.key===e)?.color??null}function Ky(e){return typeof e.accent=="string"?e.accent:null}const Tk=8,bq=260;function Ak(e){const{anchor:t,onClose:n}=e,[i,r]=y.useState(void 0);return y.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),c=t.bottom+Tk,d=c+bq>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+Tk)}:{position:"fixed",left:o,top:Math.round(c)})},[t]),y.useEffect(()=>{const o=c=>{c.key==="Escape"&&(c.preventDefault(),n())};return window.addEventListener("keydown",o),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]),Ha.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:i,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?u.jsx(Sq,{...e}):u.jsx(wq,{...e})}):null}),document.body)}function Sq({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,c]=y.useState(!1),[d,p]=y.useState(`Group ${t.length+1}`),f=y.useRef(!1),g=y.useRef(null);y.useEffect(()=>{o&&g.current?.select()},[o]);const v=()=>{const b=d.trim();b&&(i.onCreateGroup(b),r())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=Lo(b.color),w=e.groupId===b.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{i.onSetGroupId(w?null:b.id),r()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?u.jsx(xq,{}):null]},b.id)}),o?u.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:d,onChange:b=>p(b.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:b=>{b.key==="Enter"&&!f.current&&(b.preventDefault(),v()),b.key==="Escape"&&(b.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>c(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":n===null,onClick:()=>{i.onSetAccent(null),r()},children:[u.jsx("span",{}),"None"]}),u.jsx("div",{className:"group-context-menu-swatches",children:Np.map(b=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":b.label,"aria-pressed":n===b.key,onClick:()=>{i.onSetAccent(b.key),r()},children:u.jsx("span",{style:{background:b.color}})},b.key))})]})}function wq({group:e,actions:t,onClose:n}){const[i,r]=y.useState(e.name),[o,c]=y.useState(!1),d=y.useRef(!1),p=()=>{const f=i.trim();if(!f||f===e.name){n();return}t.onRename(f),n()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx("div",{className:"group-context-menu-swatches",children:Np.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),n()},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:i,onChange:f=>r(f.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:f=>{f.key==="Enter"&&!d.current&&(f.preventDefault(),p()),f.key==="Escape"&&(f.preventDefault(),n())},onBlur:p,"aria-label":"Group name"}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){c(!0);return}t.onUngroupAll(),n()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function xq(){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 Cq="fleet-console.canvas.",JR="fleet-console.formation-layout",kq=400,Vy=640,Yy=400,Rk=40,Eq=320,Tq=200,Aq=8,Rq=0,Lk=96,Lq=.25,Nq=1,X_=.2,Nk=.5,Mq=.001,Ol={x:0,y:0,zoom:1},$l={viewport:Ol,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Xy=new Set,Zy=new Set,Jy=new Set,Qy=new Set,ah=new Map,Mp=new Map;let Cn=null,za=null,Ve=$l,hi=null,or=!1,C0=Qq(),ja=Ol,Co=null,lp=0;function k0(e){return Xy.add(e),()=>{Xy.delete(e)}}function Gl(){return Ve}function Oq(e){return Cn===e?Ve:R0(e)}function eb(){return hi}function cp(){return or}function Mk(){return C0}function Dq(){return Cn}function QR(){return y.useSyncExternalStore(k0,Gl,Gl)}function eL(){return y.useSyncExternalStore(qq,Dk,Dk)}function Op(){return y.useSyncExternalStore(Wq,cp,cp)}function tL(){return y.useSyncExternalStore(Gq,Mk,Mk)}function nL(){return y.useSyncExternalStore(k0,jk,jk)}function qi(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},Xq(),E0()}function iL(e){const t=Ve.collapsedGroups.includes(e)?Ve.collapsedGroups.filter(n=>n!==e):[...Ve.collapsedGroups,e];qi({collapsedGroups:t})}function jq(e,t){if(Cn===e){iL(t);return}const n=R0(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];L0(e,{...n,collapsedGroups:i}),Ve={...Ve},E0()}function Iq(){return y.useSyncExternalStore(k0,Ik,Ik)}function tb(e){A0();const t=N0(e);ja=t,qi({viewport:t})}function sL(e){const t=N0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||Yq()){tb(t);return}ja=t,Co===null&&(Co=window.requestAnimationFrame(lL))}function nb(e,t){const n=No();qi({operations:{...Ve.operations,[e]:{...M0(t,n),zIndex:n}}})}function Bq(e,t,n=Eq,i=Tq,r=Aq,o=Rq,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)),E=x/t,A=Math.min(n,E),L=Math.min(Math.max(A,E),x),I=p,R=Math.min(i,I),z=Math.min(Math.max(R,I),p);return Array.from({length:t},(O,H)=>({x:e.x+o+H*(L+r),y:e.y+o,width:L,height:z}))}if(c==="rows"){const x=d,E=Math.min(n,x),A=Math.min(Math.max(E,x),d),L=Math.max(0,p-r*(t-1)),I=L/t,R=Math.min(i,I),z=Math.min(Math.max(R,I),L);return Array.from({length:t},(O,H)=>({x:e.x+o,y:e.y+o+H*(z+r),width:A,height:z}))}const f=Math.ceil(Math.sqrt(t)),g=Math.ceil(t/f),v=Math.max(0,p-r*(g-1)),b=v/g,S=Math.min(i,b),w=Math.min(Math.max(S,b),v);return Array.from({length:t},(x,E)=>{const A=Math.floor(E/f),L=E%f,I=A===g-1?t-(g-1)*f:f,R=Math.max(0,d-r*(I-1)),z=R/I,O=Math.min(n,z),H=Math.min(Math.max(O,z),R);return{x:e.x+o+L*(H+r),y:e.y+o+A*(w+r),width:H,height:w}})}function rL(e){Ve.minimized.includes(e)||(hi===e&&Kr(),qi({minimized:[...Ve.minimized,e]}))}function Pq(e){const t=new Set,i=[...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))];oL(Ve.minimized,i)||(hi&&i.includes(hi)&&Kr(),qi({minimized:i}))}function _u(e){if(!Ve.minimized.includes(e))return;hi===e&&Kr();const t=Ve.minimized.filter(r=>r!==e),n=Ve.operations[e];if(!n){qi({minimized:t});return}const i=No();qi({minimized:t,operations:{...Ve.operations,[e]:{...n,zIndex:i}}})}function Z_(e){qi({operationOrder:uL(e)})}function No(){return lp+=1,lp}function zq(e){const t=Ve.operations[e];if(t)return t;const n=Object.keys(Ve.operations).length,i={x:n*Rk,y:n*Rk,width:Vy,height:Yy,zIndex:No()};return qi({operations:{...Ve.operations,[e]:i}}),i}function $q(e){const t=new Set(e),n={};let i=!1;for(const[g,v]of Object.entries(Ve.operations))t.has(g)?n[g]=v:i=!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;hi&&(!t.has(hi)||r.includes(hi))&&Kr(),(i||o||d||f)&&qi({operations:n,minimized:r,operationOrder:c,operationAccent:p})}function Hq(e){Zq(),A0(),Vq(),Cn=e,Ve=e?R0(e):$l;const t=e?ah.get(e)??null:null,n=hi!==t;hi=t;const i=e?Mp.has(e):!1,r=or!==i;or=i,ja=Ve.viewport,lp=Math.max(lp,hL(Ve.operations)),E0(),n&&T0(),r&&Dp()}function Ok(e,t){const n=Ve.operations[e];if(!n)return;const i=Math.max(Lq,Math.min(Nq,Math.min((t.width-Lk)/n.width,(t.height-Lk)/n.height))),r={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};A0(),ja=r;const o=No(),c=Ve.minimized.includes(e);qi({viewport:r,operations:{...Ve.operations,[e]:{...M0(n,o),zIndex:o}},...c?{minimized:Ve.minimized.filter(d=>d!==e)}:{}})}function Fu(e){Cn&&ah.set(Cn,e);const t=Ve.minimized.filter(r=>r!==e),n=!oL(Ve.minimized,t),i=hi!==e;i&&(hi=e),n&&qi({minimized:t}),i&&T0()}function Kr(){Cn&&ah.delete(Cn),hi!==null&&(hi=null,T0())}function Fq(){if(Cn){if(or){aL();return}Kr(),Mp.set(Cn,!0),or=!0,Dp()}}function J_(e){if(Cn){if(or&&C0===e){aL();return}Uq(e),or||(Kr(),Mp.set(Cn,!0),or=!0,Dp())}}function aL(){Cn&&Mp.delete(Cn),or&&(or=!1,Dp())}function Uq(e){C0=e,eK(e),Kq()}function Wq(e){return Jy.add(e),()=>{Jy.delete(e)}}function Gq(e){return Qy.add(e),()=>{Qy.delete(e)}}function E0(){for(const e of Xy)e()}function qq(e){return Zy.add(e),()=>{Zy.delete(e)}}function Dk(){return hi}function Dp(){for(const e of Jy)e()}function Kq(){for(const e of Qy)e()}function jk(){return Ve.minimized}function Ik(){return Ve.collapsedGroups}function T0(){for(const e of Zy)e()}function Vq(){Cn&&(hi?ah.set(Cn,hi):ah.delete(Cn))}function oL(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function lL(){const e=Ve.viewport,t=ja.x-e.x,n=ja.y-e.y,i=ja.zoom-e.zoom;if(Math.abs(t)<Nk&&Math.abs(n)<Nk&&Math.abs(i)<Mq){Co=null,qi({viewport:ja});return}qi({viewport:{x:e.x+t*X_,y:e.y+n*X_,zoom:e.zoom+i*X_}}),Co=typeof window<"u"?window.requestAnimationFrame(lL):null}function A0(){Co===null||typeof window>"u"||(window.cancelAnimationFrame(Co),Co=null)}function Yq(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Xq(){!Cn||typeof window>"u"||(Jq(),za=window.setTimeout(()=>{za=null,L0(Cn,Ve)},kq))}function Zq(){!za||!Cn||typeof window>"u"||(window.clearTimeout(za),za=null,L0(Cn,Ve))}function Jq(){!za||typeof window>"u"||(window.clearTimeout(za),za=null)}function R0(e){if(typeof window>"u")return $l;try{const t=window.localStorage.getItem(cL(e));if(!t)return $l;const n=JSON.parse(t);return tK(n)}catch{return $l}}function L0(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(cL(e),JSON.stringify(t))}catch{}}function Qq(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(JR);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function eK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(JR,e)}catch{}}function cL(e){return`${Cq}${e}`}function tK(e){if(!ql(e))return $l;const t=sK(e.operations);return{viewport:N0(e.viewport),operations:t,operationOrder:uL(e.operationOrder),operationAccent:nK(e.operationAccent),minimized:iK(e.minimized,t),collapsedGroups:aK(e.collapsedGroups)}}function uL(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function nK(e){if(!ql(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function iK(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const r of e)typeof r!="string"||n.has(r)||!(r in t)||(n.add(r),i.push(r));return i}function N0(e){if(!ql(e))return Ol;const t=Uu(e.x,Ol.x),n=Uu(e.y,Ol.y),i=ib(e.zoom,Ol.zoom);return{x:t,y:n,zoom:i}}function sK(e){if(!ql(e))return{};const t={};for(const[n,i]of Object.entries(e))ql(i)&&(t[n]=M0(i,rK(t)));return t}function M0(e,t){return ql(e)?{x:Uu(e.x,0),y:Uu(e.y,0),width:ib(e.width,Vy),height:ib(e.height,Yy),zIndex:Uu(e.zIndex,t)}:{x:0,y:0,width:Vy,height:Yy,zIndex:t}}function rK(e){return hL(e)+1}function hL(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Uu(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ib(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function ql(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function aK(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function oK(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const c=o.groupId??"__ungrouped__",d=n.querySelector(`[data-drop-zone-group-id="${c}"]`);if(!d)continue;const p=d.getBoundingClientRect();if(e<p.top||e>p.bottom)continue;const f=d.querySelector(`[data-group-section-id="${c}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const g=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const v of g){const b=v.dataset.sideBarChipId;if(!b||b===i)continue;const S=v.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function lK(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const c=o.dataset.dropZoneGroupId;if(!c||c==="__ungrouped__"||c===i)continue;const d=t.indexOf(c);if(d===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return d}return t.length}function cK(e,t,n,i){const r=e.filter(g=>g!==t),o=new Set(i),c=r.filter(g=>o.has(g)),d=Math.max(0,Math.min(n,c.length));if(c.length===0)return[...r,t];if(d<c.length){const g=r.indexOf(c[d]),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 uK(e,t,n,i){const r=new Set(i),o=e.filter(v=>r.has(v)),c=o.indexOf(t),d=o.filter(v=>v!==t),p=n>c?n-1:n,f=Math.max(0,Math.min(p,d.length));d.splice(f,0,t);let g=0;return e.map(v=>r.has(v)?d[g++]??v:v)}function hK(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let r=0;return e.map(o=>i.has(o)?n[r++]??o:o)}function dK(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(d=>d!==t),o=n>i?n-1:n,c=Math.max(0,Math.min(o,r.length));return r.splice(c,0,t),r}function fK(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(c=>c!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function jp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function pK(e){const t=jp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function O0(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=y.useRef(null),o=y.useRef(!1),c=y.useRef(!1),[d,p]=y.useState(!1),[f,g]=y.useState("");y.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const v=()=>{i?.(),c.current=!1,g(t),p(!0)},b=()=>{c.current=!0,p(!1),g("")},S=()=>{if(!o.current){o.current=!0;try{n(f)}finally{o.current=!1,c.current=!0,p(!1)}}};return{renaming:d,draftTitle:f,inputRef:r,begin:v,cancel:b,commit:S,setDraftTitle:g,handleKeyDown:E=>{if(E.key==="Enter"){E.preventDefault(),S();return}E.key==="Escape"&&(E.preventDefault(),b())},handleBlur:()=>{if(c.current){c.current=!1;return}S()}}}function dL({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:c,preview:d=!1,onArmClose:p,onDisarmClose:f,onClose:g,onMinimize:v,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:E}){const A=y.useRef(!1),{operation:L,active:I,minimized:R,notificationCount:z,status:O}=e,H=mK(L),F=O0({currentTitle:H,onCommit:k=>E(L.id,k),onBegin:f}),ae=["side-bar-chip",I?"side-bar-chip--active":"",R?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",c?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),fe=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),V={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},$=()=>{if(f(),A.current){A.current=!1;return}b(L.id)},N=k=>{k.stopPropagation()},D=k=>{if(k.stopPropagation(),!n){p(L.id);return}f(),g(L.id)},T=k=>{k.preventDefault(),f(),x(L.id,k.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":L.id,className:ae,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:V,onClick:$,onContextMenu:d?void 0:T,onFocus:()=>{n||f()},onPointerDown:k=>w(k,L.id),onPointerUp:()=>{r&&(A.current=!0)},onKeyDown:k=>{if(k.target===k.currentTarget){if(!d&&k.altKey&&k.shiftKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){k.preventDefault(),S(L.id,k.key==="ArrowUp"?-1:1);return}(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),$())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(yK,{})})}),F.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:F.inputRef,value:F.draftTitle,"aria-label":`Rename operation ${H}`,onChange:k=>F.setDraftTitle(k.target.value),onKeyDown:F.handleKeyDown,onBlur:F.handleBlur,onPointerDown:k=>k.stopPropagation(),onClick:k=>k.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:F.begin,children:H}),z>0?u.jsx("span",{className:"side-bar-chip-count",children:z}):null,u.jsx("span",{className:`side-bar-chip-status ${gK(O)}`,role:"img","aria-label":Bk(O),title:Bk(O)}),!d&&!R?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:N,onClick:k=>{k.stopPropagation(),f(),v(L.id)},"aria-label":`Minimize operation ${H}`,title:"Minimize operation",children:u.jsx(vK,{})}):null,d?null:u.jsx("button",{type:"button",className:fe,onPointerDown:N,onClick:D,"aria-label":n?`Confirm close operation ${H}`:`Close operation ${H}`,title:n?"Confirm close":"Close operation",children:n?"Close?":u.jsx(_K,{})})]})}function mK(e){return e.title}function gK(e){const t=jp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function Bk(e){return pK(e)}function _K(){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 vK(){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 yK(){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 fL({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:c,onContextMenu:d,onPointerDragStart:p}){const f=y.useRef(!1),g=Lo(e.color),v=["side-bar-group-header",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={...g?{"--grp-color":g}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=E=>{E.preventDefault(),d(e.id,E.currentTarget.getBoundingClientRect())},w=E=>{E.target instanceof Element&&E.target.closest("button")||p(E,e.id)},x=()=>{i&&(f.current=!0)};return u.jsxs("div",{className:v,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:x,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>c(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:u.jsx(bK,{collapsed:n})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function bK({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 pL="fleet-console.operations.side-width",mL="fleet-console.operations.side-collapsed",gL="fleet-console.operations.theater-collapsed",Ip=280,Pk=Ip,sb=new Set,rb=new Set;let ko={width:CK(),collapsed:kK()},Ef=EK();function _L(){return y.useSyncExternalStore(TK,ab,ab)}function SK(){return y.useSyncExternalStore(RK,zk,zk)}function wK(e){const t=Math.max(Ip,Math.min(vL(),e));if(ko.width!==t){ko={...ko,width:t};try{typeof window<"u"&&localStorage.setItem(pL,String(t))}catch{}yL()}}function D0(e){if(ko.collapsed!==e){ko={...ko,collapsed:e};try{typeof window<"u"&&localStorage.setItem(mL,e?"1":"0")}catch{}yL()}}function xK(e,t){const n=new Set(Ef);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Ef.join("\0")){Ef=i;try{typeof window<"u"&&localStorage.setItem(gL,JSON.stringify(i))}catch{}AK()}}function vL(){return typeof window<"u"?Math.max(Ip,window.innerWidth-480):800}function CK(){try{if(typeof window>"u")return Pk;const e=localStorage.getItem(pL);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Ip,Math.min(vL(),t))}}catch{}return Pk}function kK(){try{return typeof window<"u"&&localStorage.getItem(mL)==="1"}catch{return!1}}function EK(){try{if(typeof window>"u")return[];const e=localStorage.getItem(gL),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function yL(){for(const e of sb)e()}function ab(){return ko}function TK(e){return sb.add(e),()=>sb.delete(e)}function AK(){for(const e of rb)e()}function zk(){return Ef}function RK(e){return rb.add(e),()=>rb.delete(e)}function bL(e,t){const n=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const r=n.find(o=>o.id===i);if(r)return r}return n.length===1?n[0]:null}const LK=1500,NK=6,$k=34,Hk=18;function MK({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:c,catalog:d,canLaunch:p,addingTheater:f,theaterError:g,renderKindIcon:v,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:x,onFocus:E,onSetAccent:A,onRename:L,onSetGroupId:I,onCreateGroup:R,onSetGroupColor:z,onRenameGroup:O,onReorderGroups:H,onUngroupAll:F,onSelectTheater:ae,onAddTheater:fe,onCancelAddTheater:V,onForgetTheater:$}){const N=y.useRef(null),D=y.useRef(null),T=_L(),{width:k,collapsed:j}=T,B=y.useRef(j),q=QR(),J=tL(),P=Op(),X=y.useRef(null),[Q,Y]=y.useState(null),[ie,me]=y.useState(null),ye=y.useRef(null),ke=y.useRef([]),Le=y.useRef([]),ct=y.useRef([]),je=y.useRef([]),Ae=y.useRef(I),Se=y.useRef(H),[$e,Ye]=y.useState(null),[ht,nt]=y.useState(null),[yt,Tt]=y.useState(!1),[nn,Be]=y.useState(!1),_e=Iq(),We=SK(),{operationStatus:ut}=Ks();y.useLayoutEffect(()=>{!B.current&&j&&XR(N.current,".command-band-sidebar-toggle"),B.current=j},[j]);const ds=n.filter(ue=>ue.theaterId===t),Fn=i.filter(ue=>ue.theaterId===t),kn=new Set(r),Ni=new Set(_e),bi=Lb(ds,q.operationOrder).map(ue=>{const pt=bL(d,ue),wt=pt?v(ue.pluginId,pt):null;return{operation:ue,active:o===ue.id,minimized:kn.has(ue.id),notificationCount:c[ue.id]?1:0,status:ut[ue.id],icon:wt}}),Ki=SL(bi,Fn,q.operationOrder),fr=Ki.some(ue=>ue.group!==null),Vi=Ki.flatMap(ue=>ue.groupId?[ue.groupId]:[]),fi=Ki.flatMap(ue=>Ni.has(ue.groupId??"")?[]:ue.entries),Yt=bi.map(ue=>ue.operation.id),jt=y.useCallback(()=>{X.current!==null&&(window.clearTimeout(X.current),X.current=null)},[]),It=y.useCallback(()=>{jt(),Y(null)},[jt]),pr=y.useCallback(ue=>{jt(),Y(ue),X.current=window.setTimeout(()=>{X.current=null,Y(null)},LK)},[jt]);y.useEffect(()=>jt,[jt]),y.useEffect(()=>{Q!==null&&(bi.some(ue=>ue.operation.id===Q)||It())},[Q,bi,It]);const In=$e?.kind==="chip"?bi.find(ue=>ue.operation.id===$e.operationId)?.operation??null:null,fs=$e?.kind==="group"?i.find(ue=>ue.id===$e.groupId)??null:null,ei=$e?.kind==="theater"?e.find(ue=>ue.id===$e.theaterId)??null:null,ps=(ue,pt)=>{const wt=fi.findIndex(Pt=>Pt.operation.id===ue);if(wt===-1)return;const Ue=Math.max(0,Math.min(fi.length-1,wt+pt));if(Ue===wt)return;const be=fi.map(Pt=>Pt.operation.id),Lt=fK(be,ue,Ue);Z_(hK(Yt,be,Lt))},js=Ki.map(ue=>({groupId:ue.groupId,entryIds:ue.entries.map(pt=>pt.operation.id)}));y.useEffect(()=>{ke.current=bi,Le.current=Yt,ct.current=js,je.current=Vi,Ae.current=I,Se.current=H});const Bt=ue=>{ye.current=ue,me(ue)},W=ie?.pointerId??null;y.useEffect(()=>{if(W===null)return;const ue=Ue=>{if(Ue.pointerId!==W)return;const be=ye.current;if(!be)return;if(Ue.buttons===0){Bt(null);return}const Lt=Math.hypot(Ue.clientX-be.startX,Ue.clientY-be.startY);if(!be.dragging&&Lt<NK)return;if(be.dragging&&Ue.preventDefault(),$K(Ue.clientY,D.current),be.kind==="chip"){const ti=oK(Ue.clientY,ct.current,D.current,be.sourceId);Bt({...be,currentY:Ue.clientY,dragging:!0,dropIndex:ti.index,dropGroupId:ti.groupId});return}const Pt=lK(Ue.clientY,je.current,D.current,be.sourceGroupId);Bt({...be,currentY:Ue.clientY,dragging:!0,dropIndex:Pt})},pt=Ue=>{if(Ue.pointerId!==W)return;const be=ye.current;if(Bt(null),!be?.dragging)return;if(be.kind==="group"){const Je=dK(je.current,be.sourceGroupId,be.dropIndex);if(Je.join("\0")===je.current.join("\0"))return;Se.current(Je);return}const{sourceId:Lt,sourceGroupId:Pt,dropIndex:ti,dropGroupId:pi}=be,Yi=ct.current,mi=Le.current;if(pi!==Pt){const et=Yi.find(Nt=>Nt.groupId===pi)?.entryIds??[];Z_(cK(mi,Lt,ti,et)),Ae.current(Lt,pi);return}const U=Yi.find(Je=>Je.groupId===Pt)?.entryIds??[],oe=U.indexOf(Lt);if(oe===-1||ti===oe)return;const Ce=uK(mi,Lt,ti,U);Z_(Ce)},wt=Ue=>{Ue.pointerId===W&&Bt(null)};return window.addEventListener("pointermove",ue),window.addEventListener("pointerup",pt),window.addEventListener("pointercancel",wt),()=>{window.removeEventListener("pointermove",ue),window.removeEventListener("pointerup",pt),window.removeEventListener("pointercancel",wt)}},[W]);const ce=(ue,pt)=>{if(ue.button!==0||ue.target instanceof Element&&ue.target.closest("button"))return;Ye(null),It();const Ue=bi.find(be=>be.operation.id===pt)?.operation.groupId??null;Bt({kind:"chip",sourceId:pt,sourceGroupId:Ue,pointerId:ue.pointerId,startX:ue.clientX,startY:ue.clientY,currentY:ue.clientY,dragging:!1,dropIndex:Yt.indexOf(pt),dropGroupId:Ue})},ve=(ue,pt)=>{ue.button===0&&(ue.target instanceof Element&&ue.target.closest("button")||Vi.includes(pt)&&(Ye(null),It(),Bt({kind:"group",sourceGroupId:pt,pointerId:ue.pointerId,startX:ue.clientX,startY:ue.clientY,currentY:ue.clientY,dragging:!1,dropIndex:Vi.indexOf(pt)})))},ze=y.useCallback(ue=>{ue.preventDefault();const pt=ue.clientX,wt=T.width;Be(!0);const Ue=Lt=>{const Pt=Lt.clientX-pt;wK(wt+Pt)},be=()=>{Be(!1),document.removeEventListener("pointermove",Ue),document.removeEventListener("pointerup",be),document.removeEventListener("pointercancel",be)};document.addEventListener("pointermove",Ue),document.addEventListener("pointerup",be),document.addEventListener("pointercancel",be)},[T.width]),Rt=()=>{D0(!j)},St=()=>{nt(null),Ye(null),Tt(!0)},Re=()=>{Tt(!1),V()},Ee=ue=>{Tt(!1),fe(ue)},Fe=ue=>{ue.defaultPrevented||(ue.preventDefault(),Ye(null),nt({anchor:{x:ue.clientX,y:ue.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Gt=y.useCallback(()=>{const ue=$e?.kind==="theater"?$e.returnFocus:null;Ye(null),ue?.focus()},[$e]),rt=(ue,pt)=>{ue.stopPropagation(),pt!==t&&ae(pt),Ye(null);const wt=ue.currentTarget.getBoundingClientRect();nt({anchor:{x:wt.right+8,y:wt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},En=ue=>{xK(ue,!We.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":nn?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${k}px`},inert:j,onContextMenu:Fe,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:St,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[u.jsx(j0,{}),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(DK,{})}),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:()=>J_("grid"),disabled:t===null,"aria-pressed":P&&J==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:u.jsx(OK,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>J_("columns"),disabled:t===null,"aria-pressed":P&&J==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:u.jsx(jK,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>J_("rows"),disabled:t===null,"aria-pressed":P&&J==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:u.jsx(IK,{})})]})]}),!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 pt=ue.id===t,wt=n.filter(be=>be.theaterId===ue.id).length,Ue=We.includes(ue.id);if(!pt){const be=Oq(ue.id),Lt=BK({theaterId:ue.id,operations:n,operationOrder:be.operationOrder,minimizedSet:new Set(be.minimized),activeOperationId:null,operationNotifications:c,operationStatus:ut,catalog:d,renderKindIcon:v});return u.jsx(PK,{theater:ue,entries:Ue?[]:Lt,groups:i.filter(Pt=>Pt.theaterId===ue.id),collapsedGroups:new Set(be.collapsedGroups),operationAccent:be.operationAccent,operationCount:wt,collapsed:Ue,onSelectTheater:ae,onFocus:E,onToggleCollapsed:En,onOpenActions:(Pt,ti)=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:Pt,returnFocus:ti})},onOpenLaunch:rt,onContextMenu:Pt=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:Pt})}},ue.id)}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":ue.id,children:[u.jsx(wL,{theater:ue,operationCount:wt,active:!0,collapsed:Ue,onSelectTheater:ae,onToggleCollapsed:En,onOpenActions:(be,Lt)=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:be,returnFocus:Lt})},onOpenLaunch:rt,onContextMenu:be=>{nt(null),Ye({kind:"theater",theaterId:ue.id,anchor:be})}}),Ue?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${ue.label} operations`,children:Ki.map(be=>{const Lt=be.groupId!==null&&Ni.has(be.groupId),Pt=be.group?Lo(be.group.color):null,ti=Pt?{"--grp-color":Pt}:void 0,pi=be.groupId?Vi.indexOf(be.groupId):-1,Yi=ie?.kind==="group"&&ie.sourceGroupId===be.groupId&&ie.dragging,mi=ie?.kind==="group"&&ie.dragging&&be.groupId!==null&&ie.sourceGroupId!==be.groupId&&ie.dropIndex===pi,Me=ie?.kind==="group"&&ie.dragging&&be.groupId!==null&&ie.sourceGroupId!==be.groupId&&pi===Vi.length-1&&ie.dropIndex===Vi.length,U=[be.groupId?"side-bar-group-section":"side-bar-ungrouped-section",mi?"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":be.groupId??"__ungrouped__",className:U,style:ti,children:[be.group?u.jsx(fL,{group:be.group,count:be.entries.length,collapsed:Lt,dragging:Yi,dragOffsetY:Yi?ie.currentY-ie.startY:0,dropTarget:mi,onToggle:iL,onContextMenu:(oe,Ce)=>Ye({kind:"group",groupId:oe,anchor:Ce}),onPointerDragStart:ve}):fr&&be.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,Lt?null:u.jsx("ol",{className:["side-bar-group-chips",ie?.kind==="chip"&&ie.dragging&&ie.dropGroupId===be.groupId&&ie.dropGroupId!==ie.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":be.groupId??"__ungrouped__","aria-label":be.group?be.group.name:"Ungrouped",children:be.entries.map(oe=>{const Ce=bi.indexOf(oe),Je=be.entries.indexOf(oe),et=q.operationAccent[oe.operation.id]??Ky(oe.operation),Nt=et?Lo(et):null;return u.jsx(dL,{entry:oe,index:Ce,isCloseArmed:Q===oe.operation.id,accentValue:Nt,dragging:ie?.kind==="chip"&&ie.sourceId===oe.operation.id&&ie.dragging,dragOffsetY:ie?.kind==="chip"&&ie.sourceId===oe.operation.id&&ie.dragging?ie.currentY-ie.startY:0,dropTarget:ie?.kind==="chip"&&ie.dragging===!0&&ie.dropGroupId===be.groupId&&ie.dropGroupId===ie.sourceGroupId&&ie.dropIndex===Je&&ie.sourceId!==oe.operation.id,onArmClose:pr,onDisarmClose:It,onClose:w,onMinimize:x,onFocus:E,onKeyboardMove:ps,onPointerDragStart:ce,onOpenAccent:(sn,rn)=>Ye({kind:"chip",operationId:sn,anchor:rn}),onRename:L},oe.operation.id)})})]},be.groupId??"__ungrouped__")})})]},ue.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:ze,onDoubleClick:Rt,"aria-hidden":"true"}),ht?Ha.createPortal(u.jsx(YR,{anchor:ht.anchor,viewportBounds:ht.viewportBounds,placement:"cursor",catalog:d,canLaunch:p,renderKindIcon:v,onLaunchKind:(ue,pt)=>{nt(null),b(ue,pt)},onClose:()=>nt(null)},`${ht.anchor.x}:${ht.anchor.y}`),document.body):null,$e?.kind==="chip"&&In?u.jsx(Ak,{kind:"chip",operation:In,groups:i.filter(ue=>ue.theaterId===In.theaterId),accentKey:q.operationAccent[In.id]??Ky(In),anchor:$e.anchor,actions:{onSetAccent:ue=>A(In.id,ue),onSetGroupId:ue=>I(In.id,ue),onCreateGroup:ue=>R(In.theaterId,ue,In.id)},onClose:()=>Ye(null)}):$e?.kind==="group"&&fs?u.jsx(Ak,{kind:"group-header",group:fs,anchor:$e.anchor,actions:{onSetColor:ue=>z(fs.id,ue),onRename:ue=>O(fs.id,ue),onUngroupAll:()=>F(fs.id)},onClose:()=>Ye(null)}):$e?.kind==="theater"&&ei?u.jsx(zK,{theater:ei,groupCount:i.filter(ue=>ue.theaterId===ei.id).length,anchor:$e.anchor,onCreateGroup:ue=>{R(ei.id,ue),Gt()},onForgetTheater:()=>{$(ei.id),Gt()},onClose:Gt}):null,u.jsx(ZR,{open:yt,onCancel:Re,onConfirm:Ee}),j?null:u.jsx(nD,{})]})}function OK(){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 DK(){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 jK(){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 IK(){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 SL(e,t,n){const i=[...t].sort((d,p)=>d.order-p.order||d.createdAt-p.createdAt),r=i.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},c=new Map(i.map(d=>[d.id,d]));for(const d of e){const p=d.operation.groupId??null;p!==null&&c.has(p)?r.find(g=>g.groupId===p)?.entries.push(d):o.entries.push(d)}return[...r,o]}function BK({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:c,catalog:d,renderKindIcon:p}){return Lb(t.filter(f=>f.theaterId===e),n).map(f=>{const g=bL(d,f),v=g?p(f.pluginId,g):null;return{operation:f,active:r===f.id,minimized:i.has(f.id),notificationCount:o[f.id]?1:0,status:c[f.id],icon:v}})}function wL({theater:e,operationCount:t,active:n,collapsed:i,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${n?" is-active":""}`,onClick:()=>r(e.id),onKeyDown:g,onContextMenu:f,"aria-current":n?"true":void 0,"aria-expanded":!i,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:xL(e.label)}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx("span",{className:"side-bar-theater-count",children:t}),u.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":i?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!i,title:i?"Expand":"Collapse",onClick:v=>{v.stopPropagation(),o(e.id)},children:u.jsx(HK,{collapsed:i})}),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(FK,{})}),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(j0,{})})]})]})}function PK({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:c,onSelectTheater:d,onFocus:p,onToggleCollapsed:f,onOpenActions:g,onOpenLaunch:v,onContextMenu:b}){const S=SL(t,n),w=S.some(x=>x.group!==null);return u.jsxs("li",{className:"side-bar-theater-section","data-theater-id":e.id,children:[u.jsx(wL,{theater:e,operationCount:o,active:!1,collapsed:c,onSelectTheater:d,onToggleCollapsed:f,onOpenActions:g,onOpenLaunch:v,onContextMenu:b}),!c&&S.length>0?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:S.map(x=>{const E=x.groupId!==null&&i.has(x.groupId),A=x.group?Lo(x.group.color):null;return u.jsxs("li",{className:x.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:A?{"--grp-color":A}:void 0,children:[x.group?u.jsx(fL,{group:x.group,count:x.entries.length,collapsed:E,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:L=>jq(e.id,L),onContextMenu:()=>{},onPointerDragStart:()=>{}}):w&&x.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,E?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":x.group?x.group.name:"Ungrouped",children:x.entries.map((L,I)=>{const R=r[L.operation.id]??Ky(L.operation),z=R?Lo(R):null;return u.jsx(dL,{entry:L,index:I,isCloseArmed:!1,accentValue:z,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:p,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},L.operation.id)})})]},x.groupId??"__ungrouped__")})}):null]})}function zK({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[c,d]=y.useState(!1),[p,f]=y.useState(`Group ${t+1}`),g=y.useRef(!1),v=y.useRef(null),b=y.useRef(null),[S,w]=y.useState(n.bottom+6);y.useLayoutEffect(()=>{const E=b.current?.getBoundingClientRect().height??0,A=window.innerHeight-E-8;w(Math.max(8,Math.min(n.bottom+6,A)))},[n,c]),y.useEffect(()=>{c&&v.current?.select()},[c]),y.useEffect(()=>{const E=A=>{A.key==="Escape"&&(A.preventDefault(),o())};return window.addEventListener("keydown",E),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",E),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const E=p.trim();E&&i(E)};return Ha.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:u.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:E=>E.stopPropagation(),children:[c?u.jsx("input",{ref:v,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:E=>f(E.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:E=>{E.key==="Enter"&&!g.current&&(E.preventDefault(),x()),E.key==="Escape"&&(E.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(j0,{})}),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(WK,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function $K(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+$k?t.scrollTop-=Hk:e>n.bottom-$k&&(t.scrollTop+=Hk)}function HK({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 FK(){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 j0(){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 xL(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>UK(i)):CL(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function UK(e){return CL(e).slice(0,1)}function CL(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function WK(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}let kL=!1;const ob=new Set;function GK(){return y.useSyncExternalStore(qK,Fk,Fk)}function Fk(){return kL}function EL(e){kL=KK(e)?e.fullscreen:!1;for(const t of ob)t()}function Uk(){EL({fullscreen:!1})}function qK(e){return ob.add(e),()=>ob.delete(e)}function KK(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Object.keys(t).length===1&&typeof t.fullscreen=="boolean"}const TL="(display-mode: fullscreen)",VK=480,YK=480,XK=()=>!0;function ZK(){return typeof window<"u"&&window.matchMedia(TL).matches}function JK(e=XK){const t=GK(),[n,i]=y.useState(ZK),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,c=y.useRef(o);c.current=o;const d=y.useRef(!1),p=y.useRef(null),[f,g]=y.useState(o),[v,b]=y.useState(!0),[S,w]=y.useState(!1),x=y.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]),E=y.useCallback(R=>{x(),!(!c.current||d.current)&&(p.current=setTimeout(()=>{p.current=null,c.current&&!d.current&&e()&&b(!1)},R))},[e,x]),A=y.useCallback(()=>{x(),c.current&&b(!0)},[x]),L=y.useCallback(()=>E(YK),[E]),I=y.useCallback(()=>{const R=!d.current;d.current=R,w(R),R&&(x(),b(!0))},[x]);return y.useEffect(()=>{const R=window.matchMedia(TL),z=()=>i(R.matches);return z(),R.addEventListener("change",z),()=>R.removeEventListener("change",z)},[]),y.useLayoutEffect(()=>(x(),g(o),b(!0),o&&!d.current&&E(VK),x),[x,o,E]),{isFullscreen:f,isVisible:v,isPinned:S,reveal:A,hideAfterLeave:L,togglePin:I}}function QK({operationsViewVisible:e}){const t=Ks(),n=nc(),i=_L(),r=x5(),o=jD(),c=tV(),d=`${c}${c==="⌘"?"":"+"}B`,p=`${c}${c==="⌘"?"⌥":"+Alt+"}B`,f=t.theaters.find(Be=>Be.id===t.activeTheaterId)??null,g=t.operations.find(Be=>Be.id===t.activeOperationId)??null,v=g?n.plugins.find(Be=>Be.id===g.pluginId):null,b=typeof g?.payload.cliId=="string"?g.payload.cliId:null,S=typeof g?.payload.cliLabel=="string"?g.payload.cliLabel:b,w=g?v?.operationKinds?.find(Be=>Be.type===g.type)??null:null,x=g&&v?.renderLaunchIcon?v.renderLaunchIcon({id:b??g.type,type:g.type,title:w?.title??g.type}):null,E=C5(),A=y.useRef(null),L=y.useRef(null),I=y.useRef(null),R=y.useRef(null),z=y.useRef(null),O=y.useRef(null),H=y.useRef({edge:!1,band:!1}),F=y.useRef(null),[ae,fe]=y.useState(!1),[V,$]=y.useState(!1),[N,D]=y.useState(null),[T,k]=y.useState(null),[j,B]=y.useState(!1),[q,J]=y.useState(null),[P,X]=y.useState(null),Q=()=>{D(null),k(null),B(!1),J(null),X(null)},Y=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",ie=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",me=y.useCallback(()=>{const Be=document.activeElement;return!(Be instanceof Node&&(z.current?.contains(Be)||O.current?.contains(Be)))&&!H.current.edge&&!H.current.band},[]),ye=JK(me),ke=O0({currentTitle:g?.title??"",onCommit:Be=>{const _e=Nx(F.current,t.activeOperationId);F.current=null,_e&&UE(_e,Be).then(()=>Wi(null)).then(cs).catch(()=>{})}});y.useEffect(()=>{!ke.renaming||Nx(F.current,t.activeOperationId)||(F.current=null,ke.cancel())},[ke,t.activeOperationId]),y.useEffect(()=>{if(!ae)return;const Be=_e=>{const We=_e.target;!(We instanceof Node)||A.current?.contains(We)||L.current?.contains(We)||fe(!1)};return document.addEventListener("pointerdown",Be),()=>document.removeEventListener("pointerdown",Be)},[ae]),y.useEffect(()=>{if(!V)return;const Be=new AbortController;return D(null),k(null),B(!0),A4(Be.signal).then(D).catch(_e=>{Be.signal.aborted||k(_e instanceof Error?_e.message:"Unable to load environment details.")}).finally(()=>{Be.signal.aborted||B(!1)}),()=>Be.abort()},[V]),y.useEffect(()=>{if(!V)return;const Be=We=>{const ut=We.target;!(ut instanceof Node)||I.current?.contains(ut)||R.current?.contains(ut)||($(!1),Q())},_e=We=>{We.key==="Escape"&&($(!1),Q(),I.current?.focus())};return document.addEventListener("pointerdown",Be),document.addEventListener("keydown",_e),()=>{document.removeEventListener("pointerdown",Be),document.removeEventListener("keydown",_e)}},[V]),y.useEffect(()=>{t.channel!=="local"&&($(!1),D(null),k(null),B(!1),J(null),X(null))},[t.channel]),y.useEffect(()=>{K4(ae,E.isPathContextDeckOpen)&&fe(!1)},[ae,E.isPathContextDeckOpen]);const Le=()=>{fe(!1),A.current?.focus()},ct=Be=>{navigator.clipboard.writeText(Be).then(()=>{J(Be),X(null)}).catch(()=>{X(Be),J(null)})},je=()=>{const Be=!ae;fe(Be),df(V4(Be,E.isPathContextDeckOpen))},Ae=Be=>{f&&S5(f.id,_e=>d5(f.id,Be,_e))},Se=()=>{g&&(F.current=g.id,ke.begin())},$e=()=>{me()&&ye.hideAfterLeave()},Ye=Be=>{const _e=Be.relatedTarget;(!(_e instanceof Node)||!z.current?.contains(_e)&&!O.current?.contains(_e))&&!H.current.edge&&!H.current.band&&ye.hideAfterLeave()},ht=()=>{H.current.edge=!0,ye.reveal()},nt=()=>{H.current.edge=!1,$e()},yt=()=>{H.current.band=!0,ye.reveal()},Tt=()=>{H.current.band=!1,$e()},nn=ye.isFullscreen&&!ye.isVisible;return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:O,type:"button",className:`command-band-edge-reveal${ye.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:ht,onPointerLeave:nt,onFocus:ye.reveal,onBlur:Ye,onKeyDown:Be=>{Be.key==="Tab"&&ye.reveal()}}),u.jsxs("header",{ref:z,className:`command-band${e?" is-operations":" is-utility"}${ye.isFullscreen?" is-fullscreen":""}${ye.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`,"--command-band-right-width":`${o}px`},"aria-hidden":nn||void 0,inert:nn||void 0,onPointerEnter:yt,onPointerLeave:Tt,onFocus:ye.reveal,onBlur:Ye,children:[u.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[u.jsx(iD,{className:"command-band-brand"}),t.channel==="local"?u.jsxs("div",{className:"command-band-environment",children:[u.jsxs("button",{ref:I,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":V,onClick:()=>{Q(),$(Be=>!Be)},children:[u.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),u.jsx("span",{className:"command-band-local-chip-label",children:Y?ie:"Local"})]}),V?u.jsx("div",{ref:R,children:u.jsx(eV,{environment:N,error:T,loading:j,copiedValue:q,copyFailedValue:P,desktopShell:Y,onCopy:ct})}):null]}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>D0(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${d})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${d})`,children:u.jsx(Wk,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:s5,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(nV,{})})]}),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:xL(f.label)}),f.label]}),g?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),ke.renaming?u.jsx("input",{ref:ke.inputRef,className:"command-band-rename-input",value:ke.draftTitle,"aria-label":`${g.title} 이름 변경`,onChange:Be=>ke.setDraftTitle(Be.target.value),onKeyDown:ke.handleKeyDown,onBlur:ke.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:Se,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&&E.pathContextHydrated&&E.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:A,type:"button",className:"command-band-context-trigger",onClick:je,"aria-expanded":ae,"aria-haspopup":"dialog",title:E.pathContextError??"Path context — shared with the Activity Rail",children:[u.jsx(sV,{}),E.pathContext.label,u.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),ae?u.jsx(_5,{ref:L,className:"command-band-context-deck",theaterId:f.id,theaterLabel:f.label,context:E.pathContext,isMutating:E.pathContextMutationInProgress,onSelect:Ae,onClose:Le}):null]})]}):null]}),u.jsxs("div",{className:"command-band-right",children:[ye.isFullscreen?u.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:ye.togglePin,"aria-label":"Pin command band","aria-pressed":ye.isPinned,title:ye.isPinned?"Unpin command band":"Pin command band",children:u.jsx(iV,{})}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:y5,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${p})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${p})`,children:u.jsx(Wk,{side:"right"})}):null]})]})]})}function eV({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:c}){if(n)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:t});if(!e)return null;const d=[["Channel",e.channel],["Version",e.version],["Reachable on",`127.0.0.1:${e.effectivePort}`],["Data root",e.dataDir],["Runtime lock",e.lockFile],...o?[["Desktop data",`${e.dataDir}/desktop`]]:[]];return u.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[u.jsx("div",{className:"command-band-environment-title",children:"Environment"}),d.map(([p,f])=>u.jsxs("div",{className:"command-band-environment-row",children:[u.jsx("span",{children:p}),u.jsx("code",{children:f}),u.jsx("button",{type:"button",onClick:()=>c(f),children:i===f?"Copied":r===f?"Copy failed":"Copy"})]},p)),u.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function tV(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function nV(){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 Wk({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 iV(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function sV(){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 rV=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function aV({state:e}){const[t,n]=y.useState(!1),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e.theaters.length>0;if(y.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const g=i.current;i.current=null,g?.focus?.()}},[e.onboardingOpen]),y.useEffect(()=>{if(!e.onboardingOpen)return;const g=v=>{t||(v.key==="Escape"?(v.preventDefault(),Jc()):v.key==="Tab"&&oV(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=()=>{n(!0)},p=()=>{n(!1)},f=async g=>{n(!1),t5();try{const v=await FE(g),b=await HE(v);n5(b)}catch(v){xv(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:Jc,"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(Gu,{ref:g=>{r.current=g},className:"commissioning-primary-action",to:"/operations",onClick:Jc,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(Gu,{className:"commissioning-secondary-link",to:"/operations",onClick:Jc,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:Jc,children:"Skip for now"})]})]}),u.jsx(ZR,{open:t,onCancel:p,onConfirm:f})]})}function oV(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(rV)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}const lV="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",Gk="operation-search-listbox",AL="__unassigned__";function cV({state:e}){const t=Jl(),[n,i]=y.useState(""),[r,o]=y.useState(0),c=y.useRef(null),d=y.useRef(null),p=y.useRef(null),f=y.useRef(new Map),g=y.useMemo(()=>IO(e),[e]),v=y.useMemo(()=>Z4(g,n),[g,n]),b=y.useMemo(()=>J4(v),[v]),S=y.useMemo(()=>qE(n),[n]),w=qk(r,v.length),x=v[w]?Kk(v[w].operationId):void 0;if(y.useEffect(()=>{if(!e.operationSearchOpen)return;p.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const L=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>c.current?.focus(),0),()=>{document.body.style.overflow=L,p.current?.focus()}},[e.operationSearchOpen]),y.useEffect(()=>{if(!e.operationSearchOpen){i(""),o(0);return}o(0)},[e.operationSearchOpen,n]),y.useEffect(()=>{if(!e.operationSearchOpen)return;const L=v[w];L&&f.current.get(L.operationId)?.scrollIntoView({block:"nearest"})},[w,v,e.operationSearchOpen]),!e.operationSearchOpen)return null;const E=L=>{Vu(L),t("/operations"),Jg()},A=L=>{if(L.key==="Escape"){L.preventDefault(),Jg();return}if(L.key==="ArrowDown"||L.key==="ArrowUp"){L.preventDefault(),o(I=>qk(I+(L.key==="ArrowDown"?1:-1),v.length));return}if(L.key==="Enter"){const I=v[w];if(!I)return;L.preventDefault(),E(I.operationId);return}L.key==="Tab"&&fV(L,d.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:L=>{L.target===L.currentTarget&&Jg()},children:u.jsxs("section",{ref:d,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:A,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(pV,{}),u.jsx("input",{ref:c,id:"operation-search-input",type:"search",value:n,onChange:L=>i(L.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":Gk,"aria-activedescendant":x,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:Gk,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:b.length>0?b.map(L=>{const I=hV(L.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:Q_(L.theaterLabel,S)}),L.entries.map(R=>{const z=v.indexOf(R),O=z===w;return u.jsxs("button",{id:Kk(R.operationId),ref:H=>{H?f.current.set(R.operationId,H):f.current.delete(R.operationId)},type:"button",className:`operation-search-result ${O?"is-active":""}`,role:"option","aria-selected":O,onMouseEnter:()=>o(z),onClick:()=>E(R.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:Q_(R.operationName,S)}),u.jsx("small",{children:uV(R)})]}),u.jsx("span",{className:"operation-search-theater",children:Q_(R.theaterLabel,S)})]},R.operationId)})]},L.theaterId??AL)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function qk(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function uV(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function hV(e){return`operation-search-heading-${RL(e??AL)}`}function Kk(e){return`operation-search-option-${RL(e)}`}function RL(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Q_(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=dV(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(u.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function dV(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const c=i.indexOf(o,n);c!==-1&&(!r||c<r.start)&&(r={start:c,end:c+o.length})}return r}function fV(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(lV)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],r=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i?.focus())}function pV(){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 mV({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),n?u.jsx("p",{className:"app-toast-message",children:n}):null]}),r?u.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function LL(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await NL(t),ML(await t.json(),t.status)}async function gV(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await NL(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new Vt(n.status,"Invalid global settings mutation response");return{state:ML(i.state,n.status)}}async function NL(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Vt(e.status,t)}function ML(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!_V(n.consoleStaticPort)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!vV(n.language))throw new Vt(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,theme:n.theme,uiFont:oO(n.uiFont),language:n.language}}function _V(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function vV(e){return e==="auto"||e==="en"||e==="ko"}const lb=new Set;let oh={loading:!1,state:null,savingField:null,error:null};function I0(){return y.useSyncExternalStore(bV,up,up)}function up(){return oh}function yV(e){Eo({loading:!1,state:e,error:null})}function bV(e){return lb.add(e),()=>{lb.delete(e)}}async function SV(e){Eo({loading:!0,error:null});try{const t=await LL(e);Eo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Eo({loading:!1,error:OL(t)})}}async function Kl(e,t){if(oh.savingField!==null)return!1;const n=oh.state,i=n?{...n,[e]:t}:null;Eo({state:i,savingField:e,error:null});try{const r=await gV({[e]:t});return Eo({state:r.state,savingField:null,error:null}),!0}catch(r){return Eo({state:n,savingField:null,error:OL(r)}),!1}}function Eo(e){oh={...oh,...e};for(const t of lb)t()}function OL(e){return e instanceof Error?e.message:String(e)}let Hl=null,Ou=0;function DL(e){Hl?.abort();const t=new AbortController,n=++Ou;return Hl=t,pO(),R4({...e,signal:t.signal}).then(i=>{n===Ou&&mO(i)}).catch(i=>{t.signal.aborted||n!==Ou||gO(i instanceof Error?i.message:String(i))}).finally(()=>{n===Ou&&(Hl=null)})}function wV(){Hl!==null&&(Hl.abort(),Hl=null,Ou+=1)}function jL(e,t=xV()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function xV(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const IL=[{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"}],ev={id:"overview",label:"Overview"},CV={id:"all-updates",label:"All updates"},kV={id:"other-updates",label:"Other updates"};function BL(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=IL.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[ev,CV]:t?[ev,...n,kV]:[ev,...n]}function EV(e,t){return t==="overview"?[]:e.sections.map(n=>({...n,items:n.items.filter(i=>t==="all-updates"||t==="other-updates"?i.product===void 0:i.product===t)})).filter(n=>n.items.length>0)}function TV(e){const t=IL.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(c=>c.product===i.id));return r.length===0?[]:[{id:i.id,label:i.label,count:r.length,summary:r[0].text}]}),n=e.sections.flatMap(i=>i.items.filter(r=>r.product===void 0));return n.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:n.length,summary:n[0].text}]}function AV(e,t){return BL(e).some(n=>n.id===t)}const RV=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),vu=10;function LV({state:e}){const t=y.useRef(null),n=y.useRef([]),i=y.useRef(null),r=y.useRef(null),o=y.useRef(new Map),[c,d]=y.useState("overview"),p=I0(),f=jL(p.state?.language??"auto"),g=e.selectedReleaseNoteKey??Sl(e.releaseNotes[0]?.version??"",0),v=e.releaseNotes.findIndex((F,ae)=>Sl(F.version,ae)===g),b=e.releaseNotes[v]??e.releaseNotes[0],S=b?Sl(b.version,v>=0?v:0):"",w=b?BL(b):[];y.useEffect(()=>{d("overview")},[S]),y.useEffect(()=>{b&&!AV(b,c)&&d("overview")},[c,b]),y.useEffect(()=>{const F=ae=>{const fe=ae.target instanceof HTMLElement?ae.target:null;if(!fe||fe.closest(".whatsnew-card"))return;const V=n.current.filter($=>$!==fe&&$.isConnected);n.current=[...V.slice(-4),fe]};return document.addEventListener("focusin",F,!0),()=>document.removeEventListener("focusin",F,!0)},[]);const x=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!x&&t.current===null&&(t.current=document.activeElement),y.useEffect(()=>{if(!e.whatsNewOpen||x)return;const F=ae=>{ae.key==="Escape"?(ae.preventDefault(),Dd()):DV(ae,r.current,d)?ae.preventDefault():ae.key==="Tab"&&OV(ae,r.current),ae.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",F,!0),()=>{window.removeEventListener("keydown",F,!0);const ae=t.current?.isConnected?t.current:[...n.current].reverse().find(fe=>fe.isConnected);t.current=null,ae?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const E=()=>{DL({force:!0,locale:f})},A=async F=>{await Kl("language",F)},L=Math.max(1,Math.ceil(e.releaseNotes.length/vu)),I=Math.min(L-1,Math.floor((v>=0?v:0)/vu)),R=I*vu,z=e.releaseNotes.slice(R,R+vu),O=F=>{const ae=I+F;if(ae<0||ae>=L)return;const fe=ae*vu,V=e.releaseNotes[fe];V&&Dx(Sl(V.version,fe))},H=F=>{d(F),requestAnimationFrame(()=>o.current.get(F)?.focus())};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Dd,"aria-label":"Close What's new"}),u.jsxs("section",{className:"whatsnew-card",ref:r,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:"What's new"}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?u.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:Dd,"aria-label":"Close What's new",children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx("select",{"aria-label":"Release version",value:S,onChange:F=>Dx(F.currentTarget.value),children:z.map((F,ae)=>{const fe=R+ae;return u.jsxs("option",{value:Sl(F.version,fe),children:[F.version==="Unreleased"?"Unreleased":`v${F.version}`,F.date?` · ${F.date}`:""]},Sl(F.version,fe))})}),L>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>O(-1),disabled:I===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[I+1," / ",L]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>O(1),disabled:I>=L-1,"aria-label":"Older versions",children:"›"})]}):null,u.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(F=>u.jsx("button",{type:"button",className:f===F?"is-active":"","aria-pressed":f===F,disabled:p.savingField==="language",onClick:()=>{A(F)},children:F==="en"?"EN":"한국어"},F))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:E,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),u.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(F=>u.jsx("button",{ref:ae=>{ae?o.current.set(F.id,ae):o.current.delete(F.id)},id:`whatsnew-tab-${F.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":F.id,"aria-selected":c===F.id,"aria-controls":"whatsnew-tab-panel",tabIndex:c===F.id?0:-1,onClick:()=>d(F.id),children:F.label},F.id))}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,u.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${c}`,children:c==="overview"?u.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:TV(b).map(F=>u.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>H(F.id),children:[u.jsx("span",{className:"whatsnew-overview-label",children:F.label}),u.jsxs("span",{className:"whatsnew-overview-count",children:[F.count," ",F.count===1?"update":"updates"]}),u.jsx("span",{className:"whatsnew-overview-summary",children:F.summary})]},F.id))}):EV(b,c).map((F,ae)=>u.jsx(NV,{section:F,index:ae},F.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Dd,children:"Close"})})]})]})}function NV({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((r,o)=>u.jsx("li",{children:u.jsx(MV,{item:r})},`${r.text}:${o}`))})]})}function MV({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,n)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),u.jsx("span",{children:e.text})]})}function Sl(e,t){return`${e}:${t}`}function OV(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(RV)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function DV(e,t,n){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const i=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!i||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(i);if(o<0||r.length===0)return!1;const c=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,d=r[c],p=d.dataset.tabId;return p?(n(p),d.focus(),!0):!1}function PL(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function jV(e,t=window){const n=i=>{if(!(u5()||PL(t.document))){if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),i.stopImmediatePropagation(),e.toggleOperationSearch();return}if((i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&i.altKey&&!i.shiftKey&&(i.metaKey||i.key.toLowerCase()==="b")){i.preventDefault(),i.stopImmediatePropagation(),e.toggleRailChrome();return}(i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&!i.altKey&&!i.shiftKey&&(i.preventDefault(),i.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)}function Bp(e=()=>{}){return{...bE(e),notifications:{emit:n=>EO(n),dismiss:n=>MO(n)},status:{set:(n,i)=>kO(n,i),clear:n=>e5(n)}}}async function IV(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await BV(t),PV(await t.json(),t.status).routes}async function BV(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Vt(e.status,t)}function PV(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new Vt(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>zV(i,t))}}function zV(e,t){const n=e;if(!n||typeof n!="object"||typeof n.method!="string"||typeof n.path!="string"||typeof n.summary!="string"||typeof n.category!="string"||typeof n.gate!="string")throw new Vt(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const cb=new Set;let ub={loading:!1,state:null,error:null};function $V(){return y.useSyncExternalStore(HV,Vk,Vk)}function Vk(){return ub}function HV(e){return cb.add(e),()=>{cb.delete(e)}}async function FV(e){tv({loading:!0,error:null});try{const t=await IV(e);tv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;tv({loading:!1,error:UV(t)})}}function tv(e){ub={...ub,...e};for(const t of cb)t()}function UV(e){return e instanceof Error?e.message:String(e)}function WV(){const e=$V(),[t,n]=y.useState(!0),i=y.useMemo(()=>KV(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return y.useEffect(()=>{const c=new AbortController;return FV(c.signal),()=>c.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[u.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"settings-disclosure-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children:r>0?`${r} loopback route${r===1?"":"s"} across ${o} categor${o===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),u.jsx("div",{className:"settings-disclosure-actions",children:u.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(c=>!c),children:t?"Hide":"Show"})})]})}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?u.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(c=>u.jsx(GV,{group:c},c.category)):null,e.state&&i.length===0?u.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,u.jsx("p",{className:"global-settings-foot",children:"Console backend routes are fetched from GET /api/v1/settings/api-catalog, so newly registered routes appear here automatically. The Codex/Fleet Wiki API surface is not included."})]})}function GV({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(qV,{entry:t},`${t.method}:${t.path}`))})]})}function qV({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 KV(e){const t=new Map;for(const n of e){const i=n.category.trim()||"Uncategorized",r=t.get(i);r?r.push(n):t.set(i,[n])}return Array.from(t.entries()).map(([n,i])=>({category:n,entries:i}))}const VV=[{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)"]}],YV=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],XV=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],ZV=1024,JV=65535,Yk=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function QV(){const e=I0(),t=e.state,n=e.savingField!==null,[i,r]=y.useState("general"),o=Ds(),c=Jl(),d=nc(),p=nY(d.plugins),f=iY(p),g=v=>{r(v),c({pathname:"/settings",search:v==="general"?"":`?section=${encodeURIComponent(v)}`})};return y.useEffect(()=>{const v=new AbortController;return SV(v.signal),()=>v.abort()},[]),y.useEffect(()=>{const v=new URLSearchParams(o.search).get("section"),b=new Set([...Yk.map(w=>w.id),...p.map(w=>w.id)]),S=v&&b.has(v)?v:"general";r(S),v&&v!==S&&c({pathname:"/settings",search:""},{replace:!0})},[o.search,c,p]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Console"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),Yk.map(v=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${v.id===i?"is-active":""}`,"aria-pressed":v.id===i,onClick:()=>g(v.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:v.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:v.eyebrow})]},v.id)),p.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),f.map(v=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:v.pluginLabel}),v.sections.map(b=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>g(b.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},v.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:tY(i,t,n,p)},i)]})]})}function eY({render:e}){return u.jsx(u.Fragment,{children:e()})}function tY(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?u.jsx(bb,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:u.jsx(eY,{render:r.render})}):u.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(rY,{state:t,saving:n}),u.jsx(aY,{state:t,saving:n}),u.jsx(oY,{state:t,saving:n})]});case"backend-api":return u.jsx(WV,{})}}function nY(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:sY(t.id),sectionTitle:n.title,render:n.render})))}function iY(e){const t=[];for(const n of e){const i=t.at(-1);if(i?.pluginId===n.pluginId){t[t.length-1]={...i,sections:[...i.sections,n]};continue}t.push({pluginId:n.pluginId,pluginLabel:n.pluginLabel,sections:[n]})}return t}function sY(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function rY({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(up().savingField!==null)return;const o=n;If(r),Kl("theme",r).then(c=>{c||If(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:VV.map(r=>{const o=r.id===n;return u.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(c=>u.jsx("i",{style:{background:c}},c))}),u.jsx("span",{className:"theme-card-label",children:r.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?u.jsx(uY,{}):null})]},r.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function aY({state:e,saving:t}){const n=e?.uiFont??ju,[i,r]=y.useState([]),[o,c]=y.useState(!0),[d,p]=y.useState(null);y.useEffect(()=>{const v=new AbortController;return R5({signal:v.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(b=>{v.signal.aborted||(r([]),p(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{v.signal.aborted||c(!1)}),()=>v.abort()},[]);const f=v=>{if(up().savingField!==null)return;const b=n;wv(v),Kl("uiFont",v).then(S=>{S||wv(b)})},g=v=>{const b=v.source==="builtin"?{source:"builtin",id:v.id,size:n.size}:{source:"system",familyName:v.familyName,size:n.size};f(b)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),u.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),u.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===Dl.defaultValue,onClick:()=>f(ju),children:"Reset to Fleet default"})]}),u.jsx(T5,{builtIns:jf.map(({id:v,label:b,family:S,aliases:w,description:x})=>({id:v,label:b,family:S,aliases:w,description:x})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:VE(ju),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:Dl,loading:o,error:d,disabled:!e||t,onSelectionChange:g,onSizeCommit:v=>f({...n,size:v})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function oY({state:e,saving:t}){const n=Ks();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(cY,{state:e,saving:t,consoleState:n}),u.jsx(lY,{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 lY({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:XV.map(n=>{const i=e.language===n.id;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{Kl("language",n.id)},children:n.label},n.id)})}),u.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function cY({state:e,saving:t,consoleState:n}){const[i,r]=y.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,c=n.portMode==="static"&&!n.portHonored,d=n.requestedPort,p=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=i.trim(),g=Number(f),v=f.length>0,b=v&&Xk(g),S=e.consolePortMode==="static"&&v&&!b;return y.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",children:"Dynamic lets the OS pick a free loopback port each time the console starts. Static pins a port you choose so the console URL stays the same across restarts."})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:YV.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:()=>{Kl("consolePortMode",w.id)},children:w.label},w.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const x=w.target.value;r(x);const E=Number(x.trim());Xk(E)&&Kl("consoleStaticPort",E)}}),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 Xk(e){return Number.isInteger(e)&&e>=ZV&&e<=JV}function uY(){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 hY(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function lh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function dY(e,t){return{...hY(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const Zk=256,Jk=176,nv=12,af=220,zL="fleet-console.map.radarCollapsed";function fY({operations:e,pluginOperations:t,viewport:n,canvasSize:i,onJump:r}){const o=y.useRef(null),c=y.useRef(!1),d=y.useRef(null),[p,f]=y.useState(pY),g=Op();if(y.useEffect(()=>{if(g){d.current===null&&(d.current=p,f(!0));return}d.current!==null&&(f(d.current),d.current=null)},[p,g]),i.width<=0||i.height<=0||n.zoom<=0)return null;const v=[...Object.entries(e).map(([T,k])=>({id:T,x:k.x,y:k.y,width:k.width,height:k.height})),...Object.entries(t).map(([T,k])=>({id:T,x:k.geometry.x,y:k.geometry.y,width:k.geometry.width,height:k.geometry.height}))];if(v.length===0)return null;const b=()=>{f(T=>{const k=!T;return g||mY(k),k})};if(p)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:b,"aria-label":"Open Map",title:"Open Map",children:u.jsx(_Y,{})});const S=Zk-nv*2,w=Jk-nv*2,x={x:-n.x/n.zoom,y:-n.y/n.zoom,width:i.width/n.zoom,height:i.height/n.zoom};let E=Math.min(x.x,...v.map(T=>T.x)),A=Math.min(x.y,...v.map(T=>T.y)),L=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));E-=af,A-=af,L+=af,I+=af;const R=L-E,z=I-A,O=Math.min(S/R,w/z),H=(S-R*O)/2,F=(w-z*O)/2,ae=T=>H+(T-E)*O,fe=T=>F+(T-A)*O,V=T=>{const k=o.current?.getBoundingClientRect();if(!k)return;const j=T.clientX-k.left,B=T.clientY-k.top;r({x:E+(j-H)/O,y:A+(B-F)/O})},$=T=>{T.stopPropagation(),c.current=!0,T.currentTarget.setPointerCapture(T.pointerId),V(T)},N=T=>{c.current&&(T.stopPropagation(),V(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:Zk,height:Jk},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:b,"aria-label":"Collapse Map",title:"Collapse Map",children:u.jsx(gY,{})}),u.jsxs("div",{ref:o,className:"canvas-minimap-inner",style:{inset:nv},onPointerDown:$,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:ae(T.x),top:fe(T.y),width:Math.max(2,T.width*O),height:Math.max(2,T.height*O)}},T.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:ae(x.x),top:fe(x.y),width:x.width*O,height:x.height*O}})]})]})}function pY(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(zL)==="true"}catch{return!1}}function mY(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zL,String(e))}catch{}}function gY(){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 _Y(){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 vY({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 Qk=8,yY=120;function bY({anchor:e,accentKey:t,onSelect:n,onClose:i}){const[r,o]=y.useState(void 0);y.useLayoutEffect(()=>{const d=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+Qk,f=p+yY>window.innerHeight;o(f?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+Qk)}:{position:"fixed",left:d,top:Math.round(p)})},[e]),y.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",d),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const c=d=>{n(d),i()};return Ha.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,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"]}),Np.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 SY=["n","ne","e","se","s","sw","w","nw"],iv=320,sv=200,wY=1500;function xY({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:c=!1,renderHidden:d=!1,focusLayerTarget:p=!1,topEdge:f=!1,interactionDisabled:g=!1,accentKey:v=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:E,onRename:A,onSetAccent:L,onGeometryChange:I,onGeometryCommit:R,onRenderHiddenFocus:z}){const O=y.useRef(null),H=y.useRef(null),F=y.useRef(null),ae=y.useRef(null),fe=y.useRef(null),V=y.useRef(!1),[$,N]=y.useState(null),[D,T]=y.useState(!1),k=e.title,j=O0({currentTitle:e.title,onBegin:()=>{P()},onCommit:_e=>{A(_e),V.current=!0}}),B=v?Lo(v):null,q=["canvas-operation",t?"is-active":"",o?"is-minimized":"",c?"is-maximized":"",f?"is-top-edge":"",kY(r)].filter(Boolean).join(" ");y.useEffect(()=>()=>{fe.current!==null&&window.clearTimeout(fe.current)},[]),y.useEffect(()=>{if(j.renaming||!V.current)return;V.current=!1;const _e=window.requestAnimationFrame(()=>H.current?.focus());return()=>window.cancelAnimationFrame(_e)},[j.renaming]),y.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const _e=$!==null;_e&&N(null),(_e||O.current?.contains(document.activeElement))&&z?.()},[$,d,z]);const J=()=>{fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)},P=()=>{J(),T(!1)},X=()=>{J(),T(!0),fe.current=window.setTimeout(()=>{fe.current=null,T(!1)},wY)},Q=_e=>{P(),!(c||g)&&_e.button===0&&(_e.preventDefault(),_e.stopPropagation(),S(),F.current={pointerId:_e.pointerId,startX:_e.clientX,startY:_e.clientY,geometry:n,latest:n},_e.currentTarget.setPointerCapture(_e.pointerId))},Y=_e=>{if(c||g)return;const We=F.current;if(!We||We.pointerId!==_e.pointerId)return;_e.preventDefault(),_e.stopPropagation();const ut={...We.geometry,x:We.geometry.x+(_e.clientX-We.startX)/i,y:We.geometry.y+(_e.clientY-We.startY)/i};We.latest=ut,I(ut)},ie=_e=>{if(c||g){F.current=null;return}const We=F.current;!We||We.pointerId!==_e.pointerId||(_e.preventDefault(),_e.stopPropagation(),F.current=null,_e.currentTarget.releasePointerCapture(_e.pointerId),R(We.latest))},me=(_e,We)=>{c||g||(We.preventDefault(),We.stopPropagation(),S(),ae.current={direction:_e,pointerId:We.pointerId,startX:We.clientX,startY:We.clientY,geometry:n,latest:n},We.currentTarget.setPointerCapture(We.pointerId))},ye=_e=>{if(c||g)return;const We=ae.current;if(!We||We.pointerId!==_e.pointerId)return;_e.preventDefault(),_e.stopPropagation();const ut=CY(We.geometry,We.direction,(_e.clientX-We.startX)/i,(_e.clientY-We.startY)/i);We.latest=ut,I(ut)},ke=_e=>{if(c||g){ae.current=null;return}const We=ae.current;!We||We.pointerId!==_e.pointerId||(_e.preventDefault(),_e.stopPropagation(),ae.current=null,_e.currentTarget.releasePointerCapture(_e.pointerId),R(We.latest))},Le=_e=>{_e.stopPropagation()},ct=_e=>{_e.stopPropagation(),P()},je=_e=>{_e.stopPropagation(),S()},Ae=_e=>{_e.stopPropagation()},Se=()=>{P();const _e=typeof document<"u"?document.activeElement:null;_e instanceof HTMLElement&&O.current?.contains(_e)&&_e.blur(),x()},$e=()=>{P(),E?.()},Ye=_e=>{P(),S(),N(_e)},ht=_e=>{_e.stopPropagation(),P(),S()},nt=()=>{if(!D){X();return}P(),w()},yt=_e=>{_e.stopPropagation(),j.begin()},Tt=_e=>{_e.key!=="Enter"&&_e.key!=="F2"||(_e.preventDefault(),_e.stopPropagation(),j.begin())},nn=_e=>{_e.key==="Escape"&&(V.current=!0),j.handleKeyDown(_e)},Be={left:Math.round(n.x),top:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height),zIndex:n.zIndex,...d?{visibility:"hidden",pointerEvents:"none"}:{},...B?{"--user-accent":B}:{}};return u.jsxs("article",{ref:O,className:q,style:Be,onPointerDown:S,"data-canvas-operation":!0,"data-focus-layer-target":p?"true":void 0,"aria-label":`Operation ${k}`,"aria-hidden":d||void 0,tabIndex:p?-1:void 0,inert:o||d?!0:void 0,children:[!c&&!g?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:Q,onPointerMove:Y,onPointerUp:ie,onPointerCancel:ie,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:Q,onPointerMove:Y,onPointerUp:ie,onPointerCancel:ie,"data-canvas-blocker":!0,children:[j.renaming?u.jsx("input",{ref:j.inputRef,className:"canvas-operation-identity-input",value:j.draftTitle,"aria-label":`Rename operation ${k}`,onChange:_e=>j.setDraftTitle(_e.target.value),onKeyDown:nn,onBlur:j.handleBlur,onPointerDown:ct}):u.jsx("button",{ref:H,type:"button",className:"canvas-operation-identity-name",onPointerDown:ct,onDoubleClick:yt,onKeyDown:Tt,"aria-label":`Rename operation ${k}`,title:`${k} — Double-click, Enter, or F2 to rename`,children:k}),L?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:Le,onClick:_e=>Ye(_e.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${k}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:eE(r),"aria-hidden":"true"})}):u.jsx("span",{className:eE(r),onPointerDown:ht,"aria-hidden":"true"}),u.jsxs("div",{className:"canvas-operation-window-controls",children:[u.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:Le,onClick:Se,"aria-label":`Minimize operation ${k}`,title:"Minimize operation",children:u.jsx(EY,{})}),E?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:Le,onClick:$e,"aria-label":c?`Restore operation ${k}`:`Maximize operation ${k}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(AY,{}):u.jsx(TY,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${D?"is-armed-close":""}`,onPointerDown:Le,onClick:nt,"aria-label":D?`Confirm close operation ${k}`:`Close operation ${k}`,title:D?"Confirm close":"Close operation",children:D?"Close?":u.jsx(RY,{})})]})]}),u.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:k}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:je,onWheel:Ae,"data-canvas-blocker":!0,children:b}),!c&&!g&&SY.map(_e=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${_e}`,onPointerDown:We=>me(_e,We),onPointerMove:ye,onPointerUp:ke,onPointerCancel:ke,"data-canvas-blocker":!0,"aria-hidden":"true"},_e)),$&&L?u.jsx(bY,{anchor:$,accentKey:v,onSelect:L,onClose:()=>N(null)}):null]})}function CY(e,t,n,i){let{x:r,y:o,width:c,height:d}=e;return t.includes("e")&&(c+=n),t.includes("s")&&(d+=i),t.includes("w")&&(r+=n,c-=n),t.includes("n")&&(o+=i,d-=i),c<iv&&(t.includes("w")&&(r-=iv-c),c=iv),d<sv&&(t.includes("n")&&(o-=sv-d),d=sv),{...e,x:r,y:o,width:c,height:d}}function kY(e){const t=jp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function eE(e){const t=jp(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 EY(){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 TY(){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 AY(){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 RY(){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 LY({rect:e,viewport:t}){const n=dY(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const NY=.25,MY=2,OY=200,DY=150,tE=5,jY=.0018;function IY({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:c,onClick:d}){const p=y.useRef(null),f=y.useRef(e),[g,v]=y.useState(null),[b,S]=y.useState(!1),[w,x]=y.useState(!1);y.useEffect(()=>{f.current=e},[e]),y.useEffect(()=>{const O=F=>{F.key==="Shift"&&x(!0),!BY(F.target)&&F.code==="Space"&&(F.preventDefault(),S(!0))},H=F=>{F.key==="Shift"&&x(!1),F.code==="Space"&&S(!1)};return window.addEventListener("keydown",O),window.addEventListener("keyup",H),()=>{window.removeEventListener("keydown",O),window.removeEventListener("keyup",H)}},[]);const E=O=>{if(t||nE(O.target)||O.button!==0&&O.button!==1)return;if(O.preventDefault(),n){c?.();return}const H=av(O),F=O.shiftKey&&O.button===0&&!b?"create":"pan";p.current={pointerId:O.pointerId,mode:F,startScreen:H,currentScreen:H,startViewport:f.current},O.currentTarget.setPointerCapture(O.pointerId),F==="create"&&v(rv(H,H,f.current))},A=O=>{const H=p.current;if(!H||H.pointerId!==O.pointerId)return;O.preventDefault();const F=av(O);if(p.current={...H,currentScreen:F},H.mode==="pan"){i({...H.startViewport,x:H.startViewport.x+F.x-H.startScreen.x,y:H.startViewport.y+F.y-H.startScreen.y});return}v(rv(H.startScreen,F,f.current))},L=O=>{z(O,!0)},I=O=>{z(O,!1)},R=O=>{if(t||nE(O.target))return;O.preventDefault();const H=av(O),F=f.current,ae=PY(F.zoom*Math.exp(-O.deltaY*jY),NY,MY),fe=lh(H,F);r({x:H.x-fe.x*ae,y:H.y-fe.y*ae,zoom:ae})},z=(O,H)=>{const F=p.current;if(!F||F.pointerId!==O.pointerId||(p.current=null,O.currentTarget.releasePointerCapture(O.pointerId),v(null),!H))return;const ae=Math.abs(F.currentScreen.x-F.startScreen.x),fe=Math.abs(F.currentScreen.y-F.startScreen.y);if(ae<tE&&fe<tE){d?.();return}if(F.mode!=="create")return;const V=rv(F.startScreen,F.currentScreen,f.current),$={x:V.x,y:V.y,width:Math.max(V.width,OY),height:Math.max(V.height,DY)};o($,F.currentScreen)};return{rubberBand:g,spaceActive:b,shiftActive:w,onPointerDown:E,onPointerMove:A,onPointerUp:L,onPointerCancel:I,onWheel:R}}function rv(e,t,n){const i=lh(e,n),r=lh(t,n),o=Math.min(i.x,r.x),c=Math.min(i.y,r.y);return{x:o,y:c,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function av(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function nE(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function BY(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function PY(e,t,n){return Math.min(n,Math.max(t,e))}const zY="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",$Y=560,HY=360,FY=12;function UY({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:c,onFocus:d,onRename:p,onSetAccent:f}){const g=y.useRef(null),v=QR(),b=tL(),S=Op(),w=eL(),x=nL(),E=e.activeOperationId,[A,L]=y.useState(null),I=nc(),[R,z]=y.useState({width:0,height:0}),O=YY(),H=!e.activeTheaterId||e.addingTheater;y.useEffect(()=>{const Y=g.current;if(!Y||typeof ResizeObserver>"u")return;const ie=()=>z({width:Y.clientWidth,height:Y.clientHeight});ie();const me=new ResizeObserver(ie);return me.observe(Y),()=>me.disconnect()},[]);const F=IY({viewport:v.viewport,disabled:H||S,onViewportChange:tb,onZoom:sL,onCreate:Y=>{if(L(null),e.activeTheaterId&&n){const ie=XY(t);if(!ie)return;const me={...qY(Y),zIndex:No()};o(ie.pluginId,ie.kind,me)}},consumePointerDown:A!==null,onConsumePointerDown:()=>{L(null)},onClick:GY}),ae=(Y,ie)=>{const me=A?.canvasPoint;L(null),me&&r(Y,ie,me)},fe=Y=>{if(Y.target instanceof Element&&Y.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;Y.preventDefault();const ie=g.current?.getBoundingClientRect();if(!ie)return;const me={x:Y.clientX-ie.left,y:Y.clientY-ie.top};L({anchor:me,canvasPoint:lh(me,v.viewport)})},V=new Set(x);y.useEffect(()=>{e.activeOperationId&&V.has(e.activeOperationId)&&Ui(null)},[x,e.activeOperationId]);const $=Object.fromEntries(Object.entries(v.operations).filter(([Y])=>!V.has(Y))),N=(e.operations??[]).filter(Y=>Y.theaterId===e.activeTheaterId),D=N,T=N.length>0,k=I.operationKinds,B=w!==null&&N.some(Y=>Y.id===w&&!V.has(Y.id))?w:null,q=i5(N,e.groups.filter(Y=>Y.theaterId===e.activeTheaterId),v.operationOrder,[]).filter(Y=>!V.has(Y.id)).map(Y=>Y.id),J=S?Bq({x:0,y:0,width:R.width,height:R.height},q.length,void 0,void 0,void 0,void 0,b):[],P=new Map(q.map((Y,ie)=>[Y,J[ie]])),X=B||S?1:v.viewport.zoom,Q=VY(v.operations)+1;return u.jsxs("main",{className:`operations-canvas ${F.spaceActive?"is-panning":""} ${F.shiftActive?"is-creating":""} ${O?"is-glance":""} ${B?"is-panel-maximized":""} ${S?"is-formation-view":""}`,onPointerDown:F.onPointerDown,onPointerMove:F.onPointerMove,onPointerUp:F.onPointerUp,onPointerCancel:F.onPointerCancel,onWheel:F.onWheel,onContextMenu:fe,ref:g,tabIndex:-1,children:[u.jsx(vY,{viewport:v.viewport}),u.jsx("div",{style:{transform:B||S?"none":`translate(${Math.round(v.viewport.x)}px, ${Math.round(v.viewport.y)}px) scale(${v.viewport.zoom})`},className:"operations-canvas-world",children:D.map(Y=>{const ie=v.operations[Y.id]??Y.geometry??ov(Y),me=B===Y.id,ye=B!==null&&!me,ke=P.get(Y.id),Le=me?KY(R,Q):ke?{...ie,...ke}:ie,ct=!me&&!ke&&v.viewport.y+Le.y*X<FY*X;return JY(Y,{active:E===Y.id,geometry:Le,topEdge:ct,operationKindRegistry:k,status:e.operationStatus[Y.id],theme:e.activeTheme,viewportZoom:X,minimized:V.has(Y.id),maximized:me,formation:S,focusLayerHidden:ye,onRenderHiddenFocus:()=>{const je=g.current?.querySelector("[data-focus-layer-target='true']");if(je){je.focus();return}g.current?.focus()},accentKey:v.operationAccent[Y.id]??ZY(Y),onActivate:()=>{Ui(Y.id),!me&&!S&&nb(Y.id,v.operations[Y.id]??Y.geometry??ov(Y))},onClose:()=>{e.activeOperationId===Y.id&&Ui(null),B===Y.id&&Kr(),c(Y.id)},onMinimize:()=>{e.activeOperationId===Y.id&&Ui(null),rL(Y.id)},onMaximize:()=>{me?Kr():(Ui(Y.id),Fu(Y.id))},onRename:je=>{p(Y.id,je)},onSetAccent:je=>{f(Y.id,je)},onGeometryChange:je=>{!me&&!S&&nb(Y.id,je)},onGeometryCommit:je=>{!me&&!S&&eX(Y.id,Gl().operations[Y.id]??je)}})})}),T?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?zY:"Add a Theater from the top bar to start operations."})]}),F.rubberBand?u.jsx(LY,{rect:F.rubberBand,viewport:v.viewport}):null,A?u.jsx(YR,{anchor:A.anchor,viewportBounds:WY(g.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:ae,onClose:()=>L(null)},`${A.anchor.x}:${A.anchor.y}`):null,u.jsx(fY,{operations:$,pluginOperations:Object.fromEntries(N.filter(Y=>!V.has(Y.id)).map(Y=>[Y.id,{theaterId:Y.theaterId,geometry:v.operations[Y.id]??Y.geometry??ov(Y)}])),viewport:v.viewport,canvasSize:R,onJump:Y=>tb({x:R.width/2-Y.x*v.viewport.zoom,y:R.height/2-Y.y*v.viewport.zoom,zoom:v.viewport.zoom})})]})}function WY(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function GY(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Ui(null)}function qY(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function ov(e){return e.geometry??{x:0,y:0,width:$Y,height:HY,zIndex:0}}function KY(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function VY(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function YY(){const[e,t]=y.useState(!1),n=y.useRef(new Set);return y.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=d=>{!iE(d)||d.repeat||d.ctrlKey||d.metaKey||PL()||(n.current.add(d.code),t(!0))},o=d=>{iE(d)&&(n.current.delete(d.code),t(n.current.size>0))},c=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",c)}},[]),e}function iE(e){return e.code==="AltLeft"||e.code==="AltRight"}function XY(e){const t=e.flatMap(n=>n.kinds.filter(i=>i.disabled!==!0).map(i=>({pluginId:n.id,kind:i})));return t.find(({kind:n})=>n.type==="shell")??t[0]??null}function ZY(e){return typeof e.accent=="string"?e.accent:null}function JY(e,t){const n=t.operationKindRegistry.find(o=>o.pluginId===e.pluginId&&o.type===e.type),i=t.geometry;if(!n?.render)return null;const r=Bp(()=>{Wi(null).then(cs).catch(()=>{})});return u.jsx(xY,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized,interactionDisabled:t.formation||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:u.jsx(bb,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(QY,{active:t.active,capabilities:r,descriptor:n,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function QY({active:e,capabilities:t,descriptor:n,geometry:i,operation:r,theme:o,viewportZoom:c,onActivate:d,onClose:p,onGeometryChange:f}){return n.render?n.render({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:i,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 eX(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function $L(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(n=>n.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function HL(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function FL(e,t){const n=[],i=[];for(const r of e)t.has(r.operationId)?i.push(r):n.push(r);return{hidden:n,visible:i}}function hb(e){const t=new Map;for(const n of[...e].sort((i,r)=>r.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",r=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};r.notifications.push(n),t.set(i,r)}return[...t.values()].sort((n,i)=>{const r=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-r})}function UL(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const tX={ended:"Ended","input-waiting":"Waiting for input"},nX={id:"alerts",title:"Alerts",icon:()=>u.jsx(sX,{}),render:()=>u.jsx(iX,{})};function iX(){const e=Ks(),t=Jl(),[n,i]=y.useState(!1),r=y.useMemo(()=>HL(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=$L(e),c=FL(r,o).hidden,d=UL(c,e.notificationPreferences),p=hb(d),f=hb(c),g=db(p,"input-waiting"),v=db(p,"ended"),b=p.length===0,S=y.useCallback(w=>{Vu(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,b?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${n?" is-active":""}`,onClick:()=>i(w=>!w),"aria-expanded":n,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(lX,{})})]}),n?u.jsx(rX,{groups:f}):null,b?u.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):u.jsx("div",{className:"notification-dock-deck",children:p.map(w=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(x=>u.jsxs("li",{className:`notification-row is-${x.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:x.operationLabel}),u.jsx("span",{className:"notification-row-state",children:tX[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 sX(){const e=Ks();w5();const t=y.useMemo(()=>HL(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=$L(e),i=FL(t,n).hidden,r=UL(i,e.notificationPreferences),o=hb(r),c=o.reduce((f,g)=>f+g.notifications.length,0),d=db(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(oX,{}),c>0?u.jsx("span",{className:"alerts-icon-badge",children:c}):null]})}function rX({groups:e}){const t=Ks(),n=aX(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>OO(i.currentTarget.checked)}),u.jsx("span",{children:"Mute all"})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>DO(i.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),n.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&jO(i.theaterId)}}),u.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function aX(e,t,n){const i=new Map;for(const r of e)r.theaterId&&i.set(r.theaterId,r);for(const r of Object.keys(t))i.has(r)||i.set(r,{theaterId:r,theaterLabel:n.find(o=>o.id===r)?.label??r,notifications:[]});return[...i.values()]}function db(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function oX(){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 lX(){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 cX(e,t){const i=new URLSearchParams().toString();return ic(Do(e,`/search${i?`?${i}`:""}`))}async function uX(e,t,n){return ic(Do(e,`/entry/${encodeURIComponent(t)}`))}async function WL(e,t="pending"){return ic(Do(e,`/drydock?status=${encodeURIComponent(t)}`))}async function hX(e,t){return ic(Do(e,`/drydock/${encodeURIComponent(t)}`))}async function dX(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),mX(Do(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function fX(e){return ic(Do(e,"/conflicts"))}async function pX(e,t){return ic(Do(e,`/conflicts/${encodeURIComponent(t)}`))}function Do(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function ic(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await GL(e,t));return t.json()}async function mX(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await GL(e,n));return n.json()}async function GL(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const fb=new Set,hp={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function Du(){return hp}function qL(e){return fb.add(e),()=>fb.delete(e)}function sE(e){Tf({currentWorkspaceId:e})}async function dp(){Tf({loading:!0,error:null});try{const e=hp.currentWorkspaceId,[t,n]=await Promise.all([cX(e),WL(e,"pending").catch(()=>null)]);Tf({index:t.entries,pendingPatchCount:n?.pendingCount??0,loading:!1})}catch(e){Tf({loading:!1,error:gX(e)})}}function Tf(e){Object.assign(hp,e);for(const t of fb)t(hp)}function gX(e){return e instanceof Error?e.message:String(e)}const _X=120;function Fs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vX(e,t){if(!t)return Fs(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?Fs(e):Fs(e.slice(0,n))+`<mark>${Fs(e.slice(n,n+t.length))}</mark>`+Fs(e.slice(n+t.length))}function yX(e){return`<span class="codex-nav-tag">${Fs(e)}</span>`}function bX(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(yX).join(""),o=Fs(e.status??"current"),c=Fs(e.updated??"");return`<button
|
|
230
|
-
class="codex-nav-entry${n?" is-current":""}"
|
|
231
|
-
data-entry-id="${Fs(e.id)}"
|
|
232
|
-
type="button"
|
|
233
|
-
${n?'aria-current="page"':""}
|
|
234
|
-
title="${Fs(e.title)}"
|
|
235
|
-
>
|
|
236
|
-
<span class="t">${vX(e.title,i?"":t)}</span>
|
|
237
|
-
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
-
<span class="meta">${o} · ${c}</span>
|
|
239
|
-
</button>`}function SX(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(r=>r.toLowerCase().includes(n)))}function wX(e,t){let n="",i=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=SX(S.index,n);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">${Fs(S.error)}</div>`;return}if(w.length===0){c.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}c.innerHTML=w.map(x=>bX(x,n,x.id===i)).join("")}function g(S){const w=S.target;if(!(w instanceof Element))return;const x=w.closest("[data-entry-id]");if(x?.dataset.entryId){i=x.dataset.entryId,f(Du()),t.onRequest({kind:"entry",id:i});return}const E=w.closest("[data-action]");if(E?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(E?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function v(){r!==null&&clearTimeout(r),r=setTimeout(()=>{n=o.value,f(Du())},_X)}e.addEventListener("click",g),o.addEventListener("input",v);const b=qL(S=>f(S));return f(Du()),{destroy(){b(),e.removeEventListener("click",g),o.removeEventListener("input",v),r!==null&&clearTimeout(r),e.innerHTML=""},setTheater(S){n="",i=null,o&&(o.value=""),f(Du())}}}function xX(e,t){t.initialTheaterId&&sE(t.initialTheaterId);const n=wX(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=qL(()=>{});dp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){sE(o),dp(),n.setTheater(o)}}}function Wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Vl(e){return Wt(e).replace(/"/g,""")}function CX(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${Wt(i)}</span>`).join(""),n=EX(e);return`
|
|
264
|
-
<div class="meta-chips">
|
|
265
|
-
${t}
|
|
266
|
-
${n}
|
|
267
|
-
<span class="chip">Updated ${Wt(kX(e.updated))}</span>
|
|
268
|
-
</div>
|
|
269
|
-
`}function KL(e){return e.map(t=>`<span class="chip chip-muted">${Wt(t)}</span>`).join("")}function kX(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function EX(e){const t=TX(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Vl(t.title)}">${Wt(t.label)}</span>`:""}function TX(e,t=new Date){const n=e.status,i=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return n==="deprecated"||n==="superseded"?{label:n,tone:"deprecated",title:i?`${n} · stale`:n}:i?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:n==="current"||n==="draft"?{label:n,tone:"neutral",title:n}:null}const AX="active";function rE(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Vl(t.id)}" data-toc-id="${Vl(t.id)}">${Wt(t.text)}</a>`).join("")}function aE(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(f=>f.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>r.has(f.id));if(i.length===0||o.length===0)return()=>{};const c=e.closest(".codex-reading-sheet-read"),d=new Set,p=new IntersectionObserver(f=>{for(const v of f){const b=v.target instanceof HTMLElement?v.target.id:"";b&&(v.isIntersecting?d.add(b):d.delete(b))}const g=RX(o,d)??LX(o,c)??o[0]?.id??null;oE(i,g)},{root:c,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return oE(i,o[0]?.id??null),()=>p.disconnect()}function RX(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function LX(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const r of e)if(r.getBoundingClientRect().top-n<=80)i=r.id;else break;return i}function oE(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(AX,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function lE(e){return`/entry/${encodeURIComponent(e)}`}const VL={create_wiki:"+",update_wiki:"↻"},YL={create_wiki:"Create",update_wiki:"Update"};function NX(e,t){let n=!1,i=null,r=t,o="idle",c=null,d=null,p=null;_0(e);function f(A){const L=A.target;if(!(L instanceof Element))return;const I=L.closest("[data-patch-id]");if(I){A.preventDefault();const O=I.dataset.patchId||void 0;r.onPatchOpen?.(O);return}const R=L.closest("[data-entry-id]");if(R?.dataset.entryId){A.preventDefault(),r.onRelatedClick(R.dataset.entryId);return}const z=L.closest("[data-drydock-action]");if(z){A.preventDefault(),g(z.dataset.drydockAction);return}}function g(A){if(A){if(A==="back"){r.onPatchOpen?.(void 0);return}if(A==="approve"){o="approving",c=null,b();return}if(A==="approve-confirm"){v("approve",void 0);return}if(A==="reject"){o="rejecting",c=null,b();return}if(A==="reject-submit"){const L=e.querySelector("#queue-reject-reason")?.value.trim();if(!L){c="Rejection reason is required.",b();return}v("reject",L);return}if(A==="cancel"){o="idle",c=null,b();return}}}async function v(A,L){if(p){o="submitting",c=null,b();try{await dX(r.theaterId,p,A,L),r.onDecided?.()}catch(I){o=A==="approve"?"approving":"rejecting",c=I instanceof Error?I.message:String(I),b()}}}function b(){const A=e.querySelector("[data-decision-bar-wrap]");A&&(A.innerHTML=XL(o,c))}e.addEventListener("click",f);function S(){i?.(),i=null}async function w(A){if(!n){lv(e,t.tocContainer),S();try{const L=await uX(r.theaterId,A);if(n)return;const{index:I}=Du(),{html:R,toc:z}=sh(L.body,{omitDuplicateTitle:L.frontmatter.title,resolveWikiLink:H=>lE(H)});e.innerHTML=`
|
|
270
|
-
<article class="document">
|
|
271
|
-
<header class="document-header">
|
|
272
|
-
${MX(L.frontmatter.title)}
|
|
273
|
-
<h1>${Wt(L.frontmatter.title)}</h1>
|
|
274
|
-
${CX(L.frontmatter)}
|
|
275
|
-
</header>
|
|
276
|
-
<div class="markdown-body" id="codex-reader-body">
|
|
277
|
-
${R}
|
|
278
|
-
</div>
|
|
279
|
-
${OX(L.frontmatter.id,L.frontmatter.tags,I)}
|
|
280
|
-
</article>
|
|
281
|
-
`,t.tocContainer.innerHTML=rE(z);const O=e.querySelector("article");O&&z.length>0&&(i=aE(O,z,t.tocContainer))}catch(L){n||cv(e,t.tocContainer,L)}}}async function x(A){if(!n){lv(e,t.tocContainer),S(),d=null,p=null,o="idle",c=null;try{if(A){const L=await hX(r.theaterId,A);if(n)return;d=L.meta,p=A;const{html:I,toc:R}=sh(L.wikiEntry.body,{omitDuplicateTitle:L.wikiEntry.title,resolveWikiLink:O=>lE(O)});e.innerHTML=IX(L,I),t.tocContainer.innerHTML=rE(R);const z=e.querySelector("article");z&&R.length>0&&(i=aE(z,R,t.tocContainer))}else{const L=await WL(r.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=DX(L.items,"Review queue — Pending patches")}}catch(L){n||cv(e,t.tocContainer,L)}}}async function E(A){if(!n){lv(e,t.tocContainer),S();try{if(A){const L=await pX(r.theaterId,A);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=zX(L)}else{const L=await fX(r.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=$X(L)}}catch(L){n||cv(e,t.tocContainer,L)}}}return t.kind==="entry"&&t.initialEntryId?w(t.initialEntryId):t.kind==="drydock"?x(t.subId):t.kind==="conflicts"&&E(t.subId),{destroy(){n=!0,e.removeEventListener("click",f),S()},async setEntry(A){await w(A)},async navigateSub(A){t.kind==="drydock"?await x(A):t.kind==="conflicts"&&await E(A)},refreshCallbacks(A){r={...r,...A}}}}function lv(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function cv(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${Wt(i)}</div>`,t.innerHTML=""}function MX(e){return`
|
|
282
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
283
|
-
<ol>
|
|
284
|
-
<li><span>Codex</span></li>
|
|
285
|
-
<li><span aria-current="page">${Wt(e)}</span></li>
|
|
286
|
-
</ol>
|
|
287
|
-
</nav>
|
|
288
|
-
`}function OX(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(c=>i.has(c))})).filter(o=>o.matchingTags.length>0).sort((o,c)=>c.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(c.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
|
|
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="${Vl(o.entry.id)}">
|
|
293
|
-
<strong>${Wt(o.entry.title)}</strong>
|
|
294
|
-
<span>${KL(o.matchingTags)}</span>
|
|
295
|
-
</button>`).join("")}
|
|
296
|
-
</div>
|
|
297
|
-
</section>
|
|
298
|
-
`}function DX(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>${Wt(t)}</h1>
|
|
308
|
-
</header>
|
|
309
|
-
<div class="queue-row-list">
|
|
310
|
-
${e.map(jX).join("")}
|
|
311
|
-
</div>
|
|
312
|
-
</article>
|
|
313
|
-
`}function jX(e){const t=e.op??"create_wiki",n=VL[t]??"?",i=YL[t]??"Patch",r=e.target??e.id,c=[HX(e.meta.createdAt)].filter(Boolean);return`
|
|
314
|
-
<button class="queue-row" type="button" data-patch-id="${Vl(e.id)}" aria-label="${Vl(i+": "+r)}">
|
|
315
|
-
<span class="queue-row-badge" aria-hidden="true">
|
|
316
|
-
<span class="op-badge">${n}</span>
|
|
317
|
-
</span>
|
|
318
|
-
<span class="queue-row-body">
|
|
319
|
-
<span class="queue-row-target">${Wt(r)}</span>
|
|
320
|
-
${e.summary?`<span class="queue-row-summary">${Wt(e.summary)}</span>`:""}
|
|
321
|
-
${c.length>0?`<span class="queue-row-meta">${c.map(Wt).join(" · ")}</span>`:""}
|
|
322
|
-
</span>
|
|
323
|
-
</button>
|
|
324
|
-
`}function IX(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,c=n.frontmatter.op,d=VL[c]??"?",p=YL[c]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",g=i.status==="pending";return`
|
|
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">${Wt(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> ${Wt(r.title)}</h1>
|
|
336
|
-
<p class="eyebrow">${Wt(n.frontmatter.target)} · v${r.version} · ${Wt(f)}</p>
|
|
337
|
-
${BX(n.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?XL("idle",null):PX(i)}
|
|
344
|
-
</div>
|
|
345
|
-
</article>
|
|
346
|
-
`}function BX(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${Wt(e)}</span>`),t.length>0&&n.push(KL(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function XL(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
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">${Wt(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">${Wt(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 PX(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${Wt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function zX(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>${Wt(e.id)}</h1>
|
|
374
|
-
<p class="eyebrow">Conflict · ${Wt(e.meta?.status??"open")}</p>
|
|
375
|
-
</header>
|
|
376
|
-
<div class="markdown-body">
|
|
377
|
-
${e.current?`<h2>Current</h2><pre><code>${Wt(e.current)}</code></pre>`:""}
|
|
378
|
-
${e.proposed?`<h2>Proposed</h2><pre><code>${Wt(e.proposed)}</code></pre>`:""}
|
|
379
|
-
</div>
|
|
380
|
-
</article>
|
|
381
|
-
`}function $X(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>${Wt(t.title||t.id)}</strong>
|
|
390
|
-
<span class="eyebrow">${Wt(t.status)}</span>
|
|
391
|
-
</li>`).join("")}
|
|
392
|
-
</ul>
|
|
393
|
-
</div>
|
|
394
|
-
</article>
|
|
395
|
-
`}function HX(e){try{const n=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(n<1)return"< 1h ago";if(n<24)return`${Math.floor(n)}h ago`;const i=n/24;return i<7?`${Math.floor(i)}d ago`:i<30?`${Math.floor(i/7)}w ago`:`${Math.floor(i/30)}mo ago`}catch{return""}}let _o=null,ch=null,ZL=null,Ia=null,vo=null,Oa=null,Af=null,uv=null,Rf,pb=0;function cE(e){ZL=e}function FX(e,t){const n=GX();n.parentElement!==e&&e.appendChild(n),ch||(ch=xX(n,{initialTheaterId:t,onRequest:i=>ZL?.(i)}))}function UX(e){ch?.setTheater(e)}function JL(e,t,n){const i=qX(),r=KX(),o=i.parentElement,c=n.kind==="entry"&&Af==="entry"&&n.initialEntryId===uv;o&&o!==e&&(pb=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Oa||Af!==n.kind?(Oa?.destroy(),Oa=NX(i,{...n,tocContainer:r}),Af=n.kind,Rf=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==uv?Oa.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts")&&n.subId!==Rf&&(Rf=n.subId,Oa.navigateSub(n.subId)),uv=n.kind==="entry"?n.initialEntryId??null:null,Oa.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=c?pb:0;requestAnimationFrame(()=>{e.scrollTop=d})}function WX(){const e=Ia?.parentElement;e&&(pb=e.scrollTop)}function QL(){Oa?.destroy(),Oa=null,Af=null,Rf=void 0,Ia?.parentElement&&Ia.parentElement.removeChild(Ia),vo?.parentElement&&vo.parentElement.removeChild(vo)}function uE(){QL(),ch?.destroy(),ch=null,_o?.parentElement&&_o.parentElement.removeChild(_o)}function GX(){return _o||(_o=document.createElement("div"),_o.className="codex-host"),_o}function qX(){return Ia||(Ia=document.createElement("div"),Ia.className="codex-reader-host"),Ia}function KX(){return vo||(vo=document.createElement("div"),vo.className="codex-toc-host"),vo}const VX={id:"codex",title:"Codex",icon:()=>u.jsx(QX,{}),pathAware:!1,render:e=>u.jsx(YX,{theaterId:e.theaterId})};function YX({theaterId:e}){const t=Ks(),n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),o=y.useRef(""),[c,d]=y.useState(null),p=t.codexReader,f=p!==null,g=t.codexReaderExpanded,v=t.theaters.find(A=>A.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=c?.contextKey===S&&c.hasWiki?c.id:null,x=w!==null,E=p?`${p.kind}:${p.kind==="entry"?p.entryId:p.kind==="drydock"?p.patchId??"":p.id??""}`:null;return y.useEffect(()=>{if(o.current=S,Qg(),!e){d({contextKey:S,hasWiki:!1,id:null});return}ZX(e).then(A=>{o.current===S&&d({contextKey:S,...A})}).catch(()=>{o.current===S&&d({contextKey:S,hasWiki:!1,id:null})})},[S,e]),y.useEffect(()=>{c?.contextKey===S&&!c.hasWiki&&uE()},[S,c]),y.useEffect(()=>()=>uE(),[]),y.useEffect(()=>{if(!x||!w)return;const A=n.current;if(A)return FX(A,w),cE(L=>{L.kind==="entry"?$r({kind:"entry",entryId:L.id}):L.kind==="drydock"?$r({kind:"drydock",patchId:L.patchId}):L.kind==="conflicts"&&$r({kind:"conflicts",id:L.id})}),()=>{cE(null)}},[x,w,f]),y.useEffect(()=>{x&&w&&UX(w)},[x,w]),y.useEffect(()=>{if(!x||!w||!f||g||!i.current||!r.current||!p)return;const A=p.kind,L=A==="drydock"?p.patchId:A==="conflicts"?p.id:void 0;JL(i.current,r.current,{initialEntryId:A==="entry"?p.entryId:"",kind:A,subId:L,theaterId:w,onRelatedClick:I=>$r({kind:"entry",entryId:I}),onClose:()=>Qg(),onPatchOpen:I=>$r({kind:"drydock",patchId:I}),onDecided:()=>{dp(),$r({kind:"drydock",patchId:void 0})}})},[x,w,f,g,E]),y.useEffect(()=>{f||QL()},[f]),x?f?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:hf,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:Qg,children:"✕"})]}),u.jsx("div",{ref:i,className:"codex-doc-scroll"}),u.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:n,className:"codex-nav-pane"})]}):u.jsx("div",{ref:n,className:"codex-rail-host"}):u.jsx(XX,{activeTheater:v,hasTheaters:b})}function XX({activeTheater:e,hasTheaters:t}){return t?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:e?.label||"This Theater"}),u.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function ZX(e){const t=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!t.ok)throw new Error("codex_workspace_unavailable");return JX(await t.json())}function JX(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 QX(){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 eN(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function eZ(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 tZ(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function nZ(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function iZ(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(nZ)?"ready":"blocked"}const sZ=360,rZ={id:"plans",title:"Plans",icon:hZ,pathAware:!1,render:e=>u.jsx(aZ,{...e})};function aZ(e){const t=e.theaterId;return u.jsx(oZ,{...e},t)}function oZ(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=y.useState({kind:"no-theater"}),[o,c]=y.useState({kind:"loading"}),[d,p]=y.useState(null),[f,g]=y.useState(0),[v,b]=y.useState(0),S=d?.theaterId===n?d.name:null;y.useEffect(()=>{let L=!1;return p(null),c({kind:"loading"}),n?(r({kind:"loading"}),M4(n).then(I=>{L||r({kind:"ready",plans:I.plans})}).catch(()=>{L||r({kind:"error"})}),()=>{L=!0}):(r({kind:"no-theater"}),()=>{L=!0})},[n,f]),y.useEffect(()=>{let L=!1;return!n||!S?()=>{L=!0}:(c({kind:"loading"}),O4(n,S).then(I=>{L||c({kind:"ready",plan:I})}).catch(()=>{L||c({kind:"error"})}),()=>{L=!0})},[v,S,n]),y.useLayoutEffect(()=>(t?.(S?sZ:null),()=>t?.(null)),[t,S]);const w=y.useCallback(L=>{n&&p({theaterId:n,name:L})},[n]),x=y.useCallback(()=>p(null),[]),E=y.useCallback(()=>g(L=>L+1),[]),A=y.useCallback(()=>b(L=>L+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${S?" is-reader-open":""}`,children:[S&&u.jsx(cZ,{state:o,onClose:x,onRetry:A}),S&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(lZ,{selectedName:S,state:i,onRetry:E,onSelect:w})]})})}function lZ({selectedName:e,state:t,onRetry:n,onSelect:i}){return t.kind==="no-theater"?u.jsx("div",{className:"plans-list-pane",children:u.jsx(hE,{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(tN,{message:"Unable to load plans.",onRetry:n})}):t.plans.length===0?u.jsx("div",{className:"plans-list-pane",children:u.jsx(hE,{detail:"Workspace-scoped 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=eZ(r.tasksDone,r.tasksTotal),c=o===100;return u.jsxs("button",{type:"button",className:`plans-row${e===r.name?" is-selected":""}`,onClick:()=>i(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 · ",eN(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 cZ({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(mb,{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(mb,{onClose:t})]}),u.jsx(tN,{message:"Unable to load plan.",onRetry:n})]}):u.jsx(uZ,{plan:e.plan,onClose:t})}function uZ({plan:e,onClose:t}){const n=y.useMemo(()=>{const o=new DOMParser().parseFromString(sh(e.content).html,"text/html");return hv(o.body),o.body.innerHTML},[e.content]),i=y.useRef(null),r=y.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 y.useEffect(()=>{const o=i.current;if(!o)return;_0(o),hv(o);const c=new MutationObserver(()=>hv(o));return c.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>c.disconnect()},[n]),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 ",eN(e.updatedAt)]})]}),u.jsx(mb,{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=tZ(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=iZ(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:i,className:"plans-markdown markdown-body",onClick:r,dangerouslySetInnerHTML:{__html:n}})]})]})}function mb({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function hE({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 tN({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 hv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(n)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const n=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),i=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=n?`${i} blocked: ${n}`:`${i} blocked`,t.replaceWith(r)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const n=t.getAttribute("href")??t.getAttribute("xlink:href")??"";n!==""&&!n.startsWith("#")&&t.remove()}}function hZ(){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 dZ=[nX,VX,rZ];function fZ(e="right"){const{railPanels:t}=nc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const pZ=360;function mZ(e){const{codexReader:t}=Ks();return e==="codex"&&t!==null?pZ:0}const nN=240,gZ=312,iN="fleet-console.rail.panelWidth",_Z={kind:"root",relPath:null,label:"Theater-wide"};function vZ(){try{const e=localStorage.getItem(iN);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=nN)return t}}catch{}return gZ}function yZ({theaterId:e,api:t}){const n=y.useRef(null),i=w5(),r=x5(),o=y.useRef(r),c=fZ(),d=dZ,f=[...d,...c].find(N=>N.id===i)??null,g=f!==null,{pathContextTheaterId:v,pathContext:b,pathContextHydrated:S,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:E,isPathContextDeckOpen:A}=C5(),L=e!==null&&v===e&&S&&b!==null,I=mZ(i)+(f?.preferredExtraWidth??0)+ID(),R=y.useRef(I);R.current=I;const[z,O]=y.useState(vZ),H=y.useRef(z),[F,ae]=y.useState(!1);y.useLayoutEffect(()=>{const N=n.current;if(!N)return;const D=()=>zx(N.getBoundingClientRect().width);D();const T=new ResizeObserver(D);return T.observe(N),()=>{T.disconnect(),zx(0)}},[]),y.useLayoutEffect(()=>{o.current&&!r&&XR(n.current,".command-band-rail-toggle"),o.current=r},[r]),y.useEffect(()=>{b5(e),e&&DD(e,N=>xD(e,N))},[e]);const fe=y.useCallback(N=>{N.preventDefault();const D=N.clientX,T=H.current;ae(!0);const k=B=>{const q=D-B.clientX,J=window.innerWidth-148-R.current,P=Math.max(nN,Math.min(J,T+q));H.current=P,O(P)},j=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",j),ae(!1);try{localStorage.setItem(iN,String(H.current))}catch{}};document.addEventListener("pointermove",k),document.addEventListener("pointerup",j)},[]),V=y.useMemo(()=>({theaterId:e,pathContext:b??_Z,api:t,requestExtraWidth:N=>{i!==null&&OD(i,N)}}),[e,b,t,i]),$=y.useCallback(N=>{e&&S5(e,D=>d5(e,N,D))},[e]);return u.jsxs("div",{ref:n,className:`right-rail${g?" is-open":""}${r?" is-expanded":" is-closed"}${F?" is-dragging":""}${A?" is-context-deck-open":""}`,"data-rail-chrome":r?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!r,style:{"--right-rail-panel-width":`${g?z+I:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:z+I}:void 0,children:[g&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:fe,"aria-hidden":"true"}),f&&u.jsx(bZ,{activePanel:f,activeId:i,ctx:V,theaterId:e,hasHydratedPathContext:L,isPathContextDeckOpen:A,pathContextLoading:w,pathContextMutationInProgress:x,pathContextError:E,onSelectPathContext:$})]}),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(dE,{panel:N,isActive:i===N.id},N.id)),d.length>0&&c.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,c.map(N=>u.jsx(dE,{panel:N,isActive:i===N.id},N.id))]})})]})}const bZ=y.memo(function({activePanel:t,activeId:n,ctx:i,theaterId:r,hasHydratedPathContext:o,isPathContextDeckOpen:c,pathContextLoading:d,pathContextMutationInProgress:p,pathContextError:f,onSelectPathContext:g}){const v=y.useRef(null),b=y.useRef(null),S=y.useRef(!1),w=t.pathAware===!0,x=y.useSyncExternalStore(QE,()=>Ku().theaters.find(I=>I.id===r)?.label??"Theater"),E=RD(w,r,o);y.useEffect(()=>{if(S.current&&!c){const I=requestAnimationFrame(()=>v.current?.focus());return S.current=c,()=>cancelAnimationFrame(I)}S.current=c},[c]),y.useEffect(()=>{if(!c)return;const I=R=>{const z=R.target;!(z instanceof Node)||v.current?.contains(z)||b.current?.contains(z)||df(!1)};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[c]);const A=y.useCallback(()=>df(!1),[]),L=y.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:()=>df(!c),children:[u.jsx("span",{className:"rail-context-title-text",children:t.title}),u.jsx("span",{className:"rail-context-label",title:r===null?"Theater-wide":o?i.pathContext.label:"Loading…",children:r===null?"Theater-wide":o?i.pathContext.label:"Loading…"}),u.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:ND,children:"✕"}),w&&o&&c&&r?u.jsx(_5,{ref:b,theaterId:r,theaterLabel:x,context:i.pathContext,isMutating:p,onSelect:L,onClose:A}):null]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:E?t.render(i):u.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function dE({panel:e,isActive:t}){const n=y.useCallback(()=>LD(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:n,children:i})}const SZ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function wZ(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=Ks(),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,d=e!==null&&t,p=y.useCallback(()=>{WX(),NO()},[]);return y.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 b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&xZ(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!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]),y.useEffect(()=>{if(!d||!r.current||!o.current||!e)return;const f=e.kind,g=f==="drydock"?e.patchId:f==="conflicts"?e.id:void 0;JL(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:g,theaterId:n,onRelatedClick:v=>{$r({kind:"entry",entryId:v}),hf()},onClose:p,onPatchOpen:v=>{$r({kind:"drydock",patchId:v}),hf()},onDecided:()=>{dp(),$r({kind:"drydock",patchId:void 0}),hf()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[d,c]),d?Ha.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),u.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:p,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function xZ(e,t){if(!e)return;const n=[...e.querySelectorAll(SZ)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],r=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}const CZ=Bp().api,gb=560,_b=360,dv=new Set;function kZ({state:e,claimBootPanelMinimization:t}){const n=y.useRef(null),i=eL(),r=Op(),o=nL(),c=nc(),[d,p]=y.useState([]),f=y.useMemo(()=>EZ(e).map(D=>D.id),[e.operations,e.activeTheaterId]),g=y.useRef(e);g.current=e,y.useEffect(()=>{Hq(e.activeTheaterId)},[e.activeTheaterId]),y.useEffect(()=>{if(!e.activeTheaterId){p([]);return}_E().then(p).catch(()=>{})},[e.activeTheaterId]),y.useEffect(()=>{const D={current:i},T={current:r},k=j=>{if(!YO()||!j.altKey||j.metaKey||j.ctrlKey)return;const B=document.activeElement;if(B instanceof HTMLElement&&B.matches("input, textarea, [contenteditable='true']")&&!B.closest(".xterm"))return;if(j.code==="KeyF"&&!j.shiftKey){j.preventDefault(),j.stopImmediatePropagation(),Fq();return}if(j.shiftKey||j.key!=="ArrowLeft"&&j.key!=="ArrowRight")return;const q=g.current,J=Gl(),P=RO(q.operations.filter(Y=>Y.theaterId===q.activeTheaterId),q.groups.filter(Y=>Y.theaterId===q.activeTheaterId),J.operationOrder,J.collapsedGroups,D.current===null?J.minimized:[]);if(j.preventDefault(),j.stopImmediatePropagation(),P.length===0)return;const X=D.current??g.current.activeOperationId,Q=AO(P,X,j.key==="ArrowRight"?1:-1);if(Q){if(D.current){Ui(Q),Fu(Q);return}if(T.current){_u(Q),Ui(Q);return}J.minimized.includes(Q)&&_u(Q),Vu(Q)}};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[r,i]),y.useEffect(()=>{for(const k of f)zq(k);if(!e.operationsHydrated||($q(f),!e.activeTheaterId))return;const D=t(e.activeTheaterId);if(D===null)return;const T=g.current.pendingOperationFocus;Pq(T?D.filter(k=>k!==T):D)},[t,f,e.activeTheaterId,e.operationsHydrated]),y.useEffect(()=>{const D=e.pendingOperationFocus;if(D===null)return;if(eb()!==null){Fu(D),Zg();return}if(cp()){_u(D),Ui(D),Zg();return}Kr();const T=fE(n.current);T&&Ok(D,T),Zg()},[e.pendingOperationFocus]);const v=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(D=>D.theaterId===e.activeTheaterId);const b=y.useCallback((D,T)=>c.plugins.find(j=>j.id===D)?.renderLaunchIcon?.(T)??null,[c.plugins]),S=y.useCallback((D,T,k)=>{if(!g.current.activeTheaterId)return;const j={...pE(k),zIndex:No()};fv(D,T,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),w=y.useCallback((D,T)=>{if(!g.current.activeTheaterId)return;const k=AZ(n.current),j={...pE(k),zIndex:No()};fv(D,T,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),x=y.useCallback((D,T,k)=>{g.current.activeTheaterId&&fv(D,T,k,g.current.activeTheaterId,c.plugins)},[c.plugins]),E=y.useCallback(()=>{sL({x:0,y:0,zoom:1})},[]),A=y.useCallback(D=>{const T=g.current.operations.find(J=>J.id===D);if(!T)return;if(T.theaterId!==g.current.activeTheaterId){Vu(D);return}const k=eb();if(k!==null){Ui(D),k!==D&&Fu(D);return}if(cp()){_u(D),Ui(D);return}const j=Gl(),B=j.operations[D]??T.geometry??TZ(T);j.operations[D]||nb(D,B),_u(D),Ui(D);const q=fE(n.current);q&&Ok(D,q)},[]),L=y.useCallback(D=>{g.current.activeOperationId===D&&Ui(null),rL(D)},[]),I=y.useCallback((D,T)=>{uf(D,{accent:T}).then(()=>Wi(null)).then(cs).catch(()=>{})},[]),R=y.useCallback((D,T)=>{UE(D,T).then(()=>Wi(null)).then(cs).catch(()=>{})},[]),z=y.useCallback((D,T)=>{uf(D,{groupId:T}).then(()=>Wi(null)).then(cs).catch(()=>{})},[]),O=y.useCallback((D,T,k)=>{j4({theaterId:D,name:T,color:"blue"}).then(j=>k?uf(k,{groupId:j.id}).then(()=>{}):void 0).then(()=>Promise.all([Wi(null).then(cs),uo().then(ho)])).catch(()=>{})},[]),H=y.useCallback((D,T)=>{T&&Xg(D,{color:T}).then(()=>uo()).then(ho).catch(()=>{})},[]),F=y.useCallback((D,T)=>{Xg(D,{name:T}).then(()=>uo()).then(ho).catch(()=>{})},[]),ae=y.useCallback(D=>{const T=new Map(g.current.groups.map(j=>[j.id,j])),k=D.flatMap((j,B)=>{const q=T.get(j);return!q||q.order===B?[]:[Xg(j,{order:B})]});k.length!==0&&Promise.allSettled(k).then(()=>uo()).then(ho).catch(()=>{})},[]),fe=y.useCallback(D=>{I4(D).then(()=>Promise.all([Wi(null).then(cs),uo().then(ho)])).catch(()=>{})},[]),V=y.useCallback(D=>{if(dv.has(D))return;dv.add(D);const T=g.current.operations.find(j=>j.id===D)?.pluginId,k=(T?c.plugins.find(j=>j.id===T):null)??null;RZ(D,k).finally(()=>dv.delete(D))},[c.plugins]),$=y.useCallback(async D=>{t5();try{const T=await FE(D),k=await HE(T);n5(k)}catch(T){xv(T instanceof Error?T.message:String(T))}},[]),N=y.useCallback(async D=>{const T=()=>Promise.all([Wi(null).then(cs),uo().then(ho)]).then(()=>{}).catch(()=>{});try{await D4(D),Ix(D),await T()}catch(k){if(k instanceof Vt&&k.status===404){Ix(D),await T();return}xv(k instanceof Error?k.message:String(k))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(MK,{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:b,onLaunchKind:w,onResetView:E,onClose:V,onMinimize:L,onFocus:A,onSetAccent:I,onRename:R,onSetGroupId:z,onCreateGroup:O,onSetGroupColor:H,onRenameGroup:F,onReorderGroups:ae,onUngroupAll:fe,onSelectTheater:CO,onAddTheater:$,onCancelAddTheater:TO,onForgetTheater:N}),u.jsx("div",{className:"operations-center-stage",ref:n,children:u.jsx(UY,{state:e,catalog:d,canLaunch:v,renderKindIcon:b,onLaunchKind:S,onLaunchAtGeometry:x,onClose:V,onFocus:A,onRename:R,onSetAccent:I})}),u.jsx(yZ,{theaterId:e.activeTheaterId,api:CZ}),u.jsx(wZ,{})]})}function EZ(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Cv)}function fE(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function TZ(e){return e.geometry??{x:0,y:0,width:gb,height:_b,zIndex:0}}function AZ(e){const t=Gl(),n=e?.clientWidth??800,i=e?.clientHeight??600;return lh({x:n/2,y:i/2},t.viewport)}function pE(e){return{x:e.x-gb/2,y:e.y-_b/2,width:gb,height:_b}}async function fv(e,t,n,i,r){const o=r.find(v=>v.id===e),d=Bp(()=>{Wi(null).then(cs).catch(()=>{})});let p=null;if(o?.launch?p=(await o.launch({theaterId:i,kind:t,geometry:n,operations:d.operations})).id:p=(await d.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Wi(null).then(cs).catch(()=>{}),!p)return;const f=Dq()===i,g=Ku().operations.some(v=>v.id===p);f&&g&&eb()!==null?(Ui(p),Fu(p)):Vu(p)}async function RZ(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Wi(null).then(cs).catch(()=>{})}const LZ=3e4;let of=1e3,yu=null,pv=null,mv=!1;function sN(){yu!==null&&(clearTimeout(yu),yu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);NZ(i.operation)&&xO(i.operation)}catch{}}),e.addEventListener("update:available",()=>{uh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{EL(JSON.parse(n.data))}catch{Uk()}}),e.onopen=()=>{of=1e3,uh()},e.onerror=()=>{e.close(),Uk(),yu=setTimeout(()=>{yu=null,of=Math.min(of*2,LZ),Wi().then(cs).catch(()=>{}).finally(sN)},of)}}function uh(){if(pv){mv=!0;return}pv=T4(Ku().activeTheaterId).then(fO).catch(()=>{}).finally(()=>{pv=null,mv&&(mv=!1,uh())})}function NZ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const MZ=6e3;function OZ(){const e=Ks(),t=y.useRef(new Set),n=y.useRef(null),i=Ds(),r=nc(),o=I0(),c=jL(o.state?.language??"auto"),p=i.pathname.startsWith("/operations"),f=y.useCallback(g=>n.current===null||t.current.has(g)?null:(t.current.add(g),n.current),[]);return y.useEffect(()=>{const g=Bp(()=>{Wi().then(cs).catch(()=>{})}),v=r.plugins.map(b=>b.install?.(g)).filter(b=>typeof b=="function");return()=>{for(const b of v)b()}},[r.plugins]),y.useEffect(()=>{dO(p)},[p]),y.useEffect(()=>{const g=new AbortController;E4(g.signal).then(S=>{SO(S),jx()}).catch(S=>{g.signal.aborted||(lt({theaterError:S instanceof Error?S.message:String(S)}),jx())});const v=Date.now();Wi(null,g.signal).then(S=>{n.current=S.filter(w=>w.ts.createdAt<v).map(w=>w.id),wO(S)}).catch(()=>{}),uo(null,g.signal).then(ho).catch(()=>{}),uh();const b=window.setTimeout(uh,MZ);return()=>{window.clearTimeout(b),g.abort()}},[]),y.useEffect(()=>(DL({locale:c}),wV),[c]),y.useEffect(()=>jV({getSideBarCollapsed:()=>ab().collapsed,setSideBarCollapsed:D0,toggleOperationSearch:s5,toggleRailChrome:y5}),[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(QK,{operationsViewVisible:p}),u.jsx("main",{className:"console-route-content",children:u.jsxs(G6,{children:[u.jsx(wl,{path:"/",element:u.jsx(Vg,{to:"/operations",replace:!0})}),u.jsx(wl,{path:"/operations",element:u.jsx(kZ,{state:e,claimBootPanelMinimization:f})}),u.jsx(wl,{path:"/carrier-settings",element:u.jsx(Vg,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),u.jsx(wl,{path:"/settings",element:u.jsx(QV,{})}),u.jsx(wl,{path:"*",element:u.jsx(Vg,{to:"/operations",replace:!0})})]})}),u.jsx(cV,{state:e}),u.jsx(LV,{state:e}),u.jsx(aV,{state:e}),u.jsx(mV,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Lf,"react/jsx-runtime":u3,"@fleet-console/sdk/plugin/browser":L3,"@fleet-console/sdk/settings/browser":B3,"@fleet-console/sdk/operations/browser":v3,"@fleet-console/sdk/notifications/browser":z3,"@fleet-console/sdk/react/browser":H3};If("instrument");vO();try{const e=await LL();If(e.theme),wv(e.uiFont),yV(e)}catch{}const DZ=await nq();sN();const mE=document.querySelector("#app");mE&&K3.createRoot(mE).render(u.jsx(y.StrictMode,{children:u.jsx(m4,{basename:"/console",children:u.jsx(tq,{value:DZ,children:u.jsx(OZ,{})})})}));export{vU as _,jZ as a,vb as g,Ut as k,$u as p};
|