@dotobokuri/fleet-console 1.30.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +35 -11
- package/dist/client/assets/{_baseUniq-Dvbxpxj-.js → _baseUniq-6rANA-_q.js} +1 -1
- package/dist/client/assets/{arc-Cqerxs8I.js → arc-tzTBQuJE.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-gNhmCKnU.js → architectureDiagram-Q4EWVU46-B4MzTga_.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-CM5HRpKC.js → blockDiagram-DXYQGD6D-BSkil4Kq.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-DxLhQuvg.js → c4Diagram-AHTNJAMY-Dwq5nIR_.js} +1 -1
- package/dist/client/assets/channel-DGrgEBwr.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-HX6C_GAC.js → chunk-4BX2VUAB-BGefUfmP.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CoBQUhS4.js → chunk-4TB4RGXK-DBUtBigu.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DWsWxGBm.js → chunk-55IACEB6-BLF4uUa8.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-BXNRu1M4.js → chunk-EDXVE4YY-Cc41I6y_.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DzKgP1_A.js → chunk-FMBD7UC4-C8PUZ57p.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-aqXdvKUD.js → chunk-OYMX7WX6-CYos7ODp.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BbMqaUb0.js → chunk-QZHKN3VN-I4gCcbsX.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-D8Mo0nv8.js → chunk-YZCP3GAM-CO0vuwK9.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CKhx9oUH.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CKhx9oUH.js +1 -0
- package/dist/client/assets/clone-BODjA13N.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BOuVjjXz.js → cose-bilkent-S5V4N54A-BjXxkeBn.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-BdUFzAj_.js → dagre-KV5264BT-DKVbTDmI.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-C0iFrsGo.js → diagram-5BDNPKRD-C1as30xl.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-CGxGeQZt.js → diagram-G4DWMVQ6-B_G7-yDL.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-Dex5uqlA.js → diagram-MMDJMWI5-B2srczqP.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-O48PEpaS.js → diagram-TYMM5635-pYQydnR9.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-B7PGw3YA.js → erDiagram-SMLLAGMA-AcmG-sIC.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-CCXWJIMw.js → flowDiagram-DWJPFMVM-BRvh-u54.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B26RghpR.js → ganttDiagram-T4ZO3ILL-CuyxaGr-.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-BJsjMn6A.js → gitGraphDiagram-UUTBAWPF-BWFXSUkW.js} +1 -1
- package/dist/client/assets/{graph-DuEL0RWH.js → graph-BFw4pMat.js} +1 -1
- package/dist/client/assets/index-DD3oRP6t.css +1 -0
- package/dist/client/assets/index-qutkoA_F.js +451 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-D32dz1SM.js → infoDiagram-42DDH7IO-CgrEFkpl.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-4YPQjln0.js → ishikawaDiagram-UXIWVN3A-C1PYBJVn.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-BSvi22HM.js → journeyDiagram-VCZTEJTY-BHC_QZyQ.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-SozOXS7m.js → kanban-definition-6JOO6SKY-BTQZjl-H.js} +1 -1
- package/dist/client/assets/{layout-CNXntIRV.js → layout-LyiAOink.js} +1 -1
- package/dist/client/assets/{linear-9RZPFtO4.js → linear-BWduiQJJ.js} +1 -1
- package/dist/client/assets/{mermaid.core-kwH-UxKY.js → mermaid.core-B2Lf_dRe.js} +4 -4
- package/dist/client/assets/{min-BdN2p8Q_.js → min-BS4WshjZ.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-H-3dJmH9.js → mindmap-definition-QFDTVHPH-uBQw-Rcf.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-CspzYvcs.js → pieDiagram-DEJITSTG-Daco6XeA.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D1C7e3-s.js → quadrantDiagram-34T5L4WZ-phmU55Tk.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-BJwKRtMi.js → requirementDiagram-MS252O5E-D7WmHJB1.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-7oc42Z3P.js → sankeyDiagram-XADWPNL6-QmItdHVw.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-TP5H_DnF.js → sequenceDiagram-FGHM5R23-B-Wgp5TP.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-BWnrNgJY.js → stateDiagram-FHFEXIEX-J7H1J8u1.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D0qZOg43.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-xXFvCsrr.js → timeline-definition-GMOUNBTQ-BI_kLbxz.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-D5unm_iH.js → vennDiagram-DHZGUBPP-Do5nm7Eq.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-B-eT02rs.js → wardley-RL74JXVD-DvA1fdMU.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BTQ1Yqmb.js → wardleyDiagram-NUSXRM2D-BrigyBQU.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-Bialvg0l.js → xychartDiagram-5P7HB3ND-B0Inv_Uf.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/repository/routes.mjs +216 -11
- package/dist/fleet-plugins/skills/routes.mjs +35 -11
- package/dist/fleet-plugins/terminal/routes.mjs +83 -61
- package/package.json +1 -1
- package/dist/client/assets/channel-DKkQpLWI.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CQurO5ix.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CQurO5ix.js +0 -1
- package/dist/client/assets/clone-IodjsAGU.js +0 -1
- package/dist/client/assets/index-Dj775lUe.css +0 -1
- package/dist/client/assets/index-r6rDZQCs.js +0 -451
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Cmp8tobq.js +0 -1
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
function C5(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 u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).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 Wb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yee(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 r_={exports:{}},uu={};var rC;function O6(){if(rC)return uu;rC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var u=null;if(o!==void 0&&(u=""+o),r.key!==void 0&&(u=""+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:u,ref:r!==void 0?r:null,props:o}}return uu.Fragment=t,uu.jsx=n,uu.jsxs=n,uu}var aC;function D6(){return aC||(aC=1,r_.exports=O6()),r_.exports}var c=D6();const I6=Wb(c),B6=C5({__proto__:null,default:I6},[c]);var a_={exports:{}},mt={};var oC;function $6(){if(oC)return mt;oC=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"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=b&&A[b]||A["@@iterator"],typeof A=="function"?A:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function O(A,Y,J){this.props=A,this.context=Y,this.refs=k,this.updater=J||w}O.prototype.isReactComponent={},O.prototype.setState=function(A,Y){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,Y,"setState")},O.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function P(){}P.prototype=O.prototype;function F(A,Y,J){this.props=A,this.context=Y,this.refs=k,this.updater=J||w}var T=F.prototype=new P;T.constructor=F,x(T,O.prototype),T.isPureReactComponent=!0;var L=Array.isArray;function M(){}var z={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Z(A,Y,J){var he=J.ref;return{$$typeof:e,type:A,key:Y,ref:he!==void 0?he:null,props:J}}function Q(A,Y){return Z(A.type,Y,A.props)}function G(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function B(A){var Y={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(J){return Y[J]})}var R=/\/+/g;function D(A,Y){return typeof A=="object"&&A!==null&&A.key!=null?B(""+A.key):Y.toString(36)}function N(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(M,M):(A.status="pending",A.then(function(Y){A.status==="pending"&&(A.status="fulfilled",A.value=Y)},function(Y){A.status==="pending"&&(A.status="rejected",A.reason=Y)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function E(A,Y,J,he,de){var ae=typeof A;(ae==="undefined"||ae==="boolean")&&(A=null);var we=!1;if(A===null)we=!0;else switch(ae){case"bigint":case"string":case"number":we=!0;break;case"object":switch(A.$$typeof){case e:case t:we=!0;break;case m:return we=A._init,E(we(A._payload),Y,J,he,de)}}if(we)return de=de(A),we=he===""?"."+D(A,0):he,L(de)?(J="",we!=null&&(J=we.replace(R,"$&/")+"/"),E(de,Y,J,"",function(We){return We})):de!=null&&(G(de)&&(de=Q(de,J+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(R,"$&/")+"/")+we)),Y.push(de)),1;we=0;var je=he===""?".":he+":";if(L(A))for(var De=0;De<A.length;De++)he=A[De],ae=je+D(he,De),we+=E(he,Y,J,ae,de);else if(De=S(A),typeof De=="function")for(A=De.call(A),De=0;!(he=A.next()).done;)he=he.value,ae=je+D(he,De++),we+=E(he,Y,J,ae,de);else if(ae==="object"){if(typeof A.then=="function")return E(N(A),Y,J,he,de);throw Y=String(A),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return we}function $(A,Y,J){if(A==null)return A;var he=[],de=0;return E(A,he,"","",function(ae){return Y.call(J,ae,de++)}),he}function j(A){if(A._status===-1){var Y=A._result;Y=Y(),Y.then(function(J){(A._status===0||A._status===-1)&&(A._status=1,A._result=J)},function(J){(A._status===0||A._status===-1)&&(A._status=2,A._result=J)}),A._status===-1&&(A._status=0,A._result=Y)}if(A._status===1)return A._result.default;throw A._result}var q=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},H={map:$,forEach:function(A,Y,J){$(A,function(){Y.apply(this,arguments)},J)},count:function(A){var Y=0;return $(A,function(){Y++}),Y},toArray:function(A){return $(A,function(Y){return Y})||[]},only:function(A){if(!G(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return mt.Activity=_,mt.Children=H,mt.Component=O,mt.Fragment=n,mt.Profiler=r,mt.PureComponent=F,mt.StrictMode=i,mt.Suspense=f,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,mt.__COMPILER_RUNTIME={__proto__:null,c:function(A){return z.H.useMemoCache(A)}},mt.cache=function(A){return function(){return A.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(A,Y,J){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var he=x({},A.props),de=A.key;if(Y!=null)for(ae in Y.key!==void 0&&(de=""+Y.key),Y)!U.call(Y,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&Y.ref===void 0||(he[ae]=Y[ae]);var ae=arguments.length-2;if(ae===1)he.children=J;else if(1<ae){for(var we=Array(ae),je=0;je<ae;je++)we[je]=arguments[je+2];he.children=we}return Z(A.type,de,he)},mt.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:o,_context:A},A},mt.createElement=function(A,Y,J){var he,de={},ae=null;if(Y!=null)for(he in Y.key!==void 0&&(ae=""+Y.key),Y)U.call(Y,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(de[he]=Y[he]);var we=arguments.length-2;if(we===1)de.children=J;else if(1<we){for(var je=Array(we),De=0;De<we;De++)je[De]=arguments[De+2];de.children=je}if(A&&A.defaultProps)for(he in we=A.defaultProps,we)de[he]===void 0&&(de[he]=we[he]);return Z(A,ae,de)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(A){return{$$typeof:d,render:A}},mt.isValidElement=G,mt.lazy=function(A){return{$$typeof:m,_payload:{_status:-1,_result:A},_init:j}},mt.memo=function(A,Y){return{$$typeof:p,type:A,compare:Y===void 0?null:Y}},mt.startTransition=function(A){var Y=z.T,J={};z.T=J;try{var he=A(),de=z.S;de!==null&&de(J,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(M,q)}catch(ae){q(ae)}finally{Y!==null&&J.types!==null&&(Y.types=J.types),z.T=Y}},mt.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},mt.use=function(A){return z.H.use(A)},mt.useActionState=function(A,Y,J){return z.H.useActionState(A,Y,J)},mt.useCallback=function(A,Y){return z.H.useCallback(A,Y)},mt.useContext=function(A){return z.H.useContext(A)},mt.useDebugValue=function(){},mt.useDeferredValue=function(A,Y){return z.H.useDeferredValue(A,Y)},mt.useEffect=function(A,Y){return z.H.useEffect(A,Y)},mt.useEffectEvent=function(A){return z.H.useEffectEvent(A)},mt.useId=function(){return z.H.useId()},mt.useImperativeHandle=function(A,Y,J){return z.H.useImperativeHandle(A,Y,J)},mt.useInsertionEffect=function(A,Y){return z.H.useInsertionEffect(A,Y)},mt.useLayoutEffect=function(A,Y){return z.H.useLayoutEffect(A,Y)},mt.useMemo=function(A,Y){return z.H.useMemo(A,Y)},mt.useOptimistic=function(A,Y){return z.H.useOptimistic(A,Y)},mt.useReducer=function(A,Y,J){return z.H.useReducer(A,Y,J)},mt.useRef=function(A){return z.H.useRef(A)},mt.useState=function(A){return z.H.useState(A)},mt.useSyncExternalStore=function(A,Y,J){return z.H.useSyncExternalStore(A,Y,J)},mt.useTransition=function(){return z.H.useTransition()},mt.version="19.2.7",mt}var lC;function qb(){return lC||(lC=1,a_.exports=$6()),a_.exports}var y=qb();const P6=Wb(y),qf=C5({__proto__:null,default:P6},[y]),z6="fc-operation-body";let Ai=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function k5(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Ai(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(F6).filter(i=>i!==null):[]}function Gf(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)||E5(t))throw new Ai(500,"Invalid operation response");return t}function E5(e){return zv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function H6({children:e,className:t}){return c.jsx("div",{className:W6(z6,t),children:e})}function F6(e){if(!T5(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(U6).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function U6(e){return!T5(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 T5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>zv(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||zv(i,t))}function W6(...e){return e.filter(t=>!!t).join(" ")}const q6=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Ai,OperationBody:H6,assertOperationNode:Gf,fetchOperationCatalog:k5,hasForbiddenBrowserPayloadKey:E5},Symbol.toStringTag,{value:"Module"}));function G6(e){return e}function K6(e){return e}function A5(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(o_(n,i),r).then(Q6),subscribe:(n,i,r)=>{const o=new EventSource(o_(n,i));o.onmessage=r;const u=()=>o.close();return t.add(u),()=>{u(),t.delete(u)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const u=await fetch(o_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!u.ok)throw new Ai(u.status,`Terminal ticket request failed: ${u.status}`);const d=await u.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new Ai(u.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 Ai(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return Gf(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 Ai(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Gf(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Ai(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>t4(n,i),write:(n,i)=>n4(n,i)},settings:{read:async n=>{const i=await fetch(cC(n));if(!i.ok)throw new Ai(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(cC(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Ai(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function R5(e,t){return y.useSyncExternalStore(e,t,t)}function V6(){const[e,t]=y.useState([]),n=y.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Ai(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(Gf):[])},[]);return y.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function Y6(e,t){return y.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function X6(e,t){return y.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function Z6(e,t,n){const[i,r]=y.useState(()=>e.read(t,n)),o=y.useCallback(u=>{r(u),e.write(t,u)},[e,t]);return[i,o]}function J6(e,t){return y.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function Q6(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Ai(e.status,`Plugin request failed: ${e.status}`,t)}return e}function o_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Ai(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Ai(400,"Invalid plugin path");return`/plugins/${e}${n}`}const e4=/^[a-z0-9][a-z0-9._-]*$/;function cC(e){if(!e4.test(e))throw new Ai(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function t4(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 n4(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const i4=Object.freeze(Object.defineProperty({__proto__:null,React:qf,createClientCapabilities:A5,defineOperationKind:K6,definePlugin:G6,useOperationStatus:J6,useOperations:V6,usePluginApi:Y6,usePluginSettings:X6,usePluginStorage:Z6,useStoreSnapshot:R5},Symbol.toStringTag,{value:"Module"}));function s4(e){return e}function r4({title:e,description:t,children:n}){return c.jsxs("section",{className:"fc-settings-card",children:[e?c.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?c.jsx("p",{className:"fc-settings-card__desc",children:t}):null,c.jsx("div",{className:"fc-settings-card__body",children:n})]})}function a4({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return c.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsxs("div",{className:"fc-settings-row__copy",children:[c.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),c.jsx("div",{className:"fc-settings-row__control",children:n})]})}function o4({checked:e,onChange:t,label:n,disabled:i=!1}){const r=y.useId();return c.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[c.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)}),c.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?c.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function l4({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=y.useId(),u=c.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=>c.jsx("option",{value:d.value,children:d.label},d.value))});return i?c.jsxs("label",{className:"fc-settings-select",htmlFor:o,children:[c.jsx("span",{className:"fc-settings-select__label",children:i}),u]}):c.jsx("div",{className:"fc-settings-select",children:u})}function c4({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return c.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,c.jsx("div",{className:"fc-settings-field__control",children:n})]})}const u4=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:r4,SettingsField:c4,SettingsRow:a4,SettingsSelect:l4,SettingsToggle:o4,defineSettingsSection:s4},Symbol.toStringTag,{value:"Module"}));function h4(e){return e}const d4=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:h4},Symbol.toStringTag,{value:"Module"})),f4=c.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Kf 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??f4:this.props.children}}const p4=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Kf,React:qf,default:qf},Symbol.toStringTag,{value:"Module"}));var l_={exports:{}},hu={},c_={exports:{}},u_={};var uC;function m4(){return uC||(uC=1,(function(e){function t(E,$){var j=E.length;E.push($);e:for(;0<j;){var q=j-1>>>1,H=E[q];if(0<r(H,$))E[q]=$,E[j]=H,j=q;else break e}}function n(E){return E.length===0?null:E[0]}function i(E){if(E.length===0)return null;var $=E[0],j=E.pop();if(j!==$){E[0]=j;e:for(var q=0,H=E.length,A=H>>>1;q<A;){var Y=2*(q+1)-1,J=E[Y],he=Y+1,de=E[he];if(0>r(J,j))he<H&&0>r(de,J)?(E[q]=de,E[he]=j,q=he):(E[q]=J,E[Y]=j,q=Y);else if(he<H&&0>r(de,j))E[q]=de,E[he]=j,q=he;else break e}}return $}function r(E,$){var j=E.sortIndex-$.sortIndex;return j!==0?j:E.id-$.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 u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],p=[],m=1,_=null,b=3,S=!1,w=!1,x=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function T(E){for(var $=n(p);$!==null;){if($.callback===null)i(p);else if($.startTime<=E)i(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=n(p)}}function L(E){if(x=!1,T(E),!w)if(n(f)!==null)w=!0,M||(M=!0,B());else{var $=n(p);$!==null&&N(L,$.startTime-E)}}var M=!1,z=-1,U=5,Z=-1;function Q(){return k?!0:!(e.unstable_now()-Z<U)}function G(){if(k=!1,M){var E=e.unstable_now();Z=E;var $=!0;try{e:{w=!1,x&&(x=!1,P(z),z=-1),S=!0;var j=b;try{t:{for(T(E),_=n(f);_!==null&&!(_.expirationTime>E&&Q());){var q=_.callback;if(typeof q=="function"){_.callback=null,b=_.priorityLevel;var H=q(_.expirationTime<=E);if(E=e.unstable_now(),typeof H=="function"){_.callback=H,T(E),$=!0;break t}_===n(f)&&i(f),T(E)}else i(f);_=n(f)}if(_!==null)$=!0;else{var A=n(p);A!==null&&N(L,A.startTime-E),$=!1}}break e}finally{_=null,b=j,S=!1}$=void 0}}finally{$?B():M=!1}}}var B;if(typeof F=="function")B=function(){F(G)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,D=R.port2;R.port1.onmessage=G,B=function(){D.postMessage(null)}}else B=function(){O(G,0)};function N(E,$){z=O(function(){E(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(E){switch(b){case 1:case 2:case 3:var $=3;break;default:$=b}var j=b;b=$;try{return E()}finally{b=j}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(E,$){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var j=b;b=E;try{return $()}finally{b=j}},e.unstable_scheduleCallback=function(E,$,j){var q=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?q+j:q):j=q,E){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=j+H,E={id:m++,callback:$,priorityLevel:E,startTime:j,expirationTime:H,sortIndex:-1},j>q?(E.sortIndex=j,t(p,E),n(f)===null&&E===n(p)&&(x?(P(z),z=-1):x=!0,N(L,j-q))):(E.sortIndex=H,t(f,E),w||S||(w=!0,M||(M=!0,B()))),E},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(E){var $=b;return function(){var j=b;b=$;try{return E.apply(this,arguments)}finally{b=j}}}})(u_)),u_}var hC;function g4(){return hC||(hC=1,c_.exports=m4()),c_.exports}var h_={exports:{}},Ei={};var dC;function _4(){if(dC)return Ei;dC=1;var e=qb();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+p+" 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(f,p,m){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:_==null?null:""+_,children:f,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ei.createPortal=function(f,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return o(f,p,null,m)},Ei.flushSync=function(f){var p=u.T,m=i.p;try{if(u.T=null,i.p=2,f)return f()}finally{u.T=p,i.p=m,i.d.f()}},Ei.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(f,p))},Ei.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},Ei.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,_=d(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?i.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:S}):m==="script"&&i.d.X(f,{crossOrigin:_,integrity:b,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ei.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=d(p.as,p.crossOrigin);i.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(f)},Ei.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,_=d(m,p.crossOrigin);i.d.L(f,m,{crossOrigin:_,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ei.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=d(p.as,p.crossOrigin);i.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(f)},Ei.requestFormReset=function(f){i.d.r(f)},Ei.unstable_batchedUpdates=function(f,p){return f(p)},Ei.useFormState=function(f,p,m){return u.H.useFormState(f,p,m)},Ei.useFormStatus=function(){return u.H.useHostTransitionStatus()},Ei.version="19.2.7",Ei}var fC;function N5(){if(fC)return h_.exports;fC=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(),h_.exports=_4(),h_.exports}var pC;function v4(){if(pC)return hu;pC=1;var e=g4(),t=qb(),n=N5();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function u(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 f(s){if(o(s)!==s)throw Error(i(188))}function p(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 g=l.return;if(g===null)break;var v=g.alternate;if(v===null){if(h=g.return,h!==null){l=h;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===l)return f(g),s;if(v===h)return f(g),a;v=v.sibling}throw Error(i(188))}if(l.return!==h.return)l=g,h=v;else{for(var C=!1,I=g.child;I;){if(I===l){C=!0,l=g,h=v;break}if(I===h){C=!0,h=g,l=v;break}I=I.sibling}if(!C){for(I=v.child;I;){if(I===l){C=!0,l=v,h=g;break}if(I===h){C=!0,h=v,l=g;break}I=I.sibling}if(!C)throw Error(i(189))}}if(l.alternate!==h)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function m(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=m(s),a!==null)return a;s=s.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),F=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function B(s){return s===null||typeof s!="object"?null:(s=G&&s[G]||s["@@iterator"],typeof s=="function"?s:null)}var R=Symbol.for("react.client.reference");function D(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===R?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case O:return"Profiler";case k:return"StrictMode";case L:return"Suspense";case M:return"SuspenseList";case Z:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case F:return s.displayName||"Context";case P:return(s._context.displayName||"Context")+".Consumer";case T:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case z:return a=s.displayName||null,a!==null?a:D(s.type)||"Memo";case U:a=s._payload,s=s._init;try{return D(s(a))}catch{}}return null}var N=Array.isArray,E=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j={pending:!1,data:null,method:null,action:null},q=[],H=-1;function A(s){return{current:s}}function Y(s){0>H||(s.current=q[H],q[H]=null,H--)}function J(s,a){H++,q[H]=s.current,s.current=a}var he=A(null),de=A(null),ae=A(null),we=A(null);function je(s,a){switch(J(ae,a),J(de,s),J(he,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Ax(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Ax(a),s=Rx(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Y(he),J(he,s)}function De(){Y(he),Y(de),Y(ae)}function We(s){s.memoizedState!==null&&J(we,s);var a=he.current,l=Rx(a,s.type);a!==l&&(J(de,s),J(he,l))}function ke(s){de.current===s&&(Y(he),Y(de)),we.current===s&&(Y(we),au._currentValue=j)}var Le,Ae;function Me(s){if(Le===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Le=a&&a[1]||"",Ae=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Le+s+Ae}var et=!1;function dt(s,a){if(!s||et)return"";et=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(ue){var re=ue}Reflect.construct(s,[],_e)}else{try{_e.call()}catch(ue){re=ue}s.call(_e.prototype)}}else{try{throw Error()}catch(ue){re=ue}(_e=s())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(ue){if(ue&&re&&typeof ue.stack=="string")return[ue.stack,re.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=h.DetermineComponentFrameRoot(),C=v[0],I=v[1];if(C&&I){var V=C.split(`
|
|
4
|
+
`),se=I.split(`
|
|
5
|
+
`);for(g=h=0;h<V.length&&!V[h].includes("DetermineComponentFrameRoot");)h++;for(;g<se.length&&!se[g].includes("DetermineComponentFrameRoot");)g++;if(h===V.length||g===se.length)for(h=V.length-1,g=se.length-1;1<=h&&0<=g&&V[h]!==se[g];)g--;for(;1<=h&&0<=g;h--,g--)if(V[h]!==se[g]){if(h!==1||g!==1)do if(h--,g--,0>g||V[h]!==se[g]){var me=`
|
|
6
|
+
`+V[h].replace(" at new "," at ");return s.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",s.displayName)),me}while(1<=h&&0<=g);break}}}finally{et=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Me(l):""}function Je(s,a){switch(s.tag){case 26:case 27:case 5:return Me(s.type);case 16:return Me("Lazy");case 13:return s.child!==a&&a!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return dt(s.type,!1);case 11:return dt(s.type.render,!1);case 1:return dt(s.type,!0);case 31:return Me("Activity");default:return""}}function oe(s){try{var a="",l=null;do a+=Je(s,l),l=s,s=s.return;while(s);return a}catch(h){return`
|
|
7
|
+
Error generating stack: `+h.message+`
|
|
8
|
+
`+h.stack}}var qe=Object.prototype.hasOwnProperty,Ye=e.unstable_scheduleCallback,Mt=e.unstable_cancelCallback,Wt=e.unstable_shouldYield,hn=e.unstable_requestPaint,ct=e.unstable_now,Yt=e.unstable_getCurrentPriorityLevel,bt=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Qe=e.unstable_NormalPriority,Ne=e.unstable_LowPriority,Ce=e.unstable_IdlePriority,ut=e.log,dn=e.unstable_setDisableYieldValue,jt=null,ne=null;function ce(s){if(typeof ut=="function"&&dn(s),ne&&typeof ne.setStrictMode=="function")try{ne.setStrictMode(jt,s)}catch{}}var $e=Math.clz32?Math.clz32:Ht,Oe=Math.log,Ge=Math.LN2;function Ht(s){return s>>>=0,s===0?32:31-(Oe(s)/Ge|0)|0}var pi=256,Ft=262144,On=4194304;function yn(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 K(s,a,l){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var I=h&134217727;return I!==0?(h=I&~v,h!==0?g=yn(h):(C&=I,C!==0?g=yn(C):l||(l=I&~s,l!==0&&(g=yn(l))))):(I=h&~v,I!==0?g=yn(I):C!==0?g=yn(C):l||(l=h&~s,l!==0&&(g=yn(l)))),g===0?0:a!==0&&a!==g&&(a&v)===0&&(v=g&-g,l=a&-a,v>=l||v===32&&(l&4194048)!==0)?a:g}function pe(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function be(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xe(){var s=On;return On<<=1,(On&62914560)===0&&(On=4194304),s}function qt(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 Be(s,a,l,h,g,v){var C=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var I=s.entanglements,V=s.expirationTimes,se=s.hiddenUpdates;for(l=C&~l;0<l;){var me=31-$e(l),_e=1<<me;I[me]=0,V[me]=-1;var re=se[me];if(re!==null)for(se[me]=null,me=0;me<re.length;me++){var ue=re[me];ue!==null&&(ue.lane&=-536870913)}l&=~_e}h!==0&&Ie(s,h,0),v!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=v&~(C&~a))}function Ie(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-$e(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|l&261930}function nt(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var h=31-$e(l),g=1<<h;g&a|s[h]&a&&(s[h]|=a),l&=~g}}function ln(s,a){var l=a&-a;return l=(l&42)!==0?1:Ct(l),(l&(s.suspendedLanes|a))!==0?0:l}function Ct(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 Yn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function vs(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:Jx(s.type))}function Ps(s,a){var l=$.p;try{return $.p=s,a()}finally{$.p=l}}var Ci=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ci,Ut="__reactProps$"+Ci,Hi="__reactContainer$"+Ci,zs="__reactEvents$"+Ci,wr="__reactListeners$"+Ci,le="__reactHandles$"+Ci,at="__reactResources$"+Ci,Xt="__reactMarker$"+Ci;function xe(s){delete s[rn],delete s[Ut],delete s[zs],delete s[wr],delete s[le]}function W(s){var a=s[rn];if(a)return a;for(var l=s.parentNode;l;){if(a=l[Hi]||l[rn]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Ix(s);s!==null;){if(l=s[rn])return l;s=Ix(s)}return a}s=l,l=s.parentNode}return null}function fe(s){if(s=s[rn]||s[Hi]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Ee(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function ot(s){var a=s[at];return a||(a=s[at]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ft(s){s[Xt]=!0}var He=new Set,Ot={};function Dt(s,a){ye(s,a),ye(s+"Capture",a)}function ye(s,a){for(Ot[s]=a,s=0;s<a.length;s++)He.add(a[s])}var ze=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]*$"),Ue={},pt={};function Zt(s){return qe.call(pt,s)?!0:qe.call(Ue,s)?!1:ze.test(s)?pt[s]=!0:(Ue[s]=!0,!1)}function $n(s,a,l){if(Zt(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 cn(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 ti(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 Jt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ki(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Vo(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 g=h.get,v=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return g.call(this)},set:function(C){l=""+C,v.call(this,C)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return l},setValue:function(C){l=""+C},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function na(s){if(!s._valueTracker){var a=ki(s)?"checked":"value";s._valueTracker=Vo(s,a,""+s[a])}}function Qa(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return s&&(h=ki(s)?s.checked?"true":"false":s.value),s=h,s!==l?(a.setValue(s),!0):!1}function Yo(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 sm=/[\n"\\]/g;function Fi(s){return s.replace(sm,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function bc(s,a,l,h,g,v,C,I){s.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.type=C:s.removeAttribute("type"),a!=null?C==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Jt(a)):s.value!==""+Jt(a)&&(s.value=""+Jt(a)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),a!=null?Xo(s,C,Jt(a)):l!=null?Xo(s,C,Jt(l)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+Jt(I):s.removeAttribute("name")}function eo(s,a,l,h,g,v,C,I){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),a!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){na(s);return}l=l!=null?""+Jt(l):"",a=a!=null?""+Jt(a):l,I||a===s.value||(s.value=a),s.defaultValue=a}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=I?s.checked:!!h,s.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),na(s)}function Xo(s,a,l){a==="number"&&Yo(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function mi(s,a,l,h){if(s=s.options,a){a={};for(var g=0;g<l.length;g++)a["$"+l[g]]=!0;for(l=0;l<s.length;l++)g=a.hasOwnProperty("$"+s[l].value),s[l].selected!==g&&(s[l].selected=g),g&&h&&(s[l].defaultSelected=!0)}else{for(l=""+Jt(l),a=null,g=0;g<s.length;g++){if(s[g].value===l){s[g].selected=!0,h&&(s[g].defaultSelected=!0);return}a!==null||s[g].disabled||(a=s[g])}a!==null&&(a.selected=!0)}}function Lh(s,a,l){if(a!=null&&(a=""+Jt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+Jt(l):""}function Zo(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(N(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=Jt(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),na(s)}function rt(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Mh=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 Pn(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||Mh.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Gt(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 g in a)h=a[g],a.hasOwnProperty(g)&&l[g]!==h&&Pn(s,g,h)}else for(var v in a)a.hasOwnProperty(v)&&Pn(s,v,a[v])}function ia(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 xr=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"]]),Sc=/^[\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 sa(s){return Sc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Re(){}var Ke=null;function gt(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var At=null,xn=null;function ys(s){var a=fe(s);if(a&&(s=a.stateNode)){var l=s[Ut]||null;e:switch(s=a.stateNode,a.type){case"input":if(bc(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="'+Fi(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==s&&h.form===s.form){var g=h[Ut]||null;if(!g)throw Error(i(90));bc(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<l.length;a++)h=l[a],h.form===s.form&&Qa(h)}break e;case"textarea":Lh(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&mi(s,!!l.multiple,a,!1)}}}var wc=!1;function jh(s,a,l){if(wc)return s(a,l);wc=!0;try{var h=s(a);return h}finally{if(wc=!1,(At!==null||xn!==null)&&(bd(),At&&(a=At,s=xn,xn=At=null,ys(a),s)))for(a=0;a<s.length;a++)ys(s[a])}}function xc(s,a){var l=s.stateNode;if(l===null)return null;var h=l[Ut]||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 Cr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rm=!1;if(Cr)try{var Cc={};Object.defineProperty(Cc,"passive",{get:function(){rm=!0}}),window.addEventListener("test",Cc,Cc),window.removeEventListener("test",Cc,Cc)}catch{rm=!1}var ra=null,am=null,Oh=null;function R1(){if(Oh)return Oh;var s,a=am,l=a.length,h,g="value"in ra?ra.value:ra.textContent,v=g.length;for(s=0;s<l&&a[s]===g[s];s++);var C=l-s;for(h=1;h<=C&&a[l-h]===g[v-h];h++);return Oh=g.slice(s,1<h?1-h:void 0)}function Dh(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 Ih(){return!0}function N1(){return!1}function Ui(s){function a(l,h,g,v,C){this._reactName=l,this._targetInst=g,this.type=h,this.nativeEvent=v,this.target=C,this.currentTarget=null;for(var I in s)s.hasOwnProperty(I)&&(l=s[I],this[I]=l?l(v):v[I]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ih:N1,this.isPropagationStopped=N1,this}return _(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ih)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ih)},persist:function(){},isPersistent:Ih}),a}var to={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bh=Ui(to),kc=_({},to,{view:0,detail:0}),MM=Ui(kc),om,lm,Ec,$h=_({},kc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:um,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!==Ec&&(Ec&&s.type==="mousemove"?(om=s.screenX-Ec.screenX,lm=s.screenY-Ec.screenY):lm=om=0,Ec=s),om)},movementY:function(s){return"movementY"in s?s.movementY:lm}}),L1=Ui($h),jM=_({},$h,{dataTransfer:0}),OM=Ui(jM),DM=_({},kc,{relatedTarget:0}),cm=Ui(DM),IM=_({},to,{animationName:0,elapsedTime:0,pseudoElement:0}),BM=Ui(IM),$M=_({},to,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),PM=Ui($M),zM=_({},to,{data:0}),M1=Ui(zM),HM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},FM={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"},UM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WM(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=UM[s])?!!a[s]:!1}function um(){return WM}var qM=_({},kc,{key:function(s){if(s.key){var a=HM[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Dh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?FM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:um,charCode:function(s){return s.type==="keypress"?Dh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Dh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),GM=Ui(qM),KM=_({},$h,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),j1=Ui(KM),VM=_({},kc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:um}),YM=Ui(VM),XM=_({},to,{propertyName:0,elapsedTime:0,pseudoElement:0}),ZM=Ui(XM),JM=_({},$h,{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}),QM=Ui(JM),e3=_({},to,{newState:0,oldState:0}),t3=Ui(e3),n3=[9,13,27,32],hm=Cr&&"CompositionEvent"in window,Tc=null;Cr&&"documentMode"in document&&(Tc=document.documentMode);var i3=Cr&&"TextEvent"in window&&!Tc,O1=Cr&&(!hm||Tc&&8<Tc&&11>=Tc),D1=" ",I1=!1;function B1(s,a){switch(s){case"keyup":return n3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Jo=!1;function s3(s,a){switch(s){case"compositionend":return $1(a);case"keypress":return a.which!==32?null:(I1=!0,D1);case"textInput":return s=a.data,s===D1&&I1?null:s;default:return null}}function r3(s,a){if(Jo)return s==="compositionend"||!hm&&B1(s,a)?(s=R1(),Oh=am=ra=null,Jo=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return O1&&a.locale!=="ko"?null:a.data;default:return null}}var a3={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 P1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!a3[s.type]:a==="textarea"}function z1(s,a,l,h){At?xn?xn.push(h):xn=[h]:At=h,a=Td(a,"onChange"),0<a.length&&(l=new Bh("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var Ac=null,Rc=null;function o3(s){wx(s,0)}function Ph(s){var a=Ee(s);if(Qa(a))return s}function H1(s,a){if(s==="change")return a}var F1=!1;if(Cr){var dm;if(Cr){var fm="oninput"in document;if(!fm){var U1=document.createElement("div");U1.setAttribute("oninput","return;"),fm=typeof U1.oninput=="function"}dm=fm}else dm=!1;F1=dm&&(!document.documentMode||9<document.documentMode)}function W1(){Ac&&(Ac.detachEvent("onpropertychange",q1),Rc=Ac=null)}function q1(s){if(s.propertyName==="value"&&Ph(Rc)){var a=[];z1(a,Rc,s,gt(s)),jh(o3,a)}}function l3(s,a,l){s==="focusin"?(W1(),Ac=a,Rc=l,Ac.attachEvent("onpropertychange",q1)):s==="focusout"&&W1()}function c3(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Ph(Rc)}function u3(s,a){if(s==="click")return Ph(a)}function h3(s,a){if(s==="input"||s==="change")return Ph(a)}function d3(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ns=typeof Object.is=="function"?Object.is:d3;function Nc(s,a){if(ns(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),h=Object.keys(a);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var g=l[h];if(!qe.call(a,g)||!ns(s[g],a[g]))return!1}return!0}function G1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function K1(s,a){var l=G1(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=G1(l)}}function V1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?V1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function Y1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Yo(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=Yo(s.document)}return a}function pm(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 f3=Cr&&"documentMode"in document&&11>=document.documentMode,Qo=null,mm=null,Lc=null,gm=!1;function X1(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;gm||Qo==null||Qo!==Yo(h)||(h=Qo,"selectionStart"in h&&pm(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}),Lc&&Nc(Lc,h)||(Lc=h,h=Td(mm,"onSelect"),0<h.length&&(a=new Bh("onSelect","select",null,a,l),s.push({event:a,listeners:h}),a.target=Qo)))}function no(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var el={animationend:no("Animation","AnimationEnd"),animationiteration:no("Animation","AnimationIteration"),animationstart:no("Animation","AnimationStart"),transitionrun:no("Transition","TransitionRun"),transitionstart:no("Transition","TransitionStart"),transitioncancel:no("Transition","TransitionCancel"),transitionend:no("Transition","TransitionEnd")},_m={},Z1={};Cr&&(Z1=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function io(s){if(_m[s])return _m[s];if(!el[s])return s;var a=el[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in Z1)return _m[s]=a[l];return s}var J1=io("animationend"),Q1=io("animationiteration"),eS=io("animationstart"),p3=io("transitionrun"),m3=io("transitionstart"),g3=io("transitioncancel"),tS=io("transitionend"),nS=new Map,vm="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(" ");vm.push("scrollEnd");function Hs(s,a){nS.set(s,a),Dt(a,[s])}var zh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},bs=[],tl=0,ym=0;function Hh(){for(var s=tl,a=ym=tl=0;a<s;){var l=bs[a];bs[a++]=null;var h=bs[a];bs[a++]=null;var g=bs[a];bs[a++]=null;var v=bs[a];if(bs[a++]=null,h!==null&&g!==null){var C=h.pending;C===null?g.next=g:(g.next=C.next,C.next=g),h.pending=g}v!==0&&iS(l,g,v)}}function Fh(s,a,l,h){bs[tl++]=s,bs[tl++]=a,bs[tl++]=l,bs[tl++]=h,ym|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function bm(s,a,l,h){return Fh(s,a,l,h),Uh(s)}function so(s,a){return Fh(s,null,null,a),Uh(s)}function iS(s,a,l){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l);for(var g=!1,v=s.return;v!==null;)v.childLanes|=l,h=v.alternate,h!==null&&(h.childLanes|=l),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(g=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,g&&a!==null&&(g=31-$e(l),s=v.hiddenUpdates,h=s[g],h===null?s[g]=[a]:h.push(a),a.lane=l|536870912),v):null}function Uh(s){if(50<Qc)throw Qc=0,Rg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var nl={};function _3(s,a,l,h){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function is(s,a,l,h){return new _3(s,a,l,h)}function Sm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function kr(s,a){var l=s.alternate;return l===null?(l=is(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function sS(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 Wh(s,a,l,h,g,v){var C=0;if(h=s,typeof s=="function")Sm(s)&&(C=1);else if(typeof s=="string")C=w6(s,l,he.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Z:return s=is(31,l,a,g),s.elementType=Z,s.lanes=v,s;case x:return ro(l.children,g,v,a);case k:C=8,g|=24;break;case O:return s=is(12,l,a,g|2),s.elementType=O,s.lanes=v,s;case L:return s=is(13,l,a,g),s.elementType=L,s.lanes=v,s;case M:return s=is(19,l,a,g),s.elementType=M,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case F:C=10;break e;case P:C=9;break e;case T:C=11;break e;case z:C=14;break e;case U:C=16,h=null;break e}C=29,l=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=is(C,l,a,g),a.elementType=s,a.type=h,a.lanes=v,a}function ro(s,a,l,h){return s=is(7,s,h,a),s.lanes=l,s}function wm(s,a,l){return s=is(6,s,null,a),s.lanes=l,s}function rS(s){var a=is(18,null,null,0);return a.stateNode=s,a}function xm(s,a,l){return a=is(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var aS=new WeakMap;function Ss(s,a){if(typeof s=="object"&&s!==null){var l=aS.get(s);return l!==void 0?l:(a={value:s,source:a,stack:oe(a)},aS.set(s,a),a)}return{value:s,source:a,stack:oe(a)}}var il=[],sl=0,qh=null,Mc=0,ws=[],xs=0,aa=null,tr=1,nr="";function Er(s,a){il[sl++]=Mc,il[sl++]=qh,qh=s,Mc=a}function oS(s,a,l){ws[xs++]=tr,ws[xs++]=nr,ws[xs++]=aa,aa=s;var h=tr;s=nr;var g=32-$e(h)-1;h&=~(1<<g),l+=1;var v=32-$e(a)+g;if(30<v){var C=g-g%5;v=(h&(1<<C)-1).toString(32),h>>=C,g-=C,tr=1<<32-$e(a)+g|l<<g|h,nr=v+s}else tr=1<<v|l<<g|h,nr=s}function Cm(s){s.return!==null&&(Er(s,1),oS(s,1,0))}function km(s){for(;s===qh;)qh=il[--sl],il[sl]=null,Mc=il[--sl],il[sl]=null;for(;s===aa;)aa=ws[--xs],ws[xs]=null,nr=ws[--xs],ws[xs]=null,tr=ws[--xs],ws[xs]=null}function lS(s,a){ws[xs++]=tr,ws[xs++]=nr,ws[xs++]=aa,tr=a.id,nr=a.overflow,aa=s}var gi=null,fn=null,Lt=!1,oa=null,Cs=!1,Em=Error(i(519));function la(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jc(Ss(a,s)),Em}function cS(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[rn]=s,a[Ut]=h,l){case"dialog":Tt("cancel",a),Tt("close",a);break;case"iframe":case"object":case"embed":Tt("load",a);break;case"video":case"audio":for(l=0;l<tu.length;l++)Tt(tu[l],a);break;case"source":Tt("error",a);break;case"img":case"image":case"link":Tt("error",a),Tt("load",a);break;case"details":Tt("toggle",a);break;case"input":Tt("invalid",a),eo(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Tt("invalid",a);break;case"textarea":Tt("invalid",a),Zo(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||Ex(a.textContent,l)?(h.popover!=null&&(Tt("beforetoggle",a),Tt("toggle",a)),h.onScroll!=null&&Tt("scroll",a),h.onScrollEnd!=null&&Tt("scrollend",a),h.onClick!=null&&(a.onclick=Re),a=!0):a=!1,a||la(s,!0)}function uS(s){for(gi=s.return;gi;)switch(gi.tag){case 5:case 31:case 13:Cs=!1;return;case 27:case 3:Cs=!0;return;default:gi=gi.return}}function rl(s){if(s!==gi)return!1;if(!Lt)return uS(s),Lt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Wg(s.type,s.memoizedProps)),l=!l),l&&fn&&la(s),uS(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));fn=Dx(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));fn=Dx(s)}else a===27?(a=fn,wa(s.type)?(s=Yg,Yg=null,fn=s):fn=a):fn=gi?Es(s.stateNode.nextSibling):null;return!0}function ao(){fn=gi=null,Lt=!1}function Tm(){var s=oa;return s!==null&&(Ki===null?Ki=s:Ki.push.apply(Ki,s),oa=null),s}function jc(s){oa===null?oa=[s]:oa.push(s)}var Am=A(null),oo=null,Tr=null;function ca(s,a,l){J(Am,a._currentValue),a._currentValue=l}function Ar(s){s._currentValue=Am.current,Y(Am)}function Rm(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 Nm(s,a,l,h){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var v=g.dependencies;if(v!==null){var C=g.child;v=v.firstContext;e:for(;v!==null;){var I=v;v=g;for(var V=0;V<a.length;V++)if(I.context===a[V]){v.lanes|=l,I=v.alternate,I!==null&&(I.lanes|=l),Rm(v.return,l,s),h||(C=null);break e}v=I.next}}else if(g.tag===18){if(C=g.return,C===null)throw Error(i(341));C.lanes|=l,v=C.alternate,v!==null&&(v.lanes|=l),Rm(C,l,s),C=null}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===s){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}}function al(s,a,l,h){s=null;for(var g=a,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var C=g.alternate;if(C===null)throw Error(i(387));if(C=C.memoizedProps,C!==null){var I=g.type;ns(g.pendingProps.value,C.value)||(s!==null?s.push(I):s=[I])}}else if(g===we.current){if(C=g.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(au):s=[au])}g=g.return}s!==null&&Nm(a,s,l,h),a.flags|=262144}function Gh(s){for(s=s.firstContext;s!==null;){if(!ns(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function lo(s){oo=s,Tr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _i(s){return hS(oo,s)}function Kh(s,a){return oo===null&&lo(s),hS(s,a)}function hS(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Tr===null){if(s===null)throw Error(i(308));Tr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Tr=Tr.next=a;return l}var v3=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()})}},y3=e.unstable_scheduleCallback,b3=e.unstable_NormalPriority,zn={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lm(){return{controller:new v3,data:new Map,refCount:0}}function Oc(s){s.refCount--,s.refCount===0&&y3(b3,function(){s.controller.abort()})}var Dc=null,Mm=0,ol=0,ll=null;function S3(s,a){if(Dc===null){var l=Dc=[];Mm=0,ol=Dg(),ll={status:"pending",value:void 0,then:function(h){l.push(h)}}}return Mm++,a.then(dS,dS),a}function dS(){if(--Mm===0&&Dc!==null){ll!==null&&(ll.status="fulfilled");var s=Dc;Dc=null,ol=0,ll=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function w3(s,a){var l=[],h={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return s.then(function(){h.status="fulfilled",h.value=a;for(var g=0;g<l.length;g++)(0,l[g])(a)},function(g){for(h.status="rejected",h.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),h}var fS=E.S;E.S=function(s,a){Xw=ct(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&S3(s,a),fS!==null&&fS(s,a)};var co=A(null);function jm(){var s=co.current;return s!==null?s:an.pooledCache}function Vh(s,a){a===null?J(co,co.current):J(co,a.pool)}function pS(){var s=jm();return s===null?null:{parent:zn._currentValue,pool:s}}var cl=Error(i(460)),Om=Error(i(474)),Yh=Error(i(542)),Xh={then:function(){}};function mS(s){return s=s.status,s==="fulfilled"||s==="rejected"}function gS(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(Re,Re),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,vS(s),s;default:if(typeof a.status=="string")a.then(Re,Re);else{if(s=an,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=h}},function(h){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,vS(s),s}throw ho=a,cl}}function uo(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ho=l,cl):l}}var ho=null;function _S(){if(ho===null)throw Error(i(459));var s=ho;return ho=null,s}function vS(s){if(s===cl||s===Yh)throw Error(i(483))}var ul=null,Ic=0;function Zh(s){var a=Ic;return Ic+=1,ul===null&&(ul=[]),gS(ul,s,a)}function Bc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Jh(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 yS(s){function a(ee,X){if(s){var ie=ee.deletions;ie===null?(ee.deletions=[X],ee.flags|=16):ie.push(X)}}function l(ee,X){if(!s)return null;for(;X!==null;)a(ee,X),X=X.sibling;return null}function h(ee){for(var X=new Map;ee!==null;)ee.key!==null?X.set(ee.key,ee):X.set(ee.index,ee),ee=ee.sibling;return X}function g(ee,X){return ee=kr(ee,X),ee.index=0,ee.sibling=null,ee}function v(ee,X,ie){return ee.index=ie,s?(ie=ee.alternate,ie!==null?(ie=ie.index,ie<X?(ee.flags|=67108866,X):ie):(ee.flags|=67108866,X)):(ee.flags|=1048576,X)}function C(ee){return s&&ee.alternate===null&&(ee.flags|=67108866),ee}function I(ee,X,ie,ge){return X===null||X.tag!==6?(X=wm(ie,ee.mode,ge),X.return=ee,X):(X=g(X,ie),X.return=ee,X)}function V(ee,X,ie,ge){var tt=ie.type;return tt===x?me(ee,X,ie.props.children,ge,ie.key):X!==null&&(X.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===U&&uo(tt)===X.type)?(X=g(X,ie.props),Bc(X,ie),X.return=ee,X):(X=Wh(ie.type,ie.key,ie.props,null,ee.mode,ge),Bc(X,ie),X.return=ee,X)}function se(ee,X,ie,ge){return X===null||X.tag!==4||X.stateNode.containerInfo!==ie.containerInfo||X.stateNode.implementation!==ie.implementation?(X=xm(ie,ee.mode,ge),X.return=ee,X):(X=g(X,ie.children||[]),X.return=ee,X)}function me(ee,X,ie,ge,tt){return X===null||X.tag!==7?(X=ro(ie,ee.mode,ge,tt),X.return=ee,X):(X=g(X,ie),X.return=ee,X)}function _e(ee,X,ie){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=wm(""+X,ee.mode,ie),X.return=ee,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return ie=Wh(X.type,X.key,X.props,null,ee.mode,ie),Bc(ie,X),ie.return=ee,ie;case w:return X=xm(X,ee.mode,ie),X.return=ee,X;case U:return X=uo(X),_e(ee,X,ie)}if(N(X)||B(X))return X=ro(X,ee.mode,ie,null),X.return=ee,X;if(typeof X.then=="function")return _e(ee,Zh(X),ie);if(X.$$typeof===F)return _e(ee,Kh(ee,X),ie);Jh(ee,X)}return null}function re(ee,X,ie,ge){var tt=X!==null?X.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return tt!==null?null:I(ee,X,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case S:return ie.key===tt?V(ee,X,ie,ge):null;case w:return ie.key===tt?se(ee,X,ie,ge):null;case U:return ie=uo(ie),re(ee,X,ie,ge)}if(N(ie)||B(ie))return tt!==null?null:me(ee,X,ie,ge,null);if(typeof ie.then=="function")return re(ee,X,Zh(ie),ge);if(ie.$$typeof===F)return re(ee,X,Kh(ee,ie),ge);Jh(ee,ie)}return null}function ue(ee,X,ie,ge,tt){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ee=ee.get(ie)||null,I(X,ee,""+ge,tt);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return ee=ee.get(ge.key===null?ie:ge.key)||null,V(X,ee,ge,tt);case w:return ee=ee.get(ge.key===null?ie:ge.key)||null,se(X,ee,ge,tt);case U:return ge=uo(ge),ue(ee,X,ie,ge,tt)}if(N(ge)||B(ge))return ee=ee.get(ie)||null,me(X,ee,ge,tt,null);if(typeof ge.then=="function")return ue(ee,X,ie,Zh(ge),tt);if(ge.$$typeof===F)return ue(ee,X,ie,Kh(X,ge),tt);Jh(X,ge)}return null}function Fe(ee,X,ie,ge){for(var tt=null,It=null,Ve=X,vt=X=0,Nt=null;Ve!==null&&vt<ie.length;vt++){Ve.index>vt?(Nt=Ve,Ve=null):Nt=Ve.sibling;var Bt=re(ee,Ve,ie[vt],ge);if(Bt===null){Ve===null&&(Ve=Nt);break}s&&Ve&&Bt.alternate===null&&a(ee,Ve),X=v(Bt,X,vt),It===null?tt=Bt:It.sibling=Bt,It=Bt,Ve=Nt}if(vt===ie.length)return l(ee,Ve),Lt&&Er(ee,vt),tt;if(Ve===null){for(;vt<ie.length;vt++)Ve=_e(ee,ie[vt],ge),Ve!==null&&(X=v(Ve,X,vt),It===null?tt=Ve:It.sibling=Ve,It=Ve);return Lt&&Er(ee,vt),tt}for(Ve=h(Ve);vt<ie.length;vt++)Nt=ue(Ve,ee,vt,ie[vt],ge),Nt!==null&&(s&&Nt.alternate!==null&&Ve.delete(Nt.key===null?vt:Nt.key),X=v(Nt,X,vt),It===null?tt=Nt:It.sibling=Nt,It=Nt);return s&&Ve.forEach(function(Ta){return a(ee,Ta)}),Lt&&Er(ee,vt),tt}function it(ee,X,ie,ge){if(ie==null)throw Error(i(151));for(var tt=null,It=null,Ve=X,vt=X=0,Nt=null,Bt=ie.next();Ve!==null&&!Bt.done;vt++,Bt=ie.next()){Ve.index>vt?(Nt=Ve,Ve=null):Nt=Ve.sibling;var Ta=re(ee,Ve,Bt.value,ge);if(Ta===null){Ve===null&&(Ve=Nt);break}s&&Ve&&Ta.alternate===null&&a(ee,Ve),X=v(Ta,X,vt),It===null?tt=Ta:It.sibling=Ta,It=Ta,Ve=Nt}if(Bt.done)return l(ee,Ve),Lt&&Er(ee,vt),tt;if(Ve===null){for(;!Bt.done;vt++,Bt=ie.next())Bt=_e(ee,Bt.value,ge),Bt!==null&&(X=v(Bt,X,vt),It===null?tt=Bt:It.sibling=Bt,It=Bt);return Lt&&Er(ee,vt),tt}for(Ve=h(Ve);!Bt.done;vt++,Bt=ie.next())Bt=ue(Ve,ee,vt,Bt.value,ge),Bt!==null&&(s&&Bt.alternate!==null&&Ve.delete(Bt.key===null?vt:Bt.key),X=v(Bt,X,vt),It===null?tt=Bt:It.sibling=Bt,It=Bt);return s&&Ve.forEach(function(j6){return a(ee,j6)}),Lt&&Er(ee,vt),tt}function tn(ee,X,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===x&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case S:e:{for(var tt=ie.key;X!==null;){if(X.key===tt){if(tt=ie.type,tt===x){if(X.tag===7){l(ee,X.sibling),ge=g(X,ie.props.children),ge.return=ee,ee=ge;break e}}else if(X.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===U&&uo(tt)===X.type){l(ee,X.sibling),ge=g(X,ie.props),Bc(ge,ie),ge.return=ee,ee=ge;break e}l(ee,X);break}else a(ee,X);X=X.sibling}ie.type===x?(ge=ro(ie.props.children,ee.mode,ge,ie.key),ge.return=ee,ee=ge):(ge=Wh(ie.type,ie.key,ie.props,null,ee.mode,ge),Bc(ge,ie),ge.return=ee,ee=ge)}return C(ee);case w:e:{for(tt=ie.key;X!==null;){if(X.key===tt)if(X.tag===4&&X.stateNode.containerInfo===ie.containerInfo&&X.stateNode.implementation===ie.implementation){l(ee,X.sibling),ge=g(X,ie.children||[]),ge.return=ee,ee=ge;break e}else{l(ee,X);break}else a(ee,X);X=X.sibling}ge=xm(ie,ee.mode,ge),ge.return=ee,ee=ge}return C(ee);case U:return ie=uo(ie),tn(ee,X,ie,ge)}if(N(ie))return Fe(ee,X,ie,ge);if(B(ie)){if(tt=B(ie),typeof tt!="function")throw Error(i(150));return ie=tt.call(ie),it(ee,X,ie,ge)}if(typeof ie.then=="function")return tn(ee,X,Zh(ie),ge);if(ie.$$typeof===F)return tn(ee,X,Kh(ee,ie),ge);Jh(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,X!==null&&X.tag===6?(l(ee,X.sibling),ge=g(X,ie),ge.return=ee,ee=ge):(l(ee,X),ge=wm(ie,ee.mode,ge),ge.return=ee,ee=ge),C(ee)):l(ee,X)}return function(ee,X,ie,ge){try{Ic=0;var tt=tn(ee,X,ie,ge);return ul=null,tt}catch(Ve){if(Ve===cl||Ve===Yh)throw Ve;var It=is(29,Ve,null,ee.mode);return It.lanes=ge,It.return=ee,It}}}var fo=yS(!0),bS=yS(!1),ua=!1;function Dm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Im(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 ha(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function da(s,a,l){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(zt&2)!==0){var g=h.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),h.pending=a,a=Uh(s),iS(s,null,l),a}return Fh(s,h,a,l),Uh(s)}function $c(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,nt(s,l)}}function Bm(s,a){var l=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var g=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?g=v=C:v=v.next=C,l=l.next}while(l!==null);v===null?g=v=a:v=v.next=a}else g=v=a;l={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}var $m=!1;function Pc(){if($m){var s=ll;if(s!==null)throw s}}function zc(s,a,l,h){$m=!1;var g=s.updateQueue;ua=!1;var v=g.firstBaseUpdate,C=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var V=I,se=V.next;V.next=null,C===null?v=se:C.next=se,C=V;var me=s.alternate;me!==null&&(me=me.updateQueue,I=me.lastBaseUpdate,I!==C&&(I===null?me.firstBaseUpdate=se:I.next=se,me.lastBaseUpdate=V))}if(v!==null){var _e=g.baseState;C=0,me=se=V=null,I=v;do{var re=I.lane&-536870913,ue=re!==I.lane;if(ue?(Rt&re)===re:(h&re)===re){re!==0&&re===ol&&($m=!0),me!==null&&(me=me.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Fe=s,it=I;re=a;var tn=l;switch(it.tag){case 1:if(Fe=it.payload,typeof Fe=="function"){_e=Fe.call(tn,_e,re);break e}_e=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=it.payload,re=typeof Fe=="function"?Fe.call(tn,_e,re):Fe,re==null)break e;_e=_({},_e,re);break e;case 2:ua=!0}}re=I.callback,re!==null&&(s.flags|=64,ue&&(s.flags|=8192),ue=g.callbacks,ue===null?g.callbacks=[re]:ue.push(re))}else ue={lane:re,tag:I.tag,payload:I.payload,callback:I.callback,next:null},me===null?(se=me=ue,V=_e):me=me.next=ue,C|=re;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,g.lastBaseUpdate=ue,g.shared.pending=null}}while(!0);me===null&&(V=_e),g.baseState=V,g.firstBaseUpdate=se,g.lastBaseUpdate=me,v===null&&(g.shared.lanes=0),_a|=C,s.lanes=C,s.memoizedState=_e}}function SS(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function wS(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)SS(l[s],a)}var hl=A(null),Qh=A(0);function xS(s,a){s=Br,J(Qh,s),J(hl,a),Br=s|a.baseLanes}function Pm(){J(Qh,Br),J(hl,hl.current)}function zm(){Br=Qh.current,Y(hl),Y(Qh)}var ss=A(null),ks=null;function fa(s){var a=s.alternate;J(Dn,Dn.current&1),J(ss,s),ks===null&&(a===null||hl.current!==null||a.memoizedState!==null)&&(ks=s)}function Hm(s){J(Dn,Dn.current),J(ss,s),ks===null&&(ks=s)}function CS(s){s.tag===22?(J(Dn,Dn.current),J(ss,s),ks===null&&(ks=s)):pa()}function pa(){J(Dn,Dn.current),J(ss,ss.current)}function rs(s){Y(ss),ks===s&&(ks=null),Y(Dn)}var Dn=A(0);function ed(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Kg(l)||Vg(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 Rr=0,_t=null,Qt=null,Hn=null,td=!1,dl=!1,po=!1,nd=0,Hc=0,fl=null,x3=0;function En(){throw Error(i(321))}function Fm(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ns(s[l],a[l]))return!1;return!0}function Um(s,a,l,h,g,v){return Rr=v,_t=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,E.H=s===null||s.memoizedState===null?ow:sg,po=!1,v=l(h,g),po=!1,dl&&(v=ES(a,l,h,g)),kS(s),v}function kS(s){E.H=Wc;var a=Qt!==null&&Qt.next!==null;if(Rr=0,Hn=Qt=_t=null,td=!1,Hc=0,fl=null,a)throw Error(i(300));s===null||Fn||(s=s.dependencies,s!==null&&Gh(s)&&(Fn=!0))}function ES(s,a,l,h){_t=s;var g=0;do{if(dl&&(fl=null),Hc=0,dl=!1,25<=g)throw Error(i(301));if(g+=1,Hn=Qt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}E.H=lw,v=a(l,h)}while(dl);return v}function C3(){var s=E.H,a=s.useState()[0];return a=typeof a.then=="function"?Fc(a):a,s=s.useState()[0],(Qt!==null?Qt.memoizedState:null)!==s&&(_t.flags|=1024),a}function Wm(){var s=nd!==0;return nd=0,s}function qm(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Gm(s){if(td){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}td=!1}Rr=0,Hn=Qt=_t=null,dl=!1,Hc=nd=0,fl=null}function Ni(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?_t.memoizedState=Hn=s:Hn=Hn.next=s,Hn}function In(){if(Qt===null){var s=_t.alternate;s=s!==null?s.memoizedState:null}else s=Qt.next;var a=Hn===null?_t.memoizedState:Hn.next;if(a!==null)Hn=a,Qt=s;else{if(s===null)throw _t.alternate===null?Error(i(467)):Error(i(310));Qt=s,s={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},Hn===null?_t.memoizedState=Hn=s:Hn=Hn.next=s}return Hn}function id(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fc(s){var a=Hc;return Hc+=1,fl===null&&(fl=[]),s=gS(fl,s,a),a=_t,(Hn===null?a.memoizedState:Hn.next)===null&&(a=a.alternate,E.H=a===null||a.memoizedState===null?ow:sg),s}function sd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Fc(s);if(s.$$typeof===F)return _i(s)}throw Error(i(438,String(s)))}function Km(s){var a=null,l=_t.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=_t.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=id(),_t.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]=Q;return a.index++,l}function Nr(s,a){return typeof a=="function"?a(s):a}function rd(s){var a=In();return Vm(a,Qt,s)}function Vm(s,a,l){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=l;var g=s.baseQueue,v=h.pending;if(v!==null){if(g!==null){var C=g.next;g.next=v.next,v.next=C}a.baseQueue=g=v,h.pending=null}if(v=s.baseState,g===null)s.memoizedState=v;else{a=g.next;var I=C=null,V=null,se=a,me=!1;do{var _e=se.lane&-536870913;if(_e!==se.lane?(Rt&_e)===_e:(Rr&_e)===_e){var re=se.revertLane;if(re===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),_e===ol&&(me=!0);else if((Rr&re)===re){se=se.next,re===ol&&(me=!0);continue}else _e={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},V===null?(I=V=_e,C=v):V=V.next=_e,_t.lanes|=re,_a|=re;_e=se.action,po&&l(v,_e),v=se.hasEagerState?se.eagerState:l(v,_e)}else re={lane:_e,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},V===null?(I=V=re,C=v):V=V.next=re,_t.lanes|=_e,_a|=_e;se=se.next}while(se!==null&&se!==a);if(V===null?C=v:V.next=I,!ns(v,s.memoizedState)&&(Fn=!0,me&&(l=ll,l!==null)))throw l;s.memoizedState=v,s.baseState=C,s.baseQueue=V,h.lastRenderedState=v}return g===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Ym(s){var a=In(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=s;var h=l.dispatch,g=l.pending,v=a.memoizedState;if(g!==null){l.pending=null;var C=g=g.next;do v=s(v,C.action),C=C.next;while(C!==g);ns(v,a.memoizedState)||(Fn=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),l.lastRenderedState=v}return[v,h]}function TS(s,a,l){var h=_t,g=In(),v=Lt;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=a();var C=!ns((Qt||g).memoizedState,l);if(C&&(g.memoizedState=l,Fn=!0),g=g.queue,Jm(NS.bind(null,h,g,s),[s]),g.getSnapshot!==a||C||Hn!==null&&Hn.memoizedState.tag&1){if(h.flags|=2048,pl(9,{destroy:void 0},RS.bind(null,h,g,l,a),null),an===null)throw Error(i(349));v||(Rr&127)!==0||AS(h,a,l)}return l}function AS(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=_t.updateQueue,a===null?(a=id(),_t.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function RS(s,a,l,h){a.value=l,a.getSnapshot=h,LS(a)&&MS(s)}function NS(s,a,l){return l(function(){LS(a)&&MS(s)})}function LS(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ns(s,l)}catch{return!0}}function MS(s){var a=so(s,2);a!==null&&Vi(a,s,2)}function Xm(s){var a=Ni();if(typeof s=="function"){var l=s;if(s=l(),po){ce(!0);try{l()}finally{ce(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:s},a}function jS(s,a,l,h){return s.baseState=l,Vm(s,Qt,typeof h=="function"?h:Nr)}function k3(s,a,l,h,g){if(ld(s))throw Error(i(485));if(s=a.action,s!==null){var v={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){v.listeners.push(C)}};E.T!==null?l(!0):v.isTransition=!1,h(v),l=a.pending,l===null?(v.next=a.pending=v,OS(a,v)):(v.next=l.next,a.pending=l.next=v)}}function OS(s,a){var l=a.action,h=a.payload,g=s.state;if(a.isTransition){var v=E.T,C={};E.T=C;try{var I=l(g,h),V=E.S;V!==null&&V(C,I),DS(s,a,I)}catch(se){Zm(s,a,se)}finally{v!==null&&C.types!==null&&(v.types=C.types),E.T=v}}else try{v=l(g,h),DS(s,a,v)}catch(se){Zm(s,a,se)}}function DS(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){IS(s,a,h)},function(h){return Zm(s,a,h)}):IS(s,a,l)}function IS(s,a,l){a.status="fulfilled",a.value=l,BS(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,OS(s,l)))}function Zm(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,BS(a),a=a.next;while(a!==h)}s.action=null}function BS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function $S(s,a){return a}function PS(s,a){if(Lt){var l=an.formState;if(l!==null){e:{var h=_t;if(Lt){if(fn){t:{for(var g=fn,v=Cs;g.nodeType!==8;){if(!v){g=null;break t}if(g=Es(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){fn=Es(g.nextSibling),h=g.data==="F!";break e}}la(h)}h=!1}h&&(a=l[0])}}return l=Ni(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$S,lastRenderedState:a},l.queue=h,l=sw.bind(null,_t,h),h.dispatch=l,h=Xm(!1),v=ig.bind(null,_t,!1,h.queue),h=Ni(),g={state:a,dispatch:null,action:s,pending:null},h.queue=g,l=k3.bind(null,_t,g,v,l),g.dispatch=l,h.memoizedState=s,[a,l,!1]}function zS(s){var a=In();return HS(a,Qt,s)}function HS(s,a,l){if(a=Vm(s,a,$S)[0],s=rd(Nr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Fc(a)}catch(C){throw C===cl?Yh:C}else h=a;a=In();var g=a.queue,v=g.dispatch;return l!==a.memoizedState&&(_t.flags|=2048,pl(9,{destroy:void 0},E3.bind(null,g,l),null)),[h,v,s]}function E3(s,a){s.action=a}function FS(s){var a=In(),l=Qt;if(l!==null)return HS(a,l,s);In(),a=a.memoizedState,l=In();var h=l.queue.dispatch;return l.memoizedState=s,[a,h,!1]}function pl(s,a,l,h){return s={tag:s,create:l,deps:h,inst:a,next:null},a=_t.updateQueue,a===null&&(a=id(),_t.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 US(){return In().memoizedState}function ad(s,a,l,h){var g=Ni();_t.flags|=s,g.memoizedState=pl(1|a,{destroy:void 0},l,h===void 0?null:h)}function od(s,a,l,h){var g=In();h=h===void 0?null:h;var v=g.memoizedState.inst;Qt!==null&&h!==null&&Fm(h,Qt.memoizedState.deps)?g.memoizedState=pl(a,v,l,h):(_t.flags|=s,g.memoizedState=pl(1|a,v,l,h))}function WS(s,a){ad(8390656,8,s,a)}function Jm(s,a){od(2048,8,s,a)}function T3(s){_t.flags|=4;var a=_t.updateQueue;if(a===null)a=id(),_t.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function qS(s){var a=In().memoizedState;return T3({ref:a,nextImpl:s}),function(){if((zt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function GS(s,a){return od(4,2,s,a)}function KS(s,a){return od(4,4,s,a)}function VS(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 YS(s,a,l){l=l!=null?l.concat([s]):null,od(4,4,VS.bind(null,a,s),l)}function Qm(){}function XS(s,a){var l=In();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&Fm(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function ZS(s,a){var l=In();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&Fm(a,h[1]))return h[0];if(h=s(),po){ce(!0);try{s()}finally{ce(!1)}}return l.memoizedState=[h,a],h}function eg(s,a,l){return l===void 0||(Rr&1073741824)!==0&&(Rt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=Jw(),_t.lanes|=s,_a|=s,l)}function JS(s,a,l,h){return ns(l,a)?l:hl.current!==null?(s=eg(s,l,h),ns(s,a)||(Fn=!0),s):(Rr&42)===0||(Rr&1073741824)!==0&&(Rt&261930)===0?(Fn=!0,s.memoizedState=l):(s=Jw(),_t.lanes|=s,_a|=s,a)}function QS(s,a,l,h,g){var v=$.p;$.p=v!==0&&8>v?v:8;var C=E.T,I={};E.T=I,ig(s,!1,a,l);try{var V=g(),se=E.S;if(se!==null&&se(I,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var me=w3(V,h);Uc(s,a,me,ls(s))}else Uc(s,a,h,ls(s))}catch(_e){Uc(s,a,{then:function(){},status:"rejected",reason:_e},ls())}finally{$.p=v,C!==null&&I.types!==null&&(C.types=I.types),E.T=C}}function A3(){}function tg(s,a,l,h){if(s.tag!==5)throw Error(i(476));var g=ew(s).queue;QS(s,g,a,j,l===null?A3:function(){return tw(s),l(h)})}function ew(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:j,baseState:j,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:j},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function tw(s){var a=ew(s);a.next===null&&(a=s.alternate.memoizedState),Uc(s,a.next.queue,{},ls())}function ng(){return _i(au)}function nw(){return In().memoizedState}function iw(){return In().memoizedState}function R3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=ls();s=ha(l);var h=da(a,s,l);h!==null&&(Vi(h,a,l),$c(h,a,l)),a={cache:Lm()},s.payload=a;return}a=a.return}}function N3(s,a,l){var h=ls();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ld(s)?rw(a,l):(l=bm(s,a,l,h),l!==null&&(Vi(l,s,h),aw(l,a,h)))}function sw(s,a,l){var h=ls();Uc(s,a,l,h)}function Uc(s,a,l,h){var g={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ld(s))rw(a,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var C=a.lastRenderedState,I=v(C,l);if(g.hasEagerState=!0,g.eagerState=I,ns(I,C))return Fh(s,a,g,0),an===null&&Hh(),!1}catch{}if(l=bm(s,a,g,h),l!==null)return Vi(l,s,h),aw(l,a,h),!0}return!1}function ig(s,a,l,h){if(h={lane:2,revertLane:Dg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ld(s)){if(a)throw Error(i(479))}else a=bm(s,l,h,2),a!==null&&Vi(a,s,2)}function ld(s){var a=s.alternate;return s===_t||a!==null&&a===_t}function rw(s,a){dl=td=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function aw(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,nt(s,l)}}var Wc={readContext:_i,use:sd,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useLayoutEffect:En,useInsertionEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useSyncExternalStore:En,useId:En,useHostTransitionStatus:En,useFormState:En,useActionState:En,useOptimistic:En,useMemoCache:En,useCacheRefresh:En};Wc.useEffectEvent=En;var ow={readContext:_i,use:sd,useCallback:function(s,a){return Ni().memoizedState=[s,a===void 0?null:a],s},useContext:_i,useEffect:WS,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,ad(4194308,4,VS.bind(null,a,s),l)},useLayoutEffect:function(s,a){return ad(4194308,4,s,a)},useInsertionEffect:function(s,a){ad(4,2,s,a)},useMemo:function(s,a){var l=Ni();a=a===void 0?null:a;var h=s();if(po){ce(!0);try{s()}finally{ce(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=Ni();if(l!==void 0){var g=l(a);if(po){ce(!0);try{l(a)}finally{ce(!1)}}}else g=a;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=N3.bind(null,_t,s),[h.memoizedState,s]},useRef:function(s){var a=Ni();return s={current:s},a.memoizedState=s},useState:function(s){s=Xm(s);var a=s.queue,l=sw.bind(null,_t,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Qm,useDeferredValue:function(s,a){var l=Ni();return eg(l,s,a)},useTransition:function(){var s=Xm(!1);return s=QS.bind(null,_t,s.queue,!0,!1),Ni().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=_t,g=Ni();if(Lt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),an===null)throw Error(i(349));(Rt&127)!==0||AS(h,a,l)}g.memoizedState=l;var v={value:l,getSnapshot:a};return g.queue=v,WS(NS.bind(null,h,v,s),[s]),h.flags|=2048,pl(9,{destroy:void 0},RS.bind(null,h,v,l,a),null),l},useId:function(){var s=Ni(),a=an.identifierPrefix;if(Lt){var l=nr,h=tr;l=(h&~(1<<32-$e(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=nd++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=x3++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:ng,useFormState:PS,useActionState:PS,useOptimistic:function(s){var a=Ni();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=ig.bind(null,_t,!0,l),l.dispatch=a,[s,a]},useMemoCache:Km,useCacheRefresh:function(){return Ni().memoizedState=R3.bind(null,_t)},useEffectEvent:function(s){var a=Ni(),l={impl:s};return a.memoizedState=l,function(){if((zt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},sg={readContext:_i,use:sd,useCallback:XS,useContext:_i,useEffect:Jm,useImperativeHandle:YS,useInsertionEffect:GS,useLayoutEffect:KS,useMemo:ZS,useReducer:rd,useRef:US,useState:function(){return rd(Nr)},useDebugValue:Qm,useDeferredValue:function(s,a){var l=In();return JS(l,Qt.memoizedState,s,a)},useTransition:function(){var s=rd(Nr)[0],a=In().memoizedState;return[typeof s=="boolean"?s:Fc(s),a]},useSyncExternalStore:TS,useId:nw,useHostTransitionStatus:ng,useFormState:zS,useActionState:zS,useOptimistic:function(s,a){var l=In();return jS(l,Qt,s,a)},useMemoCache:Km,useCacheRefresh:iw};sg.useEffectEvent=qS;var lw={readContext:_i,use:sd,useCallback:XS,useContext:_i,useEffect:Jm,useImperativeHandle:YS,useInsertionEffect:GS,useLayoutEffect:KS,useMemo:ZS,useReducer:Ym,useRef:US,useState:function(){return Ym(Nr)},useDebugValue:Qm,useDeferredValue:function(s,a){var l=In();return Qt===null?eg(l,s,a):JS(l,Qt.memoizedState,s,a)},useTransition:function(){var s=Ym(Nr)[0],a=In().memoizedState;return[typeof s=="boolean"?s:Fc(s),a]},useSyncExternalStore:TS,useId:nw,useHostTransitionStatus:ng,useFormState:FS,useActionState:FS,useOptimistic:function(s,a){var l=In();return Qt!==null?jS(l,Qt,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Km,useCacheRefresh:iw};lw.useEffectEvent=qS;function rg(s,a,l,h){a=s.memoizedState,l=l(h,a),l=l==null?a:_({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var ag={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=ls(),g=ha(h);g.payload=a,l!=null&&(g.callback=l),a=da(s,g,h),a!==null&&(Vi(a,s,h),$c(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=ls(),g=ha(h);g.tag=1,g.payload=a,l!=null&&(g.callback=l),a=da(s,g,h),a!==null&&(Vi(a,s,h),$c(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=ls(),h=ha(l);h.tag=2,a!=null&&(h.callback=a),a=da(s,h,l),a!==null&&(Vi(a,s,l),$c(a,s,l))}};function cw(s,a,l,h,g,v,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,C):a.prototype&&a.prototype.isPureReactComponent?!Nc(l,h)||!Nc(g,v):!0}function uw(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&&ag.enqueueReplaceState(a,a.state,null)}function mo(s,a){var l=a;if("ref"in a){l={};for(var h in a)h!=="ref"&&(l[h]=a[h])}if(s=s.defaultProps){l===a&&(l=_({},l));for(var g in s)l[g]===void 0&&(l[g]=s[g])}return l}function hw(s){zh(s)}function dw(s){console.error(s)}function fw(s){zh(s)}function cd(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function pw(s,a,l){try{var h=s.onCaughtError;h(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function og(s,a,l){return l=ha(l),l.tag=3,l.payload={element:null},l.callback=function(){cd(s,a)},l}function mw(s){return s=ha(s),s.tag=3,s}function gw(s,a,l,h){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var v=h.value;s.payload=function(){return g(v)},s.callback=function(){pw(a,l,h)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){pw(a,l,h),typeof g!="function"&&(va===null?va=new Set([this]):va.add(this));var I=h.stack;this.componentDidCatch(h.value,{componentStack:I!==null?I:""})})}function L3(s,a,l,h,g){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&al(a,l,g,!0),l=ss.current,l!==null){switch(l.tag){case 31:case 13:return ks===null?Sd():l.alternate===null&&Tn===0&&(Tn=3),l.flags&=-257,l.flags|=65536,l.lanes=g,h===Xh?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),Mg(s,h,g)),!1;case 22:return l.flags|=65536,h===Xh?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)),Mg(s,h,g)),!1}throw Error(i(435,l.tag))}return Mg(s,h,g),Sd(),!1}if(Lt)return a=ss.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,h!==Em&&(s=Error(i(422),{cause:h}),jc(Ss(s,l)))):(h!==Em&&(a=Error(i(423),{cause:h}),jc(Ss(a,l))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,h=Ss(h,l),g=og(s.stateNode,h,g),Bm(s,g),Tn!==4&&(Tn=2)),!1;var v=Error(i(520),{cause:h});if(v=Ss(v,l),Jc===null?Jc=[v]:Jc.push(v),Tn!==4&&(Tn=2),a===null)return!0;h=Ss(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=g&-g,l.lanes|=s,s=og(l.stateNode,h,s),Bm(l,s),!1;case 1:if(a=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(va===null||!va.has(v))))return l.flags|=65536,g&=-g,l.lanes|=g,g=mw(g),gw(g,s,l,h),Bm(l,g),!1}l=l.return}while(l!==null);return!1}var lg=Error(i(461)),Fn=!1;function vi(s,a,l,h){a.child=s===null?bS(a,null,l,h):fo(a,s.child,l,h)}function _w(s,a,l,h,g){l=l.render;var v=a.ref;if("ref"in h){var C={};for(var I in h)I!=="ref"&&(C[I]=h[I])}else C=h;return lo(a),h=Um(s,a,l,C,v,g),I=Wm(),s!==null&&!Fn?(qm(s,a,g),Lr(s,a,g)):(Lt&&I&&Cm(a),a.flags|=1,vi(s,a,h,g),a.child)}function vw(s,a,l,h,g){if(s===null){var v=l.type;return typeof v=="function"&&!Sm(v)&&v.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=v,yw(s,a,v,h,g)):(s=Wh(l.type,null,h,a,a.mode,g),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!gg(s,g)){var C=v.memoizedProps;if(l=l.compare,l=l!==null?l:Nc,l(C,h)&&s.ref===a.ref)return Lr(s,a,g)}return a.flags|=1,s=kr(v,h),s.ref=a.ref,s.return=a,a.child=s}function yw(s,a,l,h,g){if(s!==null){var v=s.memoizedProps;if(Nc(v,h)&&s.ref===a.ref)if(Fn=!1,a.pendingProps=h=v,gg(s,g))(s.flags&131072)!==0&&(Fn=!0);else return a.lanes=s.lanes,Lr(s,a,g)}return cg(s,a,l,h,g)}function bw(s,a,l,h){var g=h.children,v=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,s!==null){for(h=a.child=s.child,g=0;h!==null;)g=g|h.lanes|h.childLanes,h=h.sibling;h=g&~v}else h=0,a.child=null;return Sw(s,a,v,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Vh(a,v!==null?v.cachePool:null),v!==null?xS(a,v):Pm(),CS(a);else return h=a.lanes=536870912,Sw(s,a,v!==null?v.baseLanes|l:l,l,h)}else v!==null?(Vh(a,v.cachePool),xS(a,v),pa(),a.memoizedState=null):(s!==null&&Vh(a,null),Pm(),pa());return vi(s,a,g,l),a.child}function qc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Sw(s,a,l,h,g){var v=jm();return v=v===null?null:{parent:zn._currentValue,pool:v},a.memoizedState={baseLanes:l,cachePool:v},s!==null&&Vh(a,null),Pm(),CS(a),s!==null&&al(s,a,h,!0),a.childLanes=g,null}function ud(s,a){return a=dd({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function ww(s,a,l){return fo(a,s.child,null,l),s=ud(a,a.pendingProps),s.flags|=2,rs(a),a.memoizedState=null,s}function M3(s,a,l){var h=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Lt){if(h.mode==="hidden")return s=ud(a,h),a.lanes=536870912,qc(null,s);if(Hm(a),(s=fn)?(s=Ox(s,Cs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:aa!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},l=rS(s),l.return=a,a.child=l,gi=a,fn=null)):s=null,s===null)throw la(a);return a.lanes=536870912,null}return ud(a,h)}var v=s.memoizedState;if(v!==null){var C=v.dehydrated;if(Hm(a),g)if(a.flags&256)a.flags&=-257,a=ww(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Fn||al(s,a,l,!1),g=(l&s.childLanes)!==0,Fn||g){if(h=an,h!==null&&(C=ln(h,l),C!==0&&C!==v.retryLane))throw v.retryLane=C,so(s,C),Vi(h,s,C),lg;Sd(),a=ww(s,a,l)}else s=v.treeContext,fn=Es(C.nextSibling),gi=a,Lt=!0,oa=null,Cs=!1,s!==null&&lS(a,s),a=ud(a,h),a.flags|=4096;return a}return s=kr(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function hd(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 cg(s,a,l,h,g){return lo(a),l=Um(s,a,l,h,void 0,g),h=Wm(),s!==null&&!Fn?(qm(s,a,g),Lr(s,a,g)):(Lt&&h&&Cm(a),a.flags|=1,vi(s,a,l,g),a.child)}function xw(s,a,l,h,g,v){return lo(a),a.updateQueue=null,l=ES(a,h,l,g),kS(s),h=Wm(),s!==null&&!Fn?(qm(s,a,v),Lr(s,a,v)):(Lt&&h&&Cm(a),a.flags|=1,vi(s,a,l,v),a.child)}function Cw(s,a,l,h,g){if(lo(a),a.stateNode===null){var v=nl,C=l.contextType;typeof C=="object"&&C!==null&&(v=_i(C)),v=new l(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=ag,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},Dm(a),C=l.contextType,v.context=typeof C=="object"&&C!==null?_i(C):nl,v.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(rg(a,l,C,h),v.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(C=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),C!==v.state&&ag.enqueueReplaceState(v,v.state,null),zc(a,h,v,g),Pc(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){v=a.stateNode;var I=a.memoizedProps,V=mo(l,I);v.props=V;var se=v.context,me=l.contextType;C=nl,typeof me=="object"&&me!==null&&(C=_i(me));var _e=l.getDerivedStateFromProps;me=typeof _e=="function"||typeof v.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,me||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(I||se!==C)&&uw(a,v,h,C),ua=!1;var re=a.memoizedState;v.state=re,zc(a,h,v,g),Pc(),se=a.memoizedState,I||re!==se||ua?(typeof _e=="function"&&(rg(a,l,_e,h),se=a.memoizedState),(V=ua||cw(a,l,V,h,re,se,C))?(me||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=se),v.props=h,v.state=se,v.context=C,h=V):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,Im(s,a),C=a.memoizedProps,me=mo(l,C),v.props=me,_e=a.pendingProps,re=v.context,se=l.contextType,V=nl,typeof se=="object"&&se!==null&&(V=_i(se)),I=l.getDerivedStateFromProps,(se=typeof I=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(C!==_e||re!==V)&&uw(a,v,h,V),ua=!1,re=a.memoizedState,v.state=re,zc(a,h,v,g),Pc();var ue=a.memoizedState;C!==_e||re!==ue||ua||s!==null&&s.dependencies!==null&&Gh(s.dependencies)?(typeof I=="function"&&(rg(a,l,I,h),ue=a.memoizedState),(me=ua||cw(a,l,me,h,re,ue,V)||s!==null&&s.dependencies!==null&&Gh(s.dependencies))?(se||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,ue,V),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,ue,V)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&re===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&re===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ue),v.props=h,v.state=ue,v.context=V,h=me):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&re===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&re===s.memoizedState||(a.flags|=1024),h=!1)}return v=h,hd(s,a),h=(a.flags&128)!==0,v||h?(v=a.stateNode,l=h&&typeof l.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,s!==null&&h?(a.child=fo(a,s.child,null,g),a.child=fo(a,null,l,g)):vi(s,a,l,g),a.memoizedState=v.state,s=a.child):s=Lr(s,a,g),s}function kw(s,a,l,h){return ao(),a.flags|=256,vi(s,a,l,h),a.child}var ug={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hg(s){return{baseLanes:s,cachePool:pS()}}function dg(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=os),s}function Ew(s,a,l){var h=a.pendingProps,g=!1,v=(a.flags&128)!==0,C;if((C=v)||(C=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),C&&(g=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,s===null){if(Lt){if(g?fa(a):pa(),(s=fn)?(s=Ox(s,Cs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:aa!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},l=rS(s),l.return=a,a.child=l,gi=a,fn=null)):s=null,s===null)throw la(a);return Vg(s)?a.lanes=32:a.lanes=536870912,null}var I=h.children;return h=h.fallback,g?(pa(),g=a.mode,I=dd({mode:"hidden",children:I},g),h=ro(h,g,l,null),I.return=a,h.return=a,I.sibling=h,a.child=I,h=a.child,h.memoizedState=hg(l),h.childLanes=dg(s,C,l),a.memoizedState=ug,qc(null,h)):(fa(a),fg(a,I))}var V=s.memoizedState;if(V!==null&&(I=V.dehydrated,I!==null)){if(v)a.flags&256?(fa(a),a.flags&=-257,a=pg(s,a,l)):a.memoizedState!==null?(pa(),a.child=s.child,a.flags|=128,a=null):(pa(),I=h.fallback,g=a.mode,h=dd({mode:"visible",children:h.children},g),I=ro(I,g,l,null),I.flags|=2,h.return=a,I.return=a,h.sibling=I,a.child=h,fo(a,s.child,null,l),h=a.child,h.memoizedState=hg(l),h.childLanes=dg(s,C,l),a.memoizedState=ug,a=qc(null,h));else if(fa(a),Vg(I)){if(C=I.nextSibling&&I.nextSibling.dataset,C)var se=C.dgst;C=se,h=Error(i(419)),h.stack="",h.digest=C,jc({value:h,source:null,stack:null}),a=pg(s,a,l)}else if(Fn||al(s,a,l,!1),C=(l&s.childLanes)!==0,Fn||C){if(C=an,C!==null&&(h=ln(C,l),h!==0&&h!==V.retryLane))throw V.retryLane=h,so(s,h),Vi(C,s,h),lg;Kg(I)||Sd(),a=pg(s,a,l)}else Kg(I)?(a.flags|=192,a.child=s.child,a=null):(s=V.treeContext,fn=Es(I.nextSibling),gi=a,Lt=!0,oa=null,Cs=!1,s!==null&&lS(a,s),a=fg(a,h.children),a.flags|=4096);return a}return g?(pa(),I=h.fallback,g=a.mode,V=s.child,se=V.sibling,h=kr(V,{mode:"hidden",children:h.children}),h.subtreeFlags=V.subtreeFlags&65011712,se!==null?I=kr(se,I):(I=ro(I,g,l,null),I.flags|=2),I.return=a,h.return=a,h.sibling=I,a.child=h,qc(null,h),h=a.child,I=s.child.memoizedState,I===null?I=hg(l):(g=I.cachePool,g!==null?(V=zn._currentValue,g=g.parent!==V?{parent:V,pool:V}:g):g=pS(),I={baseLanes:I.baseLanes|l,cachePool:g}),h.memoizedState=I,h.childLanes=dg(s,C,l),a.memoizedState=ug,qc(s.child,h)):(fa(a),l=s.child,s=l.sibling,l=kr(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 fg(s,a){return a=dd({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function dd(s,a){return s=is(22,s,null,a),s.lanes=0,s}function pg(s,a,l){return fo(a,s.child,null,l),s=fg(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Tw(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),Rm(s.return,a,l)}function mg(s,a,l,h,g,v){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:g,treeForkCount:v}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=l,C.tailMode=g,C.treeForkCount=v)}function Aw(s,a,l){var h=a.pendingProps,g=h.revealOrder,v=h.tail;h=h.children;var C=Dn.current,I=(C&2)!==0;if(I?(C=C&1|2,a.flags|=128):C&=1,J(Dn,C),vi(s,a,h,l),h=Lt?Mc:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Tw(s,l,a);else if(s.tag===19)Tw(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(g){case"forwards":for(l=a.child,g=null;l!==null;)s=l.alternate,s!==null&&ed(s)===null&&(g=l),l=l.sibling;l=g,l===null?(g=a.child,a.child=null):(g=l.sibling,l.sibling=null),mg(a,!1,g,l,v,h);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=a.child,a.child=null;g!==null;){if(s=g.alternate,s!==null&&ed(s)===null){a.child=g;break}s=g.sibling,g.sibling=l,l=g,g=s}mg(a,!0,l,null,v,h);break;case"together":mg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Lr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),_a|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(al(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=kr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=kr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function gg(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Gh(s)))}function j3(s,a,l){switch(a.tag){case 3:je(a,a.stateNode.containerInfo),ca(a,zn,s.memoizedState.cache),ao();break;case 27:case 5:We(a);break;case 4:je(a,a.stateNode.containerInfo);break;case 10:ca(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Hm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(fa(a),a.flags|=128,null):(l&a.child.childLanes)!==0?Ew(s,a,l):(fa(a),s=Lr(s,a,l),s!==null?s.sibling:null);fa(a);break;case 19:var g=(s.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(al(s,a,l,!1),h=(l&a.childLanes)!==0),g){if(h)return Aw(s,a,l);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),J(Dn,Dn.current),h)break;return null;case 22:return a.lanes=0,bw(s,a,l,a.pendingProps);case 24:ca(a,zn,s.memoizedState.cache)}return Lr(s,a,l)}function Rw(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Fn=!0;else{if(!gg(s,l)&&(a.flags&128)===0)return Fn=!1,j3(s,a,l);Fn=(s.flags&131072)!==0}else Fn=!1,Lt&&(a.flags&1048576)!==0&&oS(a,Mc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=uo(a.elementType),a.type=s,typeof s=="function")Sm(s)?(h=mo(s,h),a.tag=1,a=Cw(null,a,s,h,l)):(a.tag=0,a=cg(null,a,s,h,l));else{if(s!=null){var g=s.$$typeof;if(g===T){a.tag=11,a=_w(null,a,s,h,l);break e}else if(g===z){a.tag=14,a=vw(null,a,s,h,l);break e}}throw a=D(s)||s,Error(i(306,a,""))}}return a;case 0:return cg(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,g=mo(h,a.pendingProps),Cw(s,a,h,g,l);case 3:e:{if(je(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var v=a.memoizedState;g=v.element,Im(s,a),zc(a,h,null,l);var C=a.memoizedState;if(h=C.cache,ca(a,zn,h),h!==v.cache&&Nm(a,[zn],l,!0),Pc(),h=C.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=kw(s,a,h,l);break e}else if(h!==g){g=Ss(Error(i(424)),a),jc(g),a=kw(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,fn=Es(s.firstChild),gi=a,Lt=!0,oa=null,Cs=!0,l=bS(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(ao(),h===g){a=Lr(s,a,l);break e}vi(s,a,h,l)}a=a.child}return a;case 26:return hd(s,a),s===null?(l=zx(a.type,null,a.pendingProps,null))?a.memoizedState=l:Lt||(l=a.type,s=a.pendingProps,h=Ad(ae.current).createElement(l),h[rn]=a,h[Ut]=s,yi(h,l,s),ft(h),a.stateNode=h):a.memoizedState=zx(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return We(a),s===null&&Lt&&(h=a.stateNode=Bx(a.type,a.pendingProps,ae.current),gi=a,Cs=!0,g=fn,wa(a.type)?(Yg=g,fn=Es(h.firstChild)):fn=g),vi(s,a,a.pendingProps.children,l),hd(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Lt&&((g=h=fn)&&(h=c6(h,a.type,a.pendingProps,Cs),h!==null?(a.stateNode=h,gi=a,fn=Es(h.firstChild),Cs=!1,g=!0):g=!1),g||la(a)),We(a),g=a.type,v=a.pendingProps,C=s!==null?s.memoizedProps:null,h=v.children,Wg(g,v)?h=null:C!==null&&Wg(g,C)&&(a.flags|=32),a.memoizedState!==null&&(g=Um(s,a,C3,null,null,l),au._currentValue=g),hd(s,a),vi(s,a,h,l),a.child;case 6:return s===null&&Lt&&((s=l=fn)&&(l=u6(l,a.pendingProps,Cs),l!==null?(a.stateNode=l,gi=a,fn=null,s=!0):s=!1),s||la(a)),null;case 13:return Ew(s,a,l);case 4:return je(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=fo(a,null,h,l):vi(s,a,h,l),a.child;case 11:return _w(s,a,a.type,a.pendingProps,l);case 7:return vi(s,a,a.pendingProps,l),a.child;case 8:return vi(s,a,a.pendingProps.children,l),a.child;case 12:return vi(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,ca(a,a.type,h.value),vi(s,a,h.children,l),a.child;case 9:return g=a.type._context,h=a.pendingProps.children,lo(a),g=_i(g),h=h(g),a.flags|=1,vi(s,a,h,l),a.child;case 14:return vw(s,a,a.type,a.pendingProps,l);case 15:return yw(s,a,a.type,a.pendingProps,l);case 19:return Aw(s,a,l);case 31:return M3(s,a,l);case 22:return bw(s,a,l,a.pendingProps);case 24:return lo(a),h=_i(zn),s===null?(g=jm(),g===null&&(g=an,v=Lm(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=l),g=v),a.memoizedState={parent:h,cache:g},Dm(a),ca(a,zn,g)):((s.lanes&l)!==0&&(Im(s,a),zc(a,null,null,l),Pc()),g=s.memoizedState,v=a.memoizedState,g.parent!==h?(g={parent:h,cache:h},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),ca(a,zn,h)):(h=v.cache,ca(a,zn,h),h!==g.cache&&Nm(a,[zn],l,!0))),vi(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Mr(s){s.flags|=4}function _g(s,a,l,h,g){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(nx())s.flags|=8192;else throw ho=Xh,Om}else s.flags&=-16777217}function Nw(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!qx(a))if(nx())s.flags|=8192;else throw ho=Xh,Om}function fd(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Xe():536870912,s.lanes|=a,vl|=a)}function Gc(s,a){if(!Lt)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 pn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,h=0;if(a)for(var g=s.child;g!==null;)l|=g.lanes|g.childLanes,h|=g.subtreeFlags&65011712,h|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)l|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=h,s.childLanes=l,a}function O3(s,a,l){var h=a.pendingProps;switch(km(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pn(a),null;case 1:return pn(a),null;case 3:return l=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Ar(zn),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(rl(a)?Mr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Tm())),pn(a),null;case 26:var g=a.type,v=a.memoizedState;return s===null?(Mr(a),v!==null?(pn(a),Nw(a,v)):(pn(a),_g(a,g,null,h,l))):v?v!==s.memoizedState?(Mr(a),pn(a),Nw(a,v)):(pn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Mr(a),pn(a),_g(a,g,s,h,l)),null;case 27:if(ke(a),l=ae.current,g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Mr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return pn(a),null}s=he.current,rl(a)?cS(a):(s=Bx(g,h,l),a.stateNode=s,Mr(a))}return pn(a),null;case 5:if(ke(a),g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Mr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return pn(a),null}if(v=he.current,rl(a))cS(a);else{var C=Ad(ae.current);switch(v){case 1:v=C.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=C.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=C.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=C.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=C.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?C.createElement(g,{is:h.is}):C.createElement(g)}}v[rn]=a,v[Ut]=h;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=v;e:switch(yi(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Mr(a)}}return pn(a),_g(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Mr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=ae.current,rl(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,g=gi,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[rn]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||Ex(s.nodeValue,l)),s||la(a,!0)}else s=Ad(s).createTextNode(h),s[rn]=a,a.stateNode=s}return pn(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(h=rl(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[rn]=a}else ao(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pn(a),s=!1}else l=Tm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(rs(a),a):(rs(a),null);if((a.flags&128)!==0)throw Error(i(558))}return pn(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=rl(a),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(i(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[rn]=a}else ao(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pn(a),g=!1}else g=Tm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(rs(a),a):(rs(a),null)}return rs(a),(a.flags&128)!==0?(a.lanes=l,a):(l=h!==null,s=s!==null&&s.memoizedState!==null,l&&(h=a.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),fd(a,a.updateQueue),pn(a),null);case 4:return De(),s===null&&Pg(a.stateNode.containerInfo),pn(a),null;case 10:return Ar(a.type),pn(a),null;case 19:if(Y(Dn),h=a.memoizedState,h===null)return pn(a),null;if(g=(a.flags&128)!==0,v=h.rendering,v===null)if(g)Gc(h,!1);else{if(Tn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=ed(s),v!==null){for(a.flags|=128,Gc(h,!1),s=v.updateQueue,a.updateQueue=s,fd(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)sS(l,s),l=l.sibling;return J(Dn,Dn.current&1|2),Lt&&Er(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&ct()>vd&&(a.flags|=128,g=!0,Gc(h,!1),a.lanes=4194304)}else{if(!g)if(s=ed(v),s!==null){if(a.flags|=128,g=!0,s=s.updateQueue,a.updateQueue=s,fd(a,s),Gc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!Lt)return pn(a),null}else 2*ct()-h.renderingStartTime>vd&&l!==536870912&&(a.flags|=128,g=!0,Gc(h,!1),a.lanes=4194304);h.isBackwards?(v.sibling=a.child,a.child=v):(s=h.last,s!==null?s.sibling=v:a.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=ct(),s.sibling=null,l=Dn.current,J(Dn,g?l&1|2:l&1),Lt&&Er(a,h.treeForkCount),s):(pn(a),null);case 22:case 23:return rs(a),zm(),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&&(pn(a),a.subtreeFlags&6&&(a.flags|=8192)):pn(a),l=a.updateQueue,l!==null&&fd(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&&Y(co),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Ar(zn),pn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function D3(s,a){switch(km(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Ar(zn),De(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if(rs(a),a.alternate===null)throw Error(i(340));ao()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(rs(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));ao()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Y(Dn),null;case 4:return De(),null;case 10:return Ar(a.type),null;case 22:case 23:return rs(a),zm(),s!==null&&Y(co),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Ar(zn),null;case 25:return null;default:return null}}function Lw(s,a){switch(km(a),a.tag){case 3:Ar(zn),De();break;case 26:case 27:case 5:ke(a);break;case 4:De();break;case 31:a.memoizedState!==null&&rs(a);break;case 13:rs(a);break;case 19:Y(Dn);break;case 10:Ar(a.type);break;case 22:case 23:rs(a),zm(),s!==null&&Y(co);break;case 24:Ar(zn)}}function Kc(s,a){try{var l=a.updateQueue,h=l!==null?l.lastEffect:null;if(h!==null){var g=h.next;l=g;do{if((l.tag&s)===s){h=void 0;var v=l.create,C=l.inst;h=v(),C.destroy=h}l=l.next}while(l!==g)}}catch(I){Vt(a,a.return,I)}}function ma(s,a,l){try{var h=a.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var C=h.inst,I=C.destroy;if(I!==void 0){C.destroy=void 0,g=a;var V=l,se=I;try{se()}catch(me){Vt(g,V,me)}}}h=h.next}while(h!==v)}}catch(me){Vt(a,a.return,me)}}function Mw(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{wS(a,l)}catch(h){Vt(s,s.return,h)}}}function jw(s,a,l){l.props=mo(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){Vt(s,a,h)}}function Vc(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(g){Vt(s,a,g)}}function ir(s,a){var l=s.ref,h=s.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(g){Vt(s,a,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){Vt(s,a,g)}else l.current=null}function Ow(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(g){Vt(s,s.return,g)}}function vg(s,a,l){try{var h=s.stateNode;i6(h,s.type,l,a),h[Ut]=a}catch(g){Vt(s,s.return,g)}}function Dw(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&wa(s.type)||s.tag===4}function yg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Dw(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&&wa(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 bg(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=Re));else if(h!==4&&(h===27&&wa(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(bg(s,a,l),s=s.sibling;s!==null;)bg(s,a,l),s=s.sibling}function pd(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&&wa(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(pd(s,a,l),s=s.sibling;s!==null;)pd(s,a,l),s=s.sibling}function Iw(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);yi(a,h,l),a[rn]=s,a[Ut]=l}catch(v){Vt(s,s.return,v)}}var jr=!1,Un=!1,Sg=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,ni=null;function I3(s,a){if(s=s.containerInfo,Fg=Dd,s=Y1(s),pm(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 g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var C=0,I=-1,V=-1,se=0,me=0,_e=s,re=null;t:for(;;){for(var ue;_e!==l||g!==0&&_e.nodeType!==3||(I=C+g),_e!==v||h!==0&&_e.nodeType!==3||(V=C+h),_e.nodeType===3&&(C+=_e.nodeValue.length),(ue=_e.firstChild)!==null;)re=_e,_e=ue;for(;;){if(_e===s)break t;if(re===l&&++se===g&&(I=C),re===v&&++me===h&&(V=C),(ue=_e.nextSibling)!==null)break;_e=re,re=_e.parentNode}_e=ue}l=I===-1||V===-1?null:{start:I,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ug={focusedElem:s,selectionRange:l},Dd=!1,ni=a;ni!==null;)if(a=ni,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ni=s;else for(;ni!==null;){switch(a=ni,v=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)g=s[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,l=a,g=v.memoizedProps,v=v.memoizedState,h=l.stateNode;try{var Fe=mo(l.type,g);s=h.getSnapshotBeforeUpdate(Fe,v),h.__reactInternalSnapshotBeforeUpdate=s}catch(it){Vt(l,l.return,it)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Gg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Gg(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,ni=s;break}ni=a.return}}function $w(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Dr(s,l),h&4&&Kc(5,l);break;case 1:if(Dr(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(C){Vt(l,l.return,C)}else{var g=mo(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(g,a,s.__reactInternalSnapshotBeforeUpdate)}catch(C){Vt(l,l.return,C)}}h&64&&Mw(l),h&512&&Vc(l,l.return);break;case 3:if(Dr(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{wS(s,a)}catch(C){Vt(l,l.return,C)}}break;case 27:a===null&&h&4&&Iw(l);case 26:case 5:Dr(s,l),a===null&&h&4&&Ow(l),h&512&&Vc(l,l.return);break;case 12:Dr(s,l);break;case 31:Dr(s,l),h&4&&Hw(s,l);break;case 13:Dr(s,l),h&4&&Fw(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=q3.bind(null,l),h6(s,l))));break;case 22:if(h=l.memoizedState!==null||jr,!h){a=a!==null&&a.memoizedState!==null||Un,g=jr;var v=Un;jr=h,(Un=a)&&!v?Ir(s,l,(l.subtreeFlags&8772)!==0):Dr(s,l),jr=g,Un=v}break;case 30:break;default:Dr(s,l)}}function Pw(s){var a=s.alternate;a!==null&&(s.alternate=null,Pw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&xe(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 bn=null,Wi=!1;function Or(s,a,l){for(l=l.child;l!==null;)zw(s,a,l),l=l.sibling}function zw(s,a,l){if(ne&&typeof ne.onCommitFiberUnmount=="function")try{ne.onCommitFiberUnmount(jt,l)}catch{}switch(l.tag){case 26:Un||ir(l,a),Or(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Un||ir(l,a);var h=bn,g=Wi;wa(l.type)&&(bn=l.stateNode,Wi=!1),Or(s,a,l),iu(l.stateNode),bn=h,Wi=g;break;case 5:Un||ir(l,a);case 6:if(h=bn,g=Wi,bn=null,Or(s,a,l),bn=h,Wi=g,bn!==null)if(Wi)try{(bn.nodeType===9?bn.body:bn.nodeName==="HTML"?bn.ownerDocument.body:bn).removeChild(l.stateNode)}catch(v){Vt(l,a,v)}else try{bn.removeChild(l.stateNode)}catch(v){Vt(l,a,v)}break;case 18:bn!==null&&(Wi?(s=bn,Mx(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),El(s)):Mx(bn,l.stateNode));break;case 4:h=bn,g=Wi,bn=l.stateNode.containerInfo,Wi=!0,Or(s,a,l),bn=h,Wi=g;break;case 0:case 11:case 14:case 15:ma(2,l,a),Un||ma(4,l,a),Or(s,a,l);break;case 1:Un||(ir(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&jw(l,a,h)),Or(s,a,l);break;case 21:Or(s,a,l);break;case 22:Un=(h=Un)||l.memoizedState!==null,Or(s,a,l),Un=h;break;default:Or(s,a,l)}}function Hw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{El(s)}catch(l){Vt(a,a.return,l)}}}function Fw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{El(s)}catch(l){Vt(a,a.return,l)}}function B3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new Bw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new Bw),a;default:throw Error(i(435,s.tag))}}function md(s,a){var l=B3(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var g=G3.bind(null,s,h);h.then(g,g)}})}function qi(s,a){var l=a.deletions;if(l!==null)for(var h=0;h<l.length;h++){var g=l[h],v=s,C=a,I=C;e:for(;I!==null;){switch(I.tag){case 27:if(wa(I.type)){bn=I.stateNode,Wi=!1;break e}break;case 5:bn=I.stateNode,Wi=!1;break e;case 3:case 4:bn=I.stateNode.containerInfo,Wi=!0;break e}I=I.return}if(bn===null)throw Error(i(160));zw(v,C,g),bn=null,Wi=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Uw(a,s),a=a.sibling}var Fs=null;function Uw(s,a){var l=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:qi(a,s),Gi(s),h&4&&(ma(3,s,s.return),Kc(3,s),ma(5,s,s.return));break;case 1:qi(a,s),Gi(s),h&512&&(Un||l===null||ir(l,l.return)),h&64&&jr&&(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 g=Fs;if(qi(a,s),Gi(s),h&512&&(Un||l===null||ir(l,l.return)),h&4){var v=l!==null?l.memoizedState:null;if(h=s.memoizedState,l===null)if(h===null)if(s.stateNode===null){e:{h=s.type,l=s.memoizedProps,g=g.ownerDocument||g;t:switch(h){case"title":v=g.getElementsByTagName("title")[0],(!v||v[Xt]||v[rn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(h),g.head.insertBefore(v,g.querySelector("head > title"))),yi(v,h,l),v[rn]=s,ft(v),h=v;break e;case"link":var C=Ux("link","href",g).get(h+(l.href||""));if(C){for(var I=0;I<C.length;I++)if(v=C[I],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){C.splice(I,1);break t}}v=g.createElement(h),yi(v,h,l),g.head.appendChild(v);break;case"meta":if(C=Ux("meta","content",g).get(h+(l.content||""))){for(I=0;I<C.length;I++)if(v=C[I],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){C.splice(I,1);break t}}v=g.createElement(h),yi(v,h,l),g.head.appendChild(v);break;default:throw Error(i(468,h))}v[rn]=s,ft(v),h=v}s.stateNode=h}else Wx(g,s.type,s.stateNode);else s.stateNode=Fx(g,h,s.memoizedProps);else v!==h?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,h===null?Wx(g,s.type,s.stateNode):Fx(g,h,s.memoizedProps)):h===null&&s.stateNode!==null&&vg(s,s.memoizedProps,l.memoizedProps)}break;case 27:qi(a,s),Gi(s),h&512&&(Un||l===null||ir(l,l.return)),l!==null&&h&4&&vg(s,s.memoizedProps,l.memoizedProps);break;case 5:if(qi(a,s),Gi(s),h&512&&(Un||l===null||ir(l,l.return)),s.flags&32){g=s.stateNode;try{rt(g,"")}catch(Fe){Vt(s,s.return,Fe)}}h&4&&s.stateNode!=null&&(g=s.memoizedProps,vg(s,g,l!==null?l.memoizedProps:g)),h&1024&&(Sg=!0);break;case 6:if(qi(a,s),Gi(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,l=s.stateNode;try{l.nodeValue=h}catch(Fe){Vt(s,s.return,Fe)}}break;case 3:if(Ld=null,g=Fs,Fs=Rd(a.containerInfo),qi(a,s),Fs=g,Gi(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{El(a.containerInfo)}catch(Fe){Vt(s,s.return,Fe)}Sg&&(Sg=!1,Ww(s));break;case 4:h=Fs,Fs=Rd(s.stateNode.containerInfo),qi(a,s),Gi(s),Fs=h;break;case 12:qi(a,s),Gi(s);break;case 31:qi(a,s),Gi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,md(s,h)));break;case 13:qi(a,s),Gi(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(_d=ct()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,md(s,h)));break;case 22:g=s.memoizedState!==null;var V=l!==null&&l.memoizedState!==null,se=jr,me=Un;if(jr=se||g,Un=me||V,qi(a,s),Un=me,jr=se,Gi(s),h&8192)e:for(a=s.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(l===null||V||jr||Un||go(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){V=l=a;try{if(v=V.stateNode,g)C=v.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{I=V.stateNode;var _e=V.memoizedProps.style,re=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;I.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Fe){Vt(V,V.return,Fe)}}}else if(a.tag===6){if(l===null){V=a;try{V.stateNode.nodeValue=g?"":V.memoizedProps}catch(Fe){Vt(V,V.return,Fe)}}}else if(a.tag===18){if(l===null){V=a;try{var ue=V.stateNode;g?jx(ue,!0):jx(V.stateNode,!1)}catch(Fe){Vt(V,V.return,Fe)}}}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,md(s,l))));break;case 19:qi(a,s),Gi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,md(s,h)));break;case 30:break;case 21:break;default:qi(a,s),Gi(s)}}function Gi(s){var a=s.flags;if(a&2){try{for(var l,h=s.return;h!==null;){if(Dw(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var g=l.stateNode,v=yg(s);pd(s,v,g);break;case 5:var C=l.stateNode;l.flags&32&&(rt(C,""),l.flags&=-33);var I=yg(s);pd(s,I,C);break;case 3:case 4:var V=l.stateNode.containerInfo,se=yg(s);bg(s,se,V);break;default:throw Error(i(161))}}catch(me){Vt(s,s.return,me)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function Ww(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;Ww(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Dr(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)$w(s,a.alternate,a),a=a.sibling}function go(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ma(4,a,a.return),go(a);break;case 1:ir(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&jw(a,a.return,l),go(a);break;case 27:iu(a.stateNode);case 26:case 5:ir(a,a.return),go(a);break;case 22:a.memoizedState===null&&go(a);break;case 30:go(a);break;default:go(a)}s=s.sibling}}function Ir(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,g=s,v=a,C=v.flags;switch(v.tag){case 0:case 11:case 15:Ir(g,v,l),Kc(4,v);break;case 1:if(Ir(g,v,l),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(se){Vt(h,h.return,se)}if(h=v,g=h.updateQueue,g!==null){var I=h.stateNode;try{var V=g.shared.hiddenCallbacks;if(V!==null)for(g.shared.hiddenCallbacks=null,g=0;g<V.length;g++)SS(V[g],I)}catch(se){Vt(h,h.return,se)}}l&&C&64&&Mw(v),Vc(v,v.return);break;case 27:Iw(v);case 26:case 5:Ir(g,v,l),l&&h===null&&C&4&&Ow(v),Vc(v,v.return);break;case 12:Ir(g,v,l);break;case 31:Ir(g,v,l),l&&C&4&&Hw(g,v);break;case 13:Ir(g,v,l),l&&C&4&&Fw(g,v);break;case 22:v.memoizedState===null&&Ir(g,v,l),Vc(v,v.return);break;case 30:break;default:Ir(g,v,l)}a=a.sibling}}function wg(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&&Oc(l))}function xg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Oc(s))}function Us(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)qw(s,a,l,h),a=a.sibling}function qw(s,a,l,h){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Us(s,a,l,h),g&2048&&Kc(9,a);break;case 1:Us(s,a,l,h);break;case 3:Us(s,a,l,h),g&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Oc(s)));break;case 12:if(g&2048){Us(s,a,l,h),s=a.stateNode;try{var v=a.memoizedProps,C=v.id,I=v.onPostCommit;typeof I=="function"&&I(C,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(V){Vt(a,a.return,V)}}else Us(s,a,l,h);break;case 31:Us(s,a,l,h);break;case 13:Us(s,a,l,h);break;case 23:break;case 22:v=a.stateNode,C=a.alternate,a.memoizedState!==null?v._visibility&2?Us(s,a,l,h):Yc(s,a):v._visibility&2?Us(s,a,l,h):(v._visibility|=2,ml(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),g&2048&&wg(C,a);break;case 24:Us(s,a,l,h),g&2048&&xg(a.alternate,a);break;default:Us(s,a,l,h)}}function ml(s,a,l,h,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=s,C=a,I=l,V=h,se=C.flags;switch(C.tag){case 0:case 11:case 15:ml(v,C,I,V,g),Kc(8,C);break;case 23:break;case 22:var me=C.stateNode;C.memoizedState!==null?me._visibility&2?ml(v,C,I,V,g):Yc(v,C):(me._visibility|=2,ml(v,C,I,V,g)),g&&se&2048&&wg(C.alternate,C);break;case 24:ml(v,C,I,V,g),g&&se&2048&&xg(C.alternate,C);break;default:ml(v,C,I,V,g)}a=a.sibling}}function Yc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=s,h=a,g=h.flags;switch(h.tag){case 22:Yc(l,h),g&2048&&wg(h.alternate,h);break;case 24:Yc(l,h),g&2048&&xg(h.alternate,h);break;default:Yc(l,h)}a=a.sibling}}var Xc=8192;function gl(s,a,l){if(s.subtreeFlags&Xc)for(s=s.child;s!==null;)Gw(s,a,l),s=s.sibling}function Gw(s,a,l){switch(s.tag){case 26:gl(s,a,l),s.flags&Xc&&s.memoizedState!==null&&x6(l,Fs,s.memoizedState,s.memoizedProps);break;case 5:gl(s,a,l);break;case 3:case 4:var h=Fs;Fs=Rd(s.stateNode.containerInfo),gl(s,a,l),Fs=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Xc,Xc=16777216,gl(s,a,l),Xc=h):gl(s,a,l));break;default:gl(s,a,l)}}function Kw(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 Zc(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];ni=h,Yw(h,s)}Kw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Vw(s),s=s.sibling}function Vw(s){switch(s.tag){case 0:case 11:case 15:Zc(s),s.flags&2048&&ma(9,s,s.return);break;case 3:Zc(s);break;case 12:Zc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,gd(s)):Zc(s);break;default:Zc(s)}}function gd(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];ni=h,Yw(h,s)}Kw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ma(8,a,a.return),gd(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,gd(a));break;default:gd(a)}s=s.sibling}}function Yw(s,a){for(;ni!==null;){var l=ni;switch(l.tag){case 0:case 11:case 15:ma(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:Oc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,ni=h;else e:for(l=s;ni!==null;){h=ni;var g=h.sibling,v=h.return;if(Pw(h),h===l){ni=null;break e}if(g!==null){g.return=v,ni=g;break e}ni=v}}}var $3={getCacheForType:function(s){var a=_i(zn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return _i(zn).controller.signal}},P3=typeof WeakMap=="function"?WeakMap:Map,zt=0,an=null,Et=null,Rt=0,Kt=0,as=null,ga=!1,_l=!1,Cg=!1,Br=0,Tn=0,_a=0,_o=0,kg=0,os=0,vl=0,Jc=null,Ki=null,Eg=!1,_d=0,Xw=0,vd=1/0,yd=null,va=null,Xn=0,ya=null,yl=null,$r=0,Tg=0,Ag=null,Zw=null,Qc=0,Rg=null;function ls(){return(zt&2)!==0&&Rt!==0?Rt&-Rt:E.T!==null?Dg():vs()}function Jw(){if(os===0)if((Rt&536870912)===0||Lt){var s=Ft;Ft<<=1,(Ft&3932160)===0&&(Ft=262144),os=s}else os=536870912;return s=ss.current,s!==null&&(s.flags|=32),os}function Vi(s,a,l){(s===an&&(Kt===2||Kt===9)||s.cancelPendingCommit!==null)&&(bl(s,0),ba(s,Rt,os,!1)),St(s,l),((zt&2)===0||s!==an)&&(s===an&&((zt&2)===0&&(_o|=l),Tn===4&&ba(s,Rt,os,!1)),sr(s))}function Qw(s,a,l){if((zt&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||pe(s,a),g=h?F3(s,a):Lg(s,a,!0),v=h;do{if(g===0){_l&&!h&&ba(s,a,0,!1);break}else{if(l=s.current.alternate,v&&!z3(l)){g=Lg(s,a,!1),v=!1;continue}if(g===2){if(v=a,s.errorRecoveryDisabledLanes&v)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var I=s;g=Jc;var V=I.current.memoizedState.isDehydrated;if(V&&(bl(I,C).flags|=256),C=Lg(I,C,!1),C!==2){if(Cg&&!V){I.errorRecoveryDisabledLanes|=v,_o|=v,g=4;break e}v=Ki,Ki=g,v!==null&&(Ki===null?Ki=v:Ki.push.apply(Ki,v))}g=C}if(v=!1,g!==2)continue}}if(g===1){bl(s,0),ba(s,a,0,!0);break}e:{switch(h=s,v=g,v){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:ba(h,a,os,!ga);break e;case 2:Ki=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(g=_d+300-ct(),10<g)){if(ba(h,a,os,!ga),K(h,0,!0)!==0)break e;$r=a,h.timeoutHandle=Nx(ex.bind(null,h,l,Ki,yd,Eg,a,os,_o,vl,ga,v,"Throttled",-0,0),g);break e}ex(h,l,Ki,yd,Eg,a,os,_o,vl,ga,v,null,-0,0)}}break}while(!0);sr(s)}function ex(s,a,l,h,g,v,C,I,V,se,me,_e,re,ue){if(s.timeoutHandle=-1,_e=a.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Re},Gw(a,v,_e);var Fe=(v&62914560)===v?_d-ct():(v&4194048)===v?Xw-ct():0;if(Fe=C6(_e,Fe),Fe!==null){$r=v,s.cancelPendingCommit=Fe(lx.bind(null,s,a,v,l,h,g,C,I,V,me,_e,null,re,ue)),ba(s,v,C,!se);return}}lx(s,a,v,l,h,g,C,I,V)}function z3(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 g=l[h],v=g.getSnapshot;g=g.value;try{if(!ns(v(),g))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 ba(s,a,l,h){a&=~kg,a&=~_o,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var g=a;0<g;){var v=31-$e(g),C=1<<v;h[v]=-1,g&=~C}l!==0&&Ie(s,l,a)}function bd(){return(zt&6)===0?(eu(0),!1):!0}function Ng(){if(Et!==null){if(Kt===0)var s=Et.return;else s=Et,Tr=oo=null,Gm(s),ul=null,Ic=0,s=Et;for(;s!==null;)Lw(s.alternate,s),s=s.return;Et=null}}function bl(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,a6(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),$r=0,Ng(),an=s,Et=l=kr(s.current,null),Rt=a,Kt=0,as=null,ga=!1,_l=pe(s,a),Cg=!1,vl=os=kg=_o=_a=Tn=0,Ki=Jc=null,Eg=!1,(a&8)!==0&&(a|=a&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=a;0<h;){var g=31-$e(h),v=1<<g;a|=s[g],h&=~v}return Br=a,Hh(),l}function tx(s,a){_t=null,E.H=Wc,a===cl||a===Yh?(a=_S(),Kt=3):a===Om?(a=_S(),Kt=4):Kt=a===lg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,as=a,Et===null&&(Tn=1,cd(s,Ss(a,s.current)))}function nx(){var s=ss.current;return s===null?!0:(Rt&4194048)===Rt?ks===null:(Rt&62914560)===Rt||(Rt&536870912)!==0?s===ks:!1}function ix(){var s=E.H;return E.H=Wc,s===null?Wc:s}function sx(){var s=E.A;return E.A=$3,s}function Sd(){Tn=4,ga||(Rt&4194048)!==Rt&&ss.current!==null||(_l=!0),(_a&134217727)===0&&(_o&134217727)===0||an===null||ba(an,Rt,os,!1)}function Lg(s,a,l){var h=zt;zt|=2;var g=ix(),v=sx();(an!==s||Rt!==a)&&(yd=null,bl(s,a)),a=!1;var C=Tn;e:do try{if(Kt!==0&&Et!==null){var I=Et,V=as;switch(Kt){case 8:Ng(),C=6;break e;case 3:case 2:case 9:case 6:ss.current===null&&(a=!0);var se=Kt;if(Kt=0,as=null,Sl(s,I,V,se),l&&_l){C=0;break e}break;default:se=Kt,Kt=0,as=null,Sl(s,I,V,se)}}H3(),C=Tn;break}catch(me){tx(s,me)}while(!0);return a&&s.shellSuspendCounter++,Tr=oo=null,zt=h,E.H=g,E.A=v,Et===null&&(an=null,Rt=0,Hh()),C}function H3(){for(;Et!==null;)rx(Et)}function F3(s,a){var l=zt;zt|=2;var h=ix(),g=sx();an!==s||Rt!==a?(yd=null,vd=ct()+500,bl(s,a)):_l=pe(s,a);e:do try{if(Kt!==0&&Et!==null){a=Et;var v=as;t:switch(Kt){case 1:Kt=0,as=null,Sl(s,a,v,1);break;case 2:case 9:if(mS(v)){Kt=0,as=null,ax(a);break}a=function(){Kt!==2&&Kt!==9||an!==s||(Kt=7),sr(s)},v.then(a,a);break e;case 3:Kt=7;break e;case 4:Kt=5;break e;case 7:mS(v)?(Kt=0,as=null,ax(a)):(Kt=0,as=null,Sl(s,a,v,7));break;case 5:var C=null;switch(Et.tag){case 26:C=Et.memoizedState;case 5:case 27:var I=Et;if(C?qx(C):I.stateNode.complete){Kt=0,as=null;var V=I.sibling;if(V!==null)Et=V;else{var se=I.return;se!==null?(Et=se,wd(se)):Et=null}break t}}Kt=0,as=null,Sl(s,a,v,5);break;case 6:Kt=0,as=null,Sl(s,a,v,6);break;case 8:Ng(),Tn=6;break e;default:throw Error(i(462))}}U3();break}catch(me){tx(s,me)}while(!0);return Tr=oo=null,E.H=h,E.A=g,zt=l,Et!==null?0:(an=null,Rt=0,Hh(),Tn)}function U3(){for(;Et!==null&&!Wt();)rx(Et)}function rx(s){var a=Rw(s.alternate,s,Br);s.memoizedProps=s.pendingProps,a===null?wd(s):Et=a}function ax(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=xw(l,a,a.pendingProps,a.type,void 0,Rt);break;case 11:a=xw(l,a,a.pendingProps,a.type.render,a.ref,Rt);break;case 5:Gm(a);default:Lw(l,a),a=Et=sS(a,Br),a=Rw(l,a,Br)}s.memoizedProps=s.pendingProps,a===null?wd(s):Et=a}function Sl(s,a,l,h){Tr=oo=null,Gm(a),ul=null,Ic=0;var g=a.return;try{if(L3(s,g,a,l,Rt)){Tn=1,cd(s,Ss(l,s.current)),Et=null;return}}catch(v){if(g!==null)throw Et=g,v;Tn=1,cd(s,Ss(l,s.current)),Et=null;return}a.flags&32768?(Lt||h===1?s=!0:_l||(Rt&536870912)!==0?s=!1:(ga=s=!0,(h===2||h===9||h===3||h===6)&&(h=ss.current,h!==null&&h.tag===13&&(h.flags|=16384))),ox(a,s)):wd(a)}function wd(s){var a=s;do{if((a.flags&32768)!==0){ox(a,ga);return}s=a.return;var l=O3(a.alternate,a,Br);if(l!==null){Et=l;return}if(a=a.sibling,a!==null){Et=a;return}Et=a=s}while(a!==null);Tn===0&&(Tn=5)}function ox(s,a){do{var l=D3(s.alternate,s);if(l!==null){l.flags&=32767,Et=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){Et=s;return}Et=s=l}while(s!==null);Tn=6,Et=null}function lx(s,a,l,h,g,v,C,I,V){s.cancelPendingCommit=null;do xd();while(Xn!==0);if((zt&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(v=a.lanes|a.childLanes,v|=ym,Be(s,l,v,C,I,V),s===an&&(Et=an=null,Rt=0),yl=a,ya=s,$r=l,Tg=v,Ag=g,Zw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,K3(Qe,function(){return fx(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=E.T,E.T=null,g=$.p,$.p=2,C=zt,zt|=4;try{I3(s,a,l)}finally{zt=C,$.p=g,E.T=h}}Xn=1,cx(),ux(),hx()}}function cx(){if(Xn===1){Xn=0;var s=ya,a=yl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var h=$.p;$.p=2;var g=zt;zt|=4;try{Uw(a,s);var v=Ug,C=Y1(s.containerInfo),I=v.focusedElem,V=v.selectionRange;if(C!==I&&I&&I.ownerDocument&&V1(I.ownerDocument.documentElement,I)){if(V!==null&&pm(I)){var se=V.start,me=V.end;if(me===void 0&&(me=se),"selectionStart"in I)I.selectionStart=se,I.selectionEnd=Math.min(me,I.value.length);else{var _e=I.ownerDocument||document,re=_e&&_e.defaultView||window;if(re.getSelection){var ue=re.getSelection(),Fe=I.textContent.length,it=Math.min(V.start,Fe),tn=V.end===void 0?it:Math.min(V.end,Fe);!ue.extend&&it>tn&&(C=tn,tn=it,it=C);var ee=K1(I,it),X=K1(I,tn);if(ee&&X&&(ue.rangeCount!==1||ue.anchorNode!==ee.node||ue.anchorOffset!==ee.offset||ue.focusNode!==X.node||ue.focusOffset!==X.offset)){var ie=_e.createRange();ie.setStart(ee.node,ee.offset),ue.removeAllRanges(),it>tn?(ue.addRange(ie),ue.extend(X.node,X.offset)):(ie.setEnd(X.node,X.offset),ue.addRange(ie))}}}}for(_e=[],ue=I;ue=ue.parentNode;)ue.nodeType===1&&_e.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<_e.length;I++){var ge=_e[I];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Dd=!!Fg,Ug=Fg=null}finally{zt=g,$.p=h,E.T=l}}s.current=a,Xn=2}}function ux(){if(Xn===2){Xn=0;var s=ya,a=yl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var h=$.p;$.p=2;var g=zt;zt|=4;try{$w(s,a.alternate,a)}finally{zt=g,$.p=h,E.T=l}}Xn=3}}function hx(){if(Xn===4||Xn===3){Xn=0,hn();var s=ya,a=yl,l=$r,h=Zw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Xn=5:(Xn=0,yl=ya=null,dx(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(va=null),Yn(l),a=a.stateNode,ne&&typeof ne.onCommitFiberRoot=="function")try{ne.onCommitFiberRoot(jt,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=E.T,g=$.p,$.p=2,E.T=null;try{for(var v=s.onRecoverableError,C=0;C<h.length;C++){var I=h[C];v(I.value,{componentStack:I.stack})}}finally{E.T=a,$.p=g}}($r&3)!==0&&xd(),sr(s),g=s.pendingLanes,(l&261930)!==0&&(g&42)!==0?s===Rg?Qc++:(Qc=0,Rg=s):Qc=0,eu(0)}}function dx(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Oc(a)))}function xd(){return cx(),ux(),hx(),fx()}function fx(){if(Xn!==5)return!1;var s=ya,a=Tg;Tg=0;var l=Yn($r),h=E.T,g=$.p;try{$.p=32>l?32:l,E.T=null,l=Ag,Ag=null;var v=ya,C=$r;if(Xn=0,yl=ya=null,$r=0,(zt&6)!==0)throw Error(i(331));var I=zt;if(zt|=4,Vw(v.current),qw(v,v.current,C,l),zt=I,eu(0,!1),ne&&typeof ne.onPostCommitFiberRoot=="function")try{ne.onPostCommitFiberRoot(jt,v)}catch{}return!0}finally{$.p=g,E.T=h,dx(s,a)}}function px(s,a,l){a=Ss(l,a),a=og(s.stateNode,a,2),s=da(s,a,2),s!==null&&(St(s,2),sr(s))}function Vt(s,a,l){if(s.tag===3)px(s,s,l);else for(;a!==null;){if(a.tag===3){px(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(va===null||!va.has(h))){s=Ss(l,s),l=mw(2),h=da(a,l,2),h!==null&&(gw(l,h,a,s),St(h,2),sr(h));break}}a=a.return}}function Mg(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new P3;var g=new Set;h.set(a,g)}else g=h.get(a),g===void 0&&(g=new Set,h.set(a,g));g.has(l)||(Cg=!0,g.add(l),s=W3.bind(null,s,a,l),a.then(s,s))}function W3(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,an===s&&(Rt&l)===l&&(Tn===4||Tn===3&&(Rt&62914560)===Rt&&300>ct()-_d?(zt&2)===0&&bl(s,0):kg|=l,vl===Rt&&(vl=0)),sr(s)}function mx(s,a){a===0&&(a=Xe()),s=so(s,a),s!==null&&(St(s,a),sr(s))}function q3(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),mx(s,l)}function G3(s,a){var l=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(l=g.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),mx(s,l)}function K3(s,a){return Ye(s,a)}var Cd=null,wl=null,jg=!1,kd=!1,Og=!1,Sa=0;function sr(s){s!==wl&&s.next===null&&(wl===null?Cd=wl=s:wl=wl.next=s),kd=!0,jg||(jg=!0,Y3())}function eu(s,a){if(!Og&&kd){Og=!0;do for(var l=!1,h=Cd;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var C=h.suspendedLanes,I=h.pingedLanes;v=(1<<31-$e(42|s)+1)-1,v&=g&~(C&~I),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,yx(h,v))}else v=Rt,v=K(h,h===an?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||pe(h,v)||(l=!0,yx(h,v));h=h.next}while(l);Og=!1}}function V3(){gx()}function gx(){kd=jg=!1;var s=0;Sa!==0&&r6()&&(s=Sa);for(var a=ct(),l=null,h=Cd;h!==null;){var g=h.next,v=_x(h,a);v===0?(h.next=null,l===null?Cd=g:l.next=g,g===null&&(wl=l)):(l=h,(s!==0||(v&3)!==0)&&(kd=!0)),h=g}Xn!==0&&Xn!==5||eu(s),Sa!==0&&(Sa=0)}function _x(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var C=31-$e(v),I=1<<C,V=g[C];V===-1?((I&l)===0||(I&h)!==0)&&(g[C]=be(I,a)):V<=a&&(s.expiredLanes|=I),v&=~I}if(a=an,l=Rt,l=K(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(Kt===2||Kt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Mt(h),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||pe(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(h!==null&&Mt(h),Yn(l)){case 2:case 8:l=Se;break;case 32:l=Qe;break;case 268435456:l=Ce;break;default:l=Qe}return h=vx.bind(null,s),l=Ye(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&Mt(h),s.callbackPriority=2,s.callbackNode=null,2}function vx(s,a){if(Xn!==0&&Xn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(xd()&&s.callbackNode!==l)return null;var h=Rt;return h=K(s,s===an?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(Qw(s,h,a),_x(s,ct()),s.callbackNode!=null&&s.callbackNode===l?vx.bind(null,s):null)}function yx(s,a){if(xd())return null;Qw(s,a,!0)}function Y3(){o6(function(){(zt&6)!==0?Ye(bt,V3):gx()})}function Dg(){if(Sa===0){var s=ol;s===0&&(s=pi,pi<<=1,(pi&261888)===0&&(pi=256)),Sa=s}return Sa}function bx(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:sa(""+s)}function Sx(s,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,s.id&&l.setAttribute("form",s.id),a.parentNode.insertBefore(l,a),s=new FormData(s),l.parentNode.removeChild(l),s}function X3(s,a,l,h,g){if(a==="submit"&&l&&l.stateNode===g){var v=bx((g[Ut]||null).action),C=h.submitter;C&&(a=(a=C[Ut]||null)?bx(a.formAction):C.getAttribute("formAction"),a!==null&&(v=a,C=null));var I=new Bh("action","action",null,h,g);s.push({event:I,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Sa!==0){var V=C?Sx(g,C):new FormData(g);tg(l,{pending:!0,data:V,method:g.method,action:v},null,V)}}else typeof v=="function"&&(I.preventDefault(),V=C?Sx(g,C):new FormData(g),tg(l,{pending:!0,data:V,method:g.method,action:v},v,V))},currentTarget:g}]})}}for(var Ig=0;Ig<vm.length;Ig++){var Bg=vm[Ig],Z3=Bg.toLowerCase(),J3=Bg[0].toUpperCase()+Bg.slice(1);Hs(Z3,"on"+J3)}Hs(J1,"onAnimationEnd"),Hs(Q1,"onAnimationIteration"),Hs(eS,"onAnimationStart"),Hs("dblclick","onDoubleClick"),Hs("focusin","onFocus"),Hs("focusout","onBlur"),Hs(p3,"onTransitionRun"),Hs(m3,"onTransitionStart"),Hs(g3,"onTransitionCancel"),Hs(tS,"onTransitionEnd"),ye("onMouseEnter",["mouseout","mouseover"]),ye("onMouseLeave",["mouseout","mouseover"]),ye("onPointerEnter",["pointerout","pointerover"]),ye("onPointerLeave",["pointerout","pointerover"]),Dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tu="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(" "),Q3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tu));function wx(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var h=s[l],g=h.event;h=h.listeners;e:{var v=void 0;if(a)for(var C=h.length-1;0<=C;C--){var I=h[C],V=I.instance,se=I.currentTarget;if(I=I.listener,V!==v&&g.isPropagationStopped())break e;v=I,g.currentTarget=se;try{v(g)}catch(me){zh(me)}g.currentTarget=null,v=V}else for(C=0;C<h.length;C++){if(I=h[C],V=I.instance,se=I.currentTarget,I=I.listener,V!==v&&g.isPropagationStopped())break e;v=I,g.currentTarget=se;try{v(g)}catch(me){zh(me)}g.currentTarget=null,v=V}}}}function Tt(s,a){var l=a[zs];l===void 0&&(l=a[zs]=new Set);var h=s+"__bubble";l.has(h)||(xx(a,s,2,!1),l.add(h))}function $g(s,a,l){var h=0;a&&(h|=4),xx(l,s,h,a)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function Pg(s){if(!s[Ed]){s[Ed]=!0,He.forEach(function(l){l!=="selectionchange"&&(Q3.has(l)||$g(l,!1,s),$g(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Ed]||(a[Ed]=!0,$g("selectionchange",!1,a))}}function xx(s,a,l,h){switch(Jx(a)){case 2:var g=T6;break;case 8:g=A6;break;default:g=e_}l=g.bind(null,a,l,s),g=void 0,!rm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),h?g!==void 0?s.addEventListener(a,l,{capture:!0,passive:g}):s.addEventListener(a,l,!0):g!==void 0?s.addEventListener(a,l,{passive:g}):s.addEventListener(a,l,!1)}function zg(s,a,l,h,g){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var I=h.stateNode.containerInfo;if(I===g)break;if(C===4)for(C=h.return;C!==null;){var V=C.tag;if((V===3||V===4)&&C.stateNode.containerInfo===g)return;C=C.return}for(;I!==null;){if(C=W(I),C===null)return;if(V=C.tag,V===5||V===6||V===26||V===27){h=v=C;continue e}I=I.parentNode}}h=h.return}jh(function(){var se=v,me=gt(l),_e=[];e:{var re=nS.get(s);if(re!==void 0){var ue=Bh,Fe=s;switch(s){case"keypress":if(Dh(l)===0)break e;case"keydown":case"keyup":ue=GM;break;case"focusin":Fe="focus",ue=cm;break;case"focusout":Fe="blur",ue=cm;break;case"beforeblur":case"afterblur":ue=cm;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":ue=L1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=OM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=YM;break;case J1:case Q1:case eS:ue=BM;break;case tS:ue=ZM;break;case"scroll":case"scrollend":ue=MM;break;case"wheel":ue=QM;break;case"copy":case"cut":case"paste":ue=PM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=j1;break;case"toggle":case"beforetoggle":ue=t3}var it=(a&4)!==0,tn=!it&&(s==="scroll"||s==="scrollend"),ee=it?re!==null?re+"Capture":null:re;it=[];for(var X=se,ie;X!==null;){var ge=X;if(ie=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ie===null||ee===null||(ge=xc(X,ee),ge!=null&&it.push(nu(X,ge,ie))),tn)break;X=X.return}0<it.length&&(re=new ue(re,Fe,null,l,me),_e.push({event:re,listeners:it}))}}if((a&7)===0){e:{if(re=s==="mouseover"||s==="pointerover",ue=s==="mouseout"||s==="pointerout",re&&l!==Ke&&(Fe=l.relatedTarget||l.fromElement)&&(W(Fe)||Fe[Hi]))break e;if((ue||re)&&(re=me.window===me?me:(re=me.ownerDocument)?re.defaultView||re.parentWindow:window,ue?(Fe=l.relatedTarget||l.toElement,ue=se,Fe=Fe?W(Fe):null,Fe!==null&&(tn=o(Fe),it=Fe.tag,Fe!==tn||it!==5&&it!==27&&it!==6)&&(Fe=null)):(ue=null,Fe=se),ue!==Fe)){if(it=L1,ge="onMouseLeave",ee="onMouseEnter",X="mouse",(s==="pointerout"||s==="pointerover")&&(it=j1,ge="onPointerLeave",ee="onPointerEnter",X="pointer"),tn=ue==null?re:Ee(ue),ie=Fe==null?re:Ee(Fe),re=new it(ge,X+"leave",ue,l,me),re.target=tn,re.relatedTarget=ie,ge=null,W(me)===se&&(it=new it(ee,X+"enter",Fe,l,me),it.target=ie,it.relatedTarget=tn,ge=it),tn=ge,ue&&Fe)t:{for(it=e6,ee=ue,X=Fe,ie=0,ge=ee;ge;ge=it(ge))ie++;ge=0;for(var tt=X;tt;tt=it(tt))ge++;for(;0<ie-ge;)ee=it(ee),ie--;for(;0<ge-ie;)X=it(X),ge--;for(;ie--;){if(ee===X||X!==null&&ee===X.alternate){it=ee;break t}ee=it(ee),X=it(X)}it=null}else it=null;ue!==null&&Cx(_e,re,ue,it,!1),Fe!==null&&tn!==null&&Cx(_e,tn,Fe,it,!0)}}e:{if(re=se?Ee(se):window,ue=re.nodeName&&re.nodeName.toLowerCase(),ue==="select"||ue==="input"&&re.type==="file")var It=H1;else if(P1(re))if(F1)It=h3;else{It=c3;var Ve=l3}else ue=re.nodeName,!ue||ue.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?se&&ia(se.elementType)&&(It=H1):It=u3;if(It&&(It=It(s,se))){z1(_e,It,l,me);break e}Ve&&Ve(s,re,se),s==="focusout"&&se&&re.type==="number"&&se.memoizedProps.value!=null&&Xo(re,"number",re.value)}switch(Ve=se?Ee(se):window,s){case"focusin":(P1(Ve)||Ve.contentEditable==="true")&&(Qo=Ve,mm=se,Lc=null);break;case"focusout":Lc=mm=Qo=null;break;case"mousedown":gm=!0;break;case"contextmenu":case"mouseup":case"dragend":gm=!1,X1(_e,l,me);break;case"selectionchange":if(f3)break;case"keydown":case"keyup":X1(_e,l,me)}var vt;if(hm)e:{switch(s){case"compositionstart":var Nt="onCompositionStart";break e;case"compositionend":Nt="onCompositionEnd";break e;case"compositionupdate":Nt="onCompositionUpdate";break e}Nt=void 0}else Jo?B1(s,l)&&(Nt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Nt="onCompositionStart");Nt&&(O1&&l.locale!=="ko"&&(Jo||Nt!=="onCompositionStart"?Nt==="onCompositionEnd"&&Jo&&(vt=R1()):(ra=me,am="value"in ra?ra.value:ra.textContent,Jo=!0)),Ve=Td(se,Nt),0<Ve.length&&(Nt=new M1(Nt,s,null,l,me),_e.push({event:Nt,listeners:Ve}),vt?Nt.data=vt:(vt=$1(l),vt!==null&&(Nt.data=vt)))),(vt=i3?s3(s,l):r3(s,l))&&(Nt=Td(se,"onBeforeInput"),0<Nt.length&&(Ve=new M1("onBeforeInput","beforeinput",null,l,me),_e.push({event:Ve,listeners:Nt}),Ve.data=vt)),X3(_e,s,se,l,me)}wx(_e,a)})}function nu(s,a,l){return{instance:s,listener:a,currentTarget:l}}function Td(s,a){for(var l=a+"Capture",h=[];s!==null;){var g=s,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=xc(s,l),g!=null&&h.unshift(nu(s,g,v)),g=xc(s,a),g!=null&&h.push(nu(s,g,v))),s.tag===3)return h;s=s.return}return[]}function e6(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Cx(s,a,l,h,g){for(var v=a._reactName,C=[];l!==null&&l!==h;){var I=l,V=I.alternate,se=I.stateNode;if(I=I.tag,V!==null&&V===h)break;I!==5&&I!==26&&I!==27||se===null||(V=se,g?(se=xc(l,v),se!=null&&C.unshift(nu(l,se,V))):g||(se=xc(l,v),se!=null&&C.push(nu(l,se,V)))),l=l.return}C.length!==0&&s.push({event:a,listeners:C})}var t6=/\r\n?/g,n6=/\u0000|\uFFFD/g;function kx(s){return(typeof s=="string"?s:""+s).replace(t6,`
|
|
9
|
+
`).replace(n6,"")}function Ex(s,a){return a=kx(a),kx(s)===a}function en(s,a,l,h,g,v){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||rt(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&rt(s,""+h);break;case"className":cn(s,"class",h);break;case"tabIndex":cn(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":cn(s,l,h);break;case"style":Gt(s,h,v);break;case"data":if(a!=="object"){cn(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=sa(""+h),s.setAttribute(l,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(a!=="input"&&en(s,a,"name",g.name,g,null),en(s,a,"formEncType",g.formEncType,g,null),en(s,a,"formMethod",g.formMethod,g,null),en(s,a,"formTarget",g.formTarget,g,null)):(en(s,a,"encType",g.encType,g,null),en(s,a,"method",g.method,g,null),en(s,a,"target",g.target,g,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=sa(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=Re);break;case"onScroll":h!=null&&Tt("scroll",s);break;case"onScrollEnd":h!=null&&Tt("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(g.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=sa(""+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":Tt("beforetoggle",s),Tt("toggle",s),$n(s,"popover",h);break;case"xlinkActuate":ti(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":ti(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":ti(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":ti(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":ti(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":ti(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":ti(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":ti(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":ti(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":$n(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=xr.get(l)||l,$n(s,l,h))}}function Hg(s,a,l,h,g,v){switch(l){case"style":Gt(s,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(g.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof h=="string"?rt(s,h):(typeof h=="number"||typeof h=="bigint")&&rt(s,""+h);break;case"onScroll":h!=null&&Tt("scroll",s);break;case"onScrollEnd":h!=null&&Tt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Re);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ot.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),a=l.slice(2,g?l.length-7:void 0),v=s[Ut]||null,v=v!=null?v[l]:null,typeof v=="function"&&s.removeEventListener(a,v,g),typeof h=="function")){typeof v!="function"&&v!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(a,h,g);break e}l in s?s[l]=h:h===!0?s.setAttribute(l,""):$n(s,l,h)}}}function yi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",s),Tt("load",s);var h=!1,g=!1,v;for(v in l)if(l.hasOwnProperty(v)){var C=l[v];if(C!=null)switch(v){case"src":h=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:en(s,a,v,C,l,null)}}g&&en(s,a,"srcSet",l.srcSet,l,null),h&&en(s,a,"src",l.src,l,null);return;case"input":Tt("invalid",s);var I=v=C=g=null,V=null,se=null;for(h in l)if(l.hasOwnProperty(h)){var me=l[h];if(me!=null)switch(h){case"name":g=me;break;case"type":C=me;break;case"checked":V=me;break;case"defaultChecked":se=me;break;case"value":v=me;break;case"defaultValue":I=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(i(137,a));break;default:en(s,a,h,me,l,null)}}eo(s,v,I,V,se,C,g,!1);return;case"select":Tt("invalid",s),h=C=v=null;for(g in l)if(l.hasOwnProperty(g)&&(I=l[g],I!=null))switch(g){case"value":v=I;break;case"defaultValue":C=I;break;case"multiple":h=I;default:en(s,a,g,I,l,null)}a=v,l=C,s.multiple=!!h,a!=null?mi(s,!!h,a,!1):l!=null&&mi(s,!!h,l,!0);return;case"textarea":Tt("invalid",s),v=g=h=null;for(C in l)if(l.hasOwnProperty(C)&&(I=l[C],I!=null))switch(C){case"value":h=I;break;case"defaultValue":g=I;break;case"children":v=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(i(91));break;default:en(s,a,C,I,l,null)}Zo(s,h,g,v);return;case"option":for(V in l)l.hasOwnProperty(V)&&(h=l[V],h!=null)&&(V==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":en(s,a,V,h,l,null));return;case"dialog":Tt("beforetoggle",s),Tt("toggle",s),Tt("cancel",s),Tt("close",s);break;case"iframe":case"object":Tt("load",s);break;case"video":case"audio":for(h=0;h<tu.length;h++)Tt(tu[h],s);break;case"image":Tt("error",s),Tt("load",s);break;case"details":Tt("toggle",s);break;case"embed":case"source":case"link":Tt("error",s),Tt("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(se in l)if(l.hasOwnProperty(se)&&(h=l[se],h!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:en(s,a,se,h,l,null)}return;default:if(ia(a)){for(me in l)l.hasOwnProperty(me)&&(h=l[me],h!==void 0&&Hg(s,a,me,h,l,void 0));return}}for(I in l)l.hasOwnProperty(I)&&(h=l[I],h!=null&&en(s,a,I,h,l,null))}function i6(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 g=null,v=null,C=null,I=null,V=null,se=null,me=null;for(ue in l){var _e=l[ue];if(l.hasOwnProperty(ue)&&_e!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":V=_e;default:h.hasOwnProperty(ue)||en(s,a,ue,null,h,_e)}}for(var re in h){var ue=h[re];if(_e=l[re],h.hasOwnProperty(re)&&(ue!=null||_e!=null))switch(re){case"type":v=ue;break;case"name":g=ue;break;case"checked":se=ue;break;case"defaultChecked":me=ue;break;case"value":C=ue;break;case"defaultValue":I=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:ue!==_e&&en(s,a,re,ue,h,_e)}}bc(s,C,I,V,se,me,v,g);return;case"select":ue=C=I=re=null;for(v in l)if(V=l[v],l.hasOwnProperty(v)&&V!=null)switch(v){case"value":break;case"multiple":ue=V;default:h.hasOwnProperty(v)||en(s,a,v,null,h,V)}for(g in h)if(v=h[g],V=l[g],h.hasOwnProperty(g)&&(v!=null||V!=null))switch(g){case"value":re=v;break;case"defaultValue":I=v;break;case"multiple":C=v;default:v!==V&&en(s,a,g,v,h,V)}a=I,l=C,h=ue,re!=null?mi(s,!!l,re,!1):!!h!=!!l&&(a!=null?mi(s,!!l,a,!0):mi(s,!!l,l?[]:"",!1));return;case"textarea":ue=re=null;for(I in l)if(g=l[I],l.hasOwnProperty(I)&&g!=null&&!h.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:en(s,a,I,null,h,g)}for(C in h)if(g=h[C],v=l[C],h.hasOwnProperty(C)&&(g!=null||v!=null))switch(C){case"value":re=g;break;case"defaultValue":ue=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&en(s,a,C,g,h,v)}Lh(s,re,ue);return;case"option":for(var Fe in l)re=l[Fe],l.hasOwnProperty(Fe)&&re!=null&&!h.hasOwnProperty(Fe)&&(Fe==="selected"?s.selected=!1:en(s,a,Fe,null,h,re));for(V in h)re=h[V],ue=l[V],h.hasOwnProperty(V)&&re!==ue&&(re!=null||ue!=null)&&(V==="selected"?s.selected=re&&typeof re!="function"&&typeof re!="symbol":en(s,a,V,re,h,ue));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var it in l)re=l[it],l.hasOwnProperty(it)&&re!=null&&!h.hasOwnProperty(it)&&en(s,a,it,null,h,re);for(se in h)if(re=h[se],ue=l[se],h.hasOwnProperty(se)&&re!==ue&&(re!=null||ue!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,a));break;default:en(s,a,se,re,h,ue)}return;default:if(ia(a)){for(var tn in l)re=l[tn],l.hasOwnProperty(tn)&&re!==void 0&&!h.hasOwnProperty(tn)&&Hg(s,a,tn,void 0,h,re);for(me in h)re=h[me],ue=l[me],!h.hasOwnProperty(me)||re===ue||re===void 0&&ue===void 0||Hg(s,a,me,re,h,ue);return}}for(var ee in l)re=l[ee],l.hasOwnProperty(ee)&&re!=null&&!h.hasOwnProperty(ee)&&en(s,a,ee,null,h,re);for(_e in h)re=h[_e],ue=l[_e],!h.hasOwnProperty(_e)||re===ue||re==null&&ue==null||en(s,a,_e,re,h,ue)}function Tx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function s6(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,l=performance.getEntriesByType("resource"),h=0;h<l.length;h++){var g=l[h],v=g.transferSize,C=g.initiatorType,I=g.duration;if(v&&I&&Tx(C)){for(C=0,I=g.responseEnd,h+=1;h<l.length;h++){var V=l[h],se=V.startTime;if(se>I)break;var me=V.transferSize,_e=V.initiatorType;me&&Tx(_e)&&(V=V.responseEnd,C+=me*(V<I?1:(I-se)/(V-se)))}if(--h,a+=8*(v+C)/(g.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 Fg=null,Ug=null;function Ad(s){return s.nodeType===9?s:s.ownerDocument}function Ax(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 Rx(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 Wg(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 qg=null;function r6(){var s=window.event;return s&&s.type==="popstate"?s===qg?!1:(qg=s,!0):(qg=null,!1)}var Nx=typeof setTimeout=="function"?setTimeout:void 0,a6=typeof clearTimeout=="function"?clearTimeout:void 0,Lx=typeof Promise=="function"?Promise:void 0,o6=typeof queueMicrotask=="function"?queueMicrotask:typeof Lx<"u"?function(s){return Lx.resolve(null).then(s).catch(l6)}:Nx;function l6(s){setTimeout(function(){throw s})}function wa(s){return s==="head"}function Mx(s,a){var l=a,h=0;do{var g=l.nextSibling;if(s.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(h===0){s.removeChild(g),El(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")iu(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,iu(l);for(var v=l.firstChild;v;){var C=v.nextSibling,I=v.nodeName;v[Xt]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=C}}else l==="body"&&iu(s.ownerDocument.body);l=g}while(l);El(a)}function jx(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 Gg(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":Gg(l),xe(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function c6(s,a,l,h){for(;s.nodeType===1;){var g=l;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[Xt])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Es(s.nextSibling),s===null)break}return null}function u6(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Es(s.nextSibling),s===null))return null;return s}function Ox(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Es(s.nextSibling),s===null))return null;return s}function Kg(s){return s.data==="$?"||s.data==="$~"}function Vg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function h6(s,a){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||l.readyState!=="loading")a();else{var h=function(){a(),l.removeEventListener("DOMContentLoaded",h)};l.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function Es(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var Yg=null;function Dx(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return Es(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function Ix(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 Bx(s,a,l){switch(a=Ad(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 iu(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);xe(s)}var Ts=new Map,$x=new Set;function Rd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Pr=$.d;$.d={f:d6,r:f6,D:p6,C:m6,L:g6,m:_6,X:y6,S:v6,M:b6};function d6(){var s=Pr.f(),a=bd();return s||a}function f6(s){var a=fe(s);a!==null&&a.tag===5&&a.type==="form"?tw(a):Pr.r(s)}var xl=typeof document>"u"?null:document;function Px(s,a,l){var h=xl;if(h&&typeof a=="string"&&a){var g=Fi(a);g='link[rel="'+s+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),$x.has(g)||($x.add(g),s={rel:s,crossOrigin:l,href:a},h.querySelector(g)===null&&(a=h.createElement("link"),yi(a,"link",s),ft(a),h.head.appendChild(a)))}}function p6(s){Pr.D(s),Px("dns-prefetch",s,null)}function m6(s,a){Pr.C(s,a),Px("preconnect",s,a)}function g6(s,a,l){Pr.L(s,a,l);var h=xl;if(h&&s&&a){var g='link[rel="preload"][as="'+Fi(a)+'"]';a==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+Fi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+Fi(l.imageSizes)+'"]')):g+='[href="'+Fi(s)+'"]';var v=g;switch(a){case"style":v=Cl(s);break;case"script":v=kl(s)}Ts.has(v)||(s=_({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Ts.set(v,s),h.querySelector(g)!==null||a==="style"&&h.querySelector(su(v))||a==="script"&&h.querySelector(ru(v))||(a=h.createElement("link"),yi(a,"link",s),ft(a),h.head.appendChild(a)))}}function _6(s,a){Pr.m(s,a);var l=xl;if(l&&s){var h=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+Fi(h)+'"][href="'+Fi(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=kl(s)}if(!Ts.has(v)&&(s=_({rel:"modulepreload",href:s},a),Ts.set(v,s),l.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ru(v)))return}h=l.createElement("link"),yi(h,"link",s),ft(h),l.head.appendChild(h)}}}function v6(s,a,l){Pr.S(s,a,l);var h=xl;if(h&&s){var g=ot(h).hoistableStyles,v=Cl(s);a=a||"default";var C=g.get(v);if(!C){var I={loading:0,preload:null};if(C=h.querySelector(su(v)))I.loading=5;else{s=_({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Ts.get(v))&&Xg(s,l);var V=C=h.createElement("link");ft(V),yi(V,"link",s),V._p=new Promise(function(se,me){V.onload=se,V.onerror=me}),V.addEventListener("load",function(){I.loading|=1}),V.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Nd(C,a,h)}C={type:"stylesheet",instance:C,count:1,state:I},g.set(v,C)}}}function y6(s,a){Pr.X(s,a);var l=xl;if(l&&s){var h=ot(l).hoistableScripts,g=kl(s),v=h.get(g);v||(v=l.querySelector(ru(g)),v||(s=_({src:s,async:!0},a),(a=Ts.get(g))&&Zg(s,a),v=l.createElement("script"),ft(v),yi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function b6(s,a){Pr.M(s,a);var l=xl;if(l&&s){var h=ot(l).hoistableScripts,g=kl(s),v=h.get(g);v||(v=l.querySelector(ru(g)),v||(s=_({src:s,async:!0,type:"module"},a),(a=Ts.get(g))&&Zg(s,a),v=l.createElement("script"),ft(v),yi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function zx(s,a,l,h){var g=(g=ae.current)?Rd(g):null;if(!g)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Cl(l.href),l=ot(g).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=Cl(l.href);var v=ot(g).hoistableStyles,C=v.get(s);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,C),(v=g.querySelector(su(s)))&&!v._p&&(C.instance=v,C.state.loading=5),Ts.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ts.set(s,l),v||S6(g,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=kl(l),l=ot(g).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 Cl(s){return'href="'+Fi(s)+'"'}function su(s){return'link[rel="stylesheet"]['+s+"]"}function Hx(s){return _({},s,{"data-precedence":s.precedence,precedence:null})}function S6(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}),yi(a,"link",l),ft(a),s.head.appendChild(a))}function kl(s){return'[src="'+Fi(s)+'"]'}function ru(s){return"script[async]"+s}function Fx(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Fi(l.href)+'"]');if(h)return a.instance=h,ft(h),h;var g=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),ft(h),yi(h,"style",g),Nd(h,l.precedence,s),a.instance=h;case"stylesheet":g=Cl(l.href);var v=s.querySelector(su(g));if(v)return a.state.loading|=4,a.instance=v,ft(v),v;h=Hx(l),(g=Ts.get(g))&&Xg(h,g),v=(s.ownerDocument||s).createElement("link"),ft(v);var C=v;return C._p=new Promise(function(I,V){C.onload=I,C.onerror=V}),yi(v,"link",h),a.state.loading|=4,Nd(v,l.precedence,s),a.instance=v;case"script":return v=kl(l.src),(g=s.querySelector(ru(v)))?(a.instance=g,ft(g),g):(h=l,(g=Ts.get(v))&&(h=_({},l),Zg(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),ft(g),yi(g,"link",h),s.head.appendChild(g),a.instance=g);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,Nd(h,l.precedence,s));return a.instance}function Nd(s,a,l){for(var h=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,C=0;C<h.length;C++){var I=h[C];if(I.dataset.precedence===a)v=I;else if(v!==g)break}v?v.parentNode.insertBefore(s,v.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function Xg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Zg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Ld=null;function Ux(s,a,l){if(Ld===null){var h=new Map,g=Ld=new Map;g.set(l,h)}else g=Ld,h=g.get(l),h||(h=new Map,g.set(l,h));if(h.has(s))return h;for(h.set(s,null),l=l.getElementsByTagName(s),g=0;g<l.length;g++){var v=l[g];if(!(v[Xt]||v[rn]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var C=v.getAttribute(a)||"";C=s+C;var I=h.get(C);I?I.push(v):h.set(C,[v])}}return h}function Wx(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function w6(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 qx(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function x6(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 g=Cl(h.href),v=a.querySelector(su(g));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Md.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=v,ft(v);return}v=a.ownerDocument||a,h=Hx(h),(g=Ts.get(g))&&Xg(h,g),v=v.createElement("link"),ft(v);var C=v;C._p=new Promise(function(I,V){C.onload=I,C.onerror=V}),yi(v,"link",h),l.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Md.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var Jg=0;function C6(s,a){return s.stylesheets&&s.count===0&&Od(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&Od(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&Jg===0&&(Jg=62500*s6());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Od(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>Jg?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function Md(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Od(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var jd=null;function Od(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,jd=new Map,a.forEach(k6,s),jd=null,Md.call(s))}function k6(s,a){if(!(a.state.loading&4)){var l=jd.get(s);if(l)var h=l.get(null);else{l=new Map,jd.set(s,l);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var C=g[v];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(l.set(C.dataset.precedence,C),h=C)}h&&l.set(null,h)}g=a.instance,C=g.getAttribute("data-precedence"),v=l.get(C)||h,v===h&&l.set(null,g),l.set(C,g),this.count++,h=Md.bind(this),g.addEventListener("load",h),g.addEventListener("error",h),v?v.parentNode.insertBefore(g,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),a.state.loading|=4}}var au={$$typeof:F,Provider:null,Consumer:null,_currentValue:j,_currentValue2:j,_threadCount:0};function E6(s,a,l,h,g,v,C,I,V){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=qt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.hiddenUpdates=qt(null),this.identifierPrefix=h,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Gx(s,a,l,h,g,v,C,I,V,se,me,_e){return s=new E6(s,a,l,C,V,se,me,_e,I),a=1,v===!0&&(a|=24),v=is(3,null,null,a),s.current=v,v.stateNode=s,a=Lm(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:l,cache:a},Dm(v),s}function Kx(s){return s?(s=nl,s):nl}function Vx(s,a,l,h,g,v){g=Kx(g),h.context===null?h.context=g:h.pendingContext=g,h=ha(a),h.payload={element:l},v=v===void 0?null:v,v!==null&&(h.callback=v),l=da(s,h,a),l!==null&&(Vi(l,s,a),$c(l,s,a))}function Yx(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Qg(s,a){Yx(s,a),(s=s.alternate)&&Yx(s,a)}function Xx(s){if(s.tag===13||s.tag===31){var a=so(s,67108864);a!==null&&Vi(a,s,67108864),Qg(s,67108864)}}function Zx(s){if(s.tag===13||s.tag===31){var a=ls();a=Ct(a);var l=so(s,a);l!==null&&Vi(l,s,a),Qg(s,a)}}var Dd=!0;function T6(s,a,l,h){var g=E.T;E.T=null;var v=$.p;try{$.p=2,e_(s,a,l,h)}finally{$.p=v,E.T=g}}function A6(s,a,l,h){var g=E.T;E.T=null;var v=$.p;try{$.p=8,e_(s,a,l,h)}finally{$.p=v,E.T=g}}function e_(s,a,l,h){if(Dd){var g=t_(h);if(g===null)zg(s,a,h,Id,l),Qx(s,h);else if(N6(g,s,a,l,h))h.stopPropagation();else if(Qx(s,h),a&4&&-1<R6.indexOf(s)){for(;g!==null;){var v=fe(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var C=yn(v.pendingLanes);if(C!==0){var I=v;for(I.pendingLanes|=2,I.entangledLanes|=2;C;){var V=1<<31-$e(C);I.entanglements[1]|=V,C&=~V}sr(v),(zt&6)===0&&(vd=ct()+500,eu(0))}}break;case 31:case 13:I=so(v,2),I!==null&&Vi(I,v,2),bd(),Qg(v,2)}if(v=t_(h),v===null&&zg(s,a,h,Id,l),v===g)break;g=v}g!==null&&h.stopPropagation()}else zg(s,a,h,null,l)}}function t_(s){return s=gt(s),n_(s)}var Id=null;function n_(s){if(Id=null,s=W(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=u(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 Id=s,null}function Jx(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(Yt()){case bt:return 2;case Se:return 8;case Qe:case Ne:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var i_=!1,xa=null,Ca=null,ka=null,ou=new Map,lu=new Map,Ea=[],R6="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 Qx(s,a){switch(s){case"focusin":case"focusout":xa=null;break;case"dragenter":case"dragleave":Ca=null;break;case"mouseover":case"mouseout":ka=null;break;case"pointerover":case"pointerout":ou.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":lu.delete(a.pointerId)}}function cu(s,a,l,h,g,v){return s===null||s.nativeEvent!==v?(s={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:v,targetContainers:[g]},a!==null&&(a=fe(a),a!==null&&Xx(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),s)}function N6(s,a,l,h,g){switch(a){case"focusin":return xa=cu(xa,s,a,l,h,g),!0;case"dragenter":return Ca=cu(Ca,s,a,l,h,g),!0;case"mouseover":return ka=cu(ka,s,a,l,h,g),!0;case"pointerover":var v=g.pointerId;return ou.set(v,cu(ou.get(v)||null,s,a,l,h,g)),!0;case"gotpointercapture":return v=g.pointerId,lu.set(v,cu(lu.get(v)||null,s,a,l,h,g)),!0}return!1}function eC(s){var a=W(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=u(l),a!==null){s.blockedOn=a,Ps(s.priority,function(){Zx(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,Ps(s.priority,function(){Zx(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 Bd(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=t_(s.nativeEvent);if(l===null){l=s.nativeEvent;var h=new l.constructor(l.type,l);Ke=h,l.target.dispatchEvent(h),Ke=null}else return a=fe(l),a!==null&&Xx(a),s.blockedOn=l,!1;a.shift()}return!0}function tC(s,a,l){Bd(s)&&l.delete(a)}function L6(){i_=!1,xa!==null&&Bd(xa)&&(xa=null),Ca!==null&&Bd(Ca)&&(Ca=null),ka!==null&&Bd(ka)&&(ka=null),ou.forEach(tC),lu.forEach(tC)}function $d(s,a){s.blockedOn===a&&(s.blockedOn=null,i_||(i_=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,L6)))}var Pd=null;function nC(s){Pd!==s&&(Pd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Pd===s&&(Pd=null);for(var a=0;a<s.length;a+=3){var l=s[a],h=s[a+1],g=s[a+2];if(typeof h!="function"){if(n_(h||l)===null)continue;break}var v=fe(l);v!==null&&(s.splice(a,3),a-=3,tg(v,{pending:!0,data:g,method:l.method,action:h},h,g))}}))}function El(s){function a(V){return $d(V,s)}xa!==null&&$d(xa,s),Ca!==null&&$d(Ca,s),ka!==null&&$d(ka,s),ou.forEach(a),lu.forEach(a);for(var l=0;l<Ea.length;l++){var h=Ea[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<Ea.length&&(l=Ea[0],l.blockedOn===null);)eC(l),l.blockedOn===null&&Ea.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(h=0;h<l.length;h+=3){var g=l[h],v=l[h+1],C=g[Ut]||null;if(typeof v=="function")C||nC(l);else if(C){var I=null;if(v&&v.hasAttribute("formAction")){if(g=v,C=v[Ut]||null)I=C.formAction;else if(n_(g)!==null)continue}else I=C.action;typeof I=="function"?l[h+1]=I:(l.splice(h,3),h-=3),nC(l)}}}function iC(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(C){return g=C})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),h||setTimeout(l,20)}function l(){if(!h&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,g=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),g!==null&&(g(),g=null)}}}function s_(s){this._internalRoot=s}zd.prototype.render=s_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=ls();Vx(l,h,s,a,null,null)},zd.prototype.unmount=s_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Vx(s.current,2,null,s,null,null),bd(),a[Hi]=null}};function zd(s){this._internalRoot=s}zd.prototype.unstable_scheduleHydration=function(s){if(s){var a=vs();s={blockedOn:null,target:s,priority:a};for(var l=0;l<Ea.length&&a!==0&&a<Ea[l].priority;l++);Ea.splice(l,0,s),l===0&&eC(s)}};var sC=t.version;if(sC!=="19.2.7")throw Error(i(527,sC,"19.2.7"));$.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=p(a),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var M6={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hd.isDisabled&&Hd.supportsFiber)try{jt=Hd.inject(M6),ne=Hd}catch{}}return hu.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,h="",g=hw,v=dw,C=fw;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=Gx(s,1,!1,null,null,l,h,null,g,v,C,iC),s[Hi]=a.current,Pg(s),new s_(a)},hu.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var h=!1,g="",v=hw,C=dw,I=fw,V=null;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(I=l.onRecoverableError),l.formState!==void 0&&(V=l.formState)),a=Gx(s,1,!0,a,l??null,h,g,V,v,C,I,iC),a.context=Kx(null),l=a.current,h=ls(),h=Ct(h),g=ha(h),g.callback=null,da(l,g,h),l=h,a.current.lanes=l,St(a,l),sr(a),s[Hi]=a.current,Pg(s),new zd(a)},hu.version="19.2.7",hu}var mC;function y4(){if(mC)return l_.exports;mC=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(),l_.exports=v4(),l_.exports}var b4=y4();var gC="popstate";function _C(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function S4(e={}){function t(i,r){let o=r.state?.masked,{pathname:u,search:d,hash:f}=o||i.location;return Hv("",{pathname:u,search:d,hash:f},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:sh(r)}return x4(t,n,null,e)}function Sn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ys(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function w4(){return Math.random().toString(36).substring(2,10)}function vC(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 Hv(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?hc(t):t,state:n,key:t&&t.key||i||w4(),mask:r}}function sh({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 hc(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 x4(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,u=r.history,d="POP",f=null,p=m();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function m(){return(u.state||{idx:null}).idx}function _(){d="POP";let k=m(),O=k==null?null:k-p;p=k,f&&f({action:d,location:x.location,delta:O})}function b(k,O){d="PUSH";let P=_C(k)?k:Hv(x.location,k,O);p=m()+1;let F=vC(P,p),T=x.createHref(P.mask||P);try{u.pushState(F,"",T)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;r.location.assign(T)}o&&f&&f({action:d,location:x.location,delta:1})}function S(k,O){d="REPLACE";let P=_C(k)?k:Hv(x.location,k,O);p=m();let F=vC(P,p),T=x.createHref(P.mask||P);u.replaceState(F,"",T),o&&f&&f({action:d,location:x.location,delta:0})}function w(k){return C4(r,k)}let x={get action(){return d},get location(){return e(r,u)},listen(k){if(f)throw new Error("A history only accepts one active listener");return r.addEventListener(gC,_),f=k,()=>{r.removeEventListener(gC,_),f=null}},createHref(k){return t(r,k)},createURL:w,encodeLocation(k){let O=w(k);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:b,replace:S,go(k){return u.go(k)}};return x}function C4(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),Sn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:sh(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function L5(e,t,n="/"){return k4(e,t,n,!1)}function k4(e,t,n,i,r){let o=typeof t=="string"?hc(t):t,u=Jr(o.pathname||"/",n);if(u==null)return null;let d=E4(e),f=null,p=$4(u);for(let m=0;f==null&&m<d.length;++m)f=I4(d[m],p,i);return f}function E4(e){let t=M5(e);return T4(t),t}function M5(e,t=[],n=[],i="",r=!1){let o=(u,d,f=r,p)=>{let m={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(i)&&f)return;Sn(m.relativePath.startsWith(i),`Absolute route path "${m.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(i.length)}let _=Ks([i,m.relativePath]),b=n.concat(m);u.children&&u.children.length>0&&(Sn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),M5(u.children,t,b,_,f)),!(u.path==null&&!u.index)&&t.push({path:_,score:O4(_,u.index),routesMeta:b})};return e.forEach((u,d)=>{if(u.path===""||!u.path?.includes("?"))o(u,d);else for(let f of j5(u.path))o(u,d,!0,f)}),t}function j5(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 u=j5(i.join("/")),d=[];return d.push(...u.map(f=>f===""?o:[o,f].join("/"))),r&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function T4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:D4(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var A4=/^:[\w-]+$/,R4=3,N4=2,L4=1,M4=10,j4=-2,yC=e=>e==="*";function O4(e,t){let n=e.split("/"),i=n.length;return n.some(yC)&&(i+=j4),t&&(i+=N4),n.filter(r=>!yC(r)).reduce((r,o)=>r+(A4.test(o)?R4:o===""?L4:M4),i)}function D4(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 I4(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",u=[];for(let d=0;d<i.length;++d){let f=i[d],p=d===i.length-1,m=o==="/"?t:t.slice(o.length)||"/",_=Vf({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},m),b=f.route;if(!_&&p&&n&&!i[i.length-1].route.index&&(_=Vf({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!_)return null;Object.assign(r,_.params),u.push({params:r,pathname:Ks([o,_.pathname]),pathnameBase:F4(Ks([o,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(o=Ks([o,_.pathnameBase]))}return u}function Vf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=B4(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],u=o.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:i.reduce((p,{paramName:m,isOptional:_},b)=>{if(m==="*"){let w=d[b]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[b];return _&&!S?p[m]=void 0:p[m]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:u,pattern:e}}function B4(e,t=!1,n=!0){Ys(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,(u,d,f,p,m)=>{if(i.push({paramName:d,isOptional:f!=null}),f){let _=m.charAt(p+u.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function $4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ys(!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 Jr(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 P4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function z4(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?hc(e):e,o;return n?(n=O5(n),n.startsWith("/")?o=bC(n.substring(1),"/"):o=bC(n,t)):o=t,{pathname:o,search:U4(i),hash:W4(r)}}function bC(e,t){let n=Yf(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function d_(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 H4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Gb(e){let t=H4(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Lp(e,t,n,i=!1){let r;typeof e=="string"?r=hc(e):(r={...e},Sn(!r.pathname||!r.pathname.includes("?"),d_("?","pathname","search",r)),Sn(!r.pathname||!r.pathname.includes("#"),d_("#","pathname","hash",r)),Sn(!r.search||!r.search.includes("#"),d_("#","search","hash",r)));let o=e===""||r.pathname==="",u=o?"/":r.pathname,d;if(u==null)d=n;else{let _=t.length-1;if(!i&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),_-=1;r.pathname=b.join("/")}d=_>=0?t[_]:"/"}let f=z4(r,d),p=u&&u!=="/"&&u.endsWith("/"),m=(o||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||m)&&(f.pathname+="/"),f}var O5=e=>e.replace(/\/\/+/g,"/"),Ks=e=>O5(e.join("/")),Yf=e=>e.replace(/\/+$/,""),F4=e=>Yf(e).replace(/^\/*/,"/"),U4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,W4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,q4=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 G4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function K4(e){let t=e.map(n=>n.route.path).filter(Boolean);return Ks(t)||"/"}var D5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function I5(e,t){let n=e;if(typeof n!="string"||!P4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(D5)try{let o=new URL(window.location.href),u=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Jr(u.pathname,t);u.origin===o.origin&&d!=null?n=d+u.search+u.hash:r=!0}catch{Ys(!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 B5=["POST","PUT","PATCH","DELETE"];new Set(B5);var V4=["GET",...B5];new Set(V4);var dc=y.createContext(null);dc.displayName="DataRouter";var Mp=y.createContext(null);Mp.displayName="DataRouterState";var $5=y.createContext(!1);function Y4(){return y.useContext($5)}var P5=y.createContext({isTransitioning:!1});P5.displayName="ViewTransition";var X4=y.createContext(new Map);X4.displayName="Fetchers";var Z4=y.createContext(null);Z4.displayName="Await";var gs=y.createContext(null);gs.displayName="Navigation";var wh=y.createContext(null);wh.displayName="Location";var br=y.createContext({outlet:null,matches:[],isDataRoute:!1});br.displayName="Route";var Kb=y.createContext(null);Kb.displayName="RouteError";var z5="REACT_ROUTER_ERROR",J4="REDIRECT",Q4="ROUTE_ERROR_RESPONSE";function ej(e){if(e.startsWith(`${z5}:${J4}:{`))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 tj(e){if(e.startsWith(`${z5}:${Q4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new q4(t.status,t.statusText,t.data)}catch{}}function nj(e,{relative:t}={}){Sn(fc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=y.useContext(gs),{hash:r,pathname:o,search:u}=xh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Ks([n,o])),i.createHref({pathname:d,search:u,hash:r})}function fc(){return y.useContext(wh)!=null}function _s(){return Sn(fc(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(wh).location}var H5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function F5(e){y.useContext(gs).static||y.useLayoutEffect(e)}function pc(){let{isDataRoute:e}=y.useContext(br);return e?mj():ij()}function ij(){Sn(fc(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(dc),{basename:t,navigator:n}=y.useContext(gs),{matches:i}=y.useContext(br),{pathname:r}=_s(),o=JSON.stringify(Gb(i)),u=y.useRef(!1);return F5(()=>{u.current=!0}),y.useCallback((f,p={})=>{if(Ys(u.current,H5),!u.current)return;if(typeof f=="number"){n.go(f);return}let m=Lp(f,JSON.parse(o),r,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ks([t,m.pathname])),(p.replace?n.replace:n.push)(m,p.state,p)},[t,n,o,r,e])}y.createContext(null);function xh(e,{relative:t}={}){let{matches:n}=y.useContext(br),{pathname:i}=_s(),r=JSON.stringify(Gb(n));return y.useMemo(()=>Lp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function sj(e,t){return U5(e,t)}function U5(e,t,n){Sn(fc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(gs),{matches:r}=y.useContext(br),o=r[r.length-1],u=o?o.params:{},d=o?o.pathname:"/",f=o?o.pathnameBase:"/",p=o&&o.route;{let k=p&&p.path||"";q5(d,!p||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
+
|
|
11
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let m=_s(),_;if(t){let k=typeof t=="string"?hc(t):t;Sn(f==="/"||k.pathname?.startsWith(f),`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 "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),_=k}else _=m;let b=_.pathname||"/",S=b;if(f!=="/"){let k=f.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(k=>Object.assign(k,{route:n.manifest[k.route.id]||k.route})):L5(e,{pathname:S});Ys(p||w!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Ys(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=cj(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},u,k.params),pathname:Ks([f,i.encodeLocation?i.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Ks([f,i.encodeLocation?i.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),r,n);return t&&x?y.createElement(wh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,..._},navigationType:"POP"}},x):x}function rj(){let e=pj(),t=G4(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},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=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,u)}var aj=y.createElement(rj,null),W5=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=tj(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(br.Provider,{value:this.props.routeContext},y.createElement(Kb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(oj,{error:e},t):t}};W5.contextType=$5;var f_=new WeakMap;function oj({children:e,error:t}){let{basename:n}=y.useContext(gs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=ej(t.digest);if(i){let r=f_.get(t);if(r)throw r;let o=I5(i.location,n);if(D5&&!f_.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw f_.set(t,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function lj({routeContext:e,match:t,children:n}){let i=y.useContext(dc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(br.Provider,{value:e},n)}function cj(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 m=r.findIndex(_=>_.route.id&&o?.[_.route.id]!==void 0);Sn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,m+1))}let u=!1,d=-1;if(n&&i){u=i.renderFallback;for(let m=0;m<r.length;m++){let _=r[m];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(d=m),_.route.id){let{loaderData:b,errors:S}=i,w=_.route.loader&&!b.hasOwnProperty(_.route.id)&&(!S||S[_.route.id]===void 0);if(_.route.lazy||w){n.isStatic&&(u=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let f=n?.onError,p=i&&f?(m,_)=>{f(m,{location:i.location,params:i.matches?.[0]?.params??{},pattern:K4(i.matches),errorInfo:_})}:void 0;return r.reduceRight((m,_,b)=>{let S,w=!1,x=null,k=null;i&&(S=o&&_.route.id?o[_.route.id]:void 0,x=_.route.errorElement||aj,u&&(d<0&&b===0?(q5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):d===b&&(w=!0,k=_.route.hydrateFallbackElement||null)));let O=t.concat(r.slice(0,b+1)),P=()=>{let F;return S?F=x:w?F=k:_.route.Component?F=y.createElement(_.route.Component,null):_.route.element?F=_.route.element:F=m,y.createElement(lj,{match:_,routeContext:{outlet:m,matches:O,isDataRoute:i!=null},children:F})};return i&&(_.route.ErrorBoundary||_.route.errorElement||b===0)?y.createElement(W5,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:P(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:p}):P()},null)}function Vb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uj(e){let t=y.useContext(dc);return Sn(t,Vb(e)),t}function hj(e){let t=y.useContext(Mp);return Sn(t,Vb(e)),t}function dj(e){let t=y.useContext(br);return Sn(t,Vb(e)),t}function Yb(e){let t=dj(e),n=t.matches[t.matches.length-1];return Sn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function fj(){return Yb("useRouteId")}function pj(){let e=y.useContext(Kb),t=hj("useRouteError"),n=Yb("useRouteError");return e!==void 0?e:t.errors?.[n]}function mj(){let{router:e}=uj("useNavigate"),t=Yb("useNavigate"),n=y.useRef(!1);return F5(()=>{n.current=!0}),y.useCallback(async(r,o={})=>{Ys(n.current,H5),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var SC={};function q5(e,t,n){!t&&!SC[e]&&(SC[e]=!0,Ys(!1,n))}y.memo(gj);function gj({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return U5(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function p_({to:e,replace:t,state:n,relative:i}){Sn(fc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=y.useContext(gs);Ys(!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(br),{pathname:u}=_s(),d=pc(),f=Lp(e,Gb(o),u,i==="path"),p=JSON.stringify(f);return y.useEffect(()=>{d(JSON.parse(p),{replace:t,state:n,relative:i})},[d,p,i,t,n]),null}function Dl(e){Sn(!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 _j({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:u}){Sn(!fc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=y.useMemo(()=>({basename:d,navigator:r,static:o,useTransitions:u,future:{}}),[d,r,o,u]);typeof n=="string"&&(n=hc(n));let{pathname:p="/",search:m="",hash:_="",state:b=null,key:S="default",mask:w}=n,x=y.useMemo(()=>{let k=Jr(p,d);return k==null?null:{location:{pathname:k,search:m,hash:_,state:b,key:S,mask:w},navigationType:i}},[d,p,m,_,b,S,i,w]);return Ys(x!=null,`<Router basename="${d}"> is not able to match the URL "${p}${m}${_}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:y.createElement(gs.Provider,{value:f},y.createElement(wh.Provider,{children:t,value:x}))}function vj({children:e,location:t}){return sj(Fv(e),t)}function Fv(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,Fv(i.props.children,o));return}Sn(i.type===Dl,`[${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>`),Sn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let u={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&&(u.children=Fv(i.props.children,o)),n.push(u)}),n}var xf="get",Cf="application/x-www-form-urlencoded";function jp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yj(e){return jp(e)&&e.tagName.toLowerCase()==="button"}function bj(e){return jp(e)&&e.tagName.toLowerCase()==="form"}function Sj(e){return jp(e)&&e.tagName.toLowerCase()==="input"}function wj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xj(e,t){return e.button===0&&(!t||t==="_self")&&!wj(e)}var Fd=null;function Cj(){if(Fd===null)try{new FormData(document.createElement("form"),0),Fd=!1}catch{Fd=!0}return Fd}var kj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function m_(e){return e!=null&&!kj.has(e)?(Ys(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cf}"`),null):e}function Ej(e,t){let n,i,r,o,u;if(bj(e)){let d=e.getAttribute("action");i=d?Jr(d,t):null,n=e.getAttribute("method")||xf,r=m_(e.getAttribute("enctype"))||Cf,o=new FormData(e)}else if(yj(e)||Sj(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 f=e.getAttribute("formaction")||d.getAttribute("action");if(i=f?Jr(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||xf,r=m_(e.getAttribute("formenctype"))||m_(d.getAttribute("enctype"))||Cf,o=new FormData(d,e),!Cj()){let{name:p,type:m,value:_}=e;if(m==="image"){let b=p?`${p}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else p&&o.append(p,_)}}else{if(jp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=xf,i=null,r=Cf,u=e}return o&&r==="text/plain"&&(u=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Xb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function G5(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&&Jr(r.pathname,t)==="/"?r.pathname=`${Yf(t)}/_root.${i}`:r.pathname=`${Yf(r.pathname)}.${i}`,r}async function Tj(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 Aj(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 Rj(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let u=await Tj(o,n);return u.links?u.links():[]}return[]}));return jj(i.flat(1).filter(Aj).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function wC(e,t,n,i,r,o){let u=(f,p)=>n[p]?f.route.id!==n[p].route.id:!0,d=(f,p)=>n[p].pathname!==f.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==f.params["*"];return o==="assets"?t.filter((f,p)=>u(f,p)||d(f,p)):o==="data"?t.filter((f,p)=>{let m=i.routes[f.route.id];if(!m||!m.hasLoader)return!1;if(u(f,p)||d(f,p))return!0;if(f.route.shouldRevalidate){let _=f.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Nj(e,t,{includeHydrateFallback:n}={}){return Lj(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 Lj(e){return[...new Set(e)]}function Mj(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function jj(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(Mj(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function Zb(){let e=y.useContext(dc);return Xb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Oj(){let e=y.useContext(Mp);return Xb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Jb=y.createContext(void 0);Jb.displayName="FrameworkContext";function Qb(){let e=y.useContext(Jb);return Xb(e,"You must render this element inside a <HydratedRouter> element"),e}function Dj(e,t){let n=y.useContext(Jb),[i,r]=y.useState(!1),[o,u]=y.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:_}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let x=O=>{O.forEach(P=>{u(P.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return b.current&&k.observe(b.current),()=>{k.disconnect()}}},[e]),y.useEffect(()=>{if(i){let x=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(x)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),u(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:du(d,S),onBlur:du(f,w),onMouseEnter:du(p,S),onMouseLeave:du(m,w),onTouchStart:du(_,S)}]:[!1,b,{}]}function du(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ij({page:e,...t}){let n=Y4(),{router:i}=Zb(),r=y.useMemo(()=>L5(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?y.createElement($j,{page:e,matches:r,...t}):y.createElement(Pj,{page:e,matches:r,...t}):null}function Bj(e){let{manifest:t,routeModules:n}=Qb(),[i,r]=y.useState([]);return y.useEffect(()=>{let o=!1;return Rj(e,t,n).then(u=>{o||r(u)}),()=>{o=!0}},[e,t,n]),i}function $j({page:e,matches:t,...n}){let i=_s(),{future:r}=Qb(),{basename:o}=Zb(),u=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=G5(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,p=[];for(let m of t)typeof m.route.shouldRevalidate=="function"?f=!0:p.push(m.route.id);return f&&p.length>0&&d.searchParams.set("_routes",p.join(",")),[d.pathname+d.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return y.createElement(y.Fragment,null,u.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function Pj({page:e,matches:t,...n}){let i=_s(),{future:r,manifest:o,routeModules:u}=Qb(),{basename:d}=Zb(),{loaderData:f,matches:p}=Oj(),m=y.useMemo(()=>wC(e,t,p,o,i,"data"),[e,t,p,o,i]),_=y.useMemo(()=>wC(e,t,p,o,i,"assets"),[e,t,p,o,i]),b=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,k=!1;if(t.forEach(P=>{let F=o.routes[P.route.id];!F||!F.hasLoader||(!m.some(T=>T.route.id===P.route.id)&&P.route.id in f&&u[P.route.id]?.shouldRevalidate||F.hasClientLoader?k=!0:x.add(P.route.id))}),x.size===0)return[];let O=G5(e,d,r.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&O.searchParams.set("_routes",t.filter(P=>x.has(P.route.id)).map(P=>P.route.id).join(",")),[O.pathname+O.search]},[d,r.v8_trailingSlashAwareDataRequests,f,i,o,m,t,e,u]),S=y.useMemo(()=>Nj(_,o),[_,o]),w=Bj(_);return y.createElement(y.Fragment,null,b.map(x=>y.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),S.map(x=>y.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),w.map(({key:x,link:k})=>y.createElement("link",{key:x,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function zj(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Hj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Hj&&(window.__reactRouterVersion="7.17.0")}catch{}function Fj({basename:e,children:t,useTransitions:n,window:i}){let r=y.useRef();r.current==null&&(r.current=S4({window:i,v5Compat:!0}));let o=r.current,[u,d]=y.useState({action:o.action,location:o.location}),f=y.useCallback(p=>{n===!1?d(p):y.startTransition(()=>d(p))},[n]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.createElement(_j,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:n})}var K5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rh=y.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:u,mask:d,state:f,target:p,to:m,preventScrollReset:_,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:k,navigator:O,useTransitions:P}=y.useContext(gs),F=typeof m=="string"&&K5.test(m),T=I5(m,k);m=T.to;let L=nj(m,{relative:r}),M=_s(),z=null;if(d){let N=Lp(d,[],M.mask?M.mask.pathname:"/",!0);k!=="/"&&(N.pathname=N.pathname==="/"?k:Ks([k,N.pathname])),z=O.createHref(N)}let[U,Z,Q]=Dj(i,w),G=Gj(m,{replace:u,mask:d,state:f,target:p,preventScrollReset:_,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:P});function B(N){t&&t(N),N.defaultPrevented||G(N)}let R=!(T.isExternal||o),D=y.createElement("a",{...w,...Q,href:(R?z:void 0)||T.absoluteURL||L,onClick:R?B:t,ref:zj(x,Z),target:p,"data-discover":!F&&n==="render"?"true":void 0});return U&&!F?y.createElement(y.Fragment,null,D,y.createElement(Ij,{page:L})):D});rh.displayName="Link";var Uj=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:u,viewTransition:d,children:f,...p},m){let _=xh(u,{relative:p.relative}),b=_s(),S=y.useContext(Mp),{navigator:w,basename:x}=y.useContext(gs),k=S!=null&&Zj(_)&&d===!0,O=w.encodeLocation?w.encodeLocation(_).pathname:_.pathname,P=b.pathname,F=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(P=P.toLowerCase(),F=F?F.toLowerCase():null,O=O.toLowerCase()),F&&x&&(F=Jr(F,x)||F);const T=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let L=P===O||!r&&P.startsWith(O)&&P.charAt(T)==="/",M=F!=null&&(F===O||!r&&F.startsWith(O)&&F.charAt(O.length)==="/"),z={isActive:L,isPending:M,isTransitioning:k},U=L?t:void 0,Z;typeof i=="function"?Z=i(z):Z=[i,L?"active":null,M?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let Q=typeof o=="function"?o(z):o;return y.createElement(rh,{...p,"aria-current":U,className:Z,ref:m,style:Q,to:u,viewTransition:d},typeof f=="function"?f(z):f)});Uj.displayName="NavLink";var Wj=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:u=xf,action:d,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:_,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=y.useContext(gs),k=Yj(),O=Xj(d,{relative:p}),P=u.toLowerCase()==="get"?"get":"post",F=typeof d=="string"&&K5.test(d),T=L=>{if(f&&f(L),L.defaultPrevented)return;L.preventDefault();let M=L.nativeEvent.submitter,z=M?.getAttribute("formmethod")||u,U=()=>k(M||L.currentTarget,{fetcherKey:t,method:z,navigate:n,replace:r,state:o,relative:p,preventScrollReset:m,viewTransition:_,defaultShouldRevalidate:b});x&&n!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:w,method:P,action:O,onSubmit:i?f:T,...S,"data-discover":!F&&e==="render"?"true":void 0})});Wj.displayName="Form";function qj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function V5(e){let t=y.useContext(dc);return Sn(t,qj(e)),t}function Gj(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:p}={}){let m=pc(),_=_s(),b=xh(e,{relative:u});return y.useCallback(S=>{if(xj(S,t)){S.preventDefault();let w=n!==void 0?n:sh(_)===sh(b),x=()=>m(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:f});p?y.startTransition(()=>x()):x()}},[_,m,b,n,i,r,t,e,o,u,d,f,p])}var Kj=0,Vj=()=>`__${String(++Kj)}__`;function Yj(){let{router:e}=V5("useSubmit"),{basename:t}=y.useContext(gs),n=fj(),i=e.fetch,r=e.navigate;return y.useCallback(async(o,u={})=>{let{action:d,method:f,encType:p,formData:m,body:_}=Ej(o,t);if(u.navigate===!1){let b=u.fetcherKey||Vj();await i(b,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:_,formMethod:u.method||f,formEncType:u.encType||p,flushSync:u.flushSync})}else await r(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:_,formMethod:u.method||f,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,r,t,n])}function Xj(e,{relative:t}={}){let{basename:n}=y.useContext(gs),i=y.useContext(br);Sn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...xh(e||".",{relative:t})},u=_s();if(e==null){o.search=u.search;let d=new URLSearchParams(o.search),f=d.getAll("index");if(f.some(m=>m==="")){d.delete("index"),f.filter(_=>_).forEach(_=>d.append("index",_));let m=d.toString();o.search=m?`?${m}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Ks([n,o.pathname])),sh(o)}function Zj(e,{relative:t}={}){let n=y.useContext(P5);Sn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=V5("useViewTransitionState"),r=xh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Jr(n.currentLocation.pathname,i)||n.currentLocation.pathname,u=Jr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Vf(r.pathname,u)!=null||Vf(r.pathname,o)!=null}var Ya=N5();const Jj=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let un=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function xC(e){return(await Y5(e)).theaters}async function Y5(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 un(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>t0(i,t.status))}}async function Qj(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await di(i),uO(await i.json(),i.status)}async function eO(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await di(t),hO(await t.json(),t.status)}async function tO(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),fO(await i.json(),i.status)}async function nO(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await di(t),dO(await t.json(),t.status)}async function X5(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 t0(i,n.status)}async function iO(e,t,n){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:t}),signal:n});return await di(i),t0(await i.json(),i.status)}async function sO(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),vO(await n.json(),n.status)}async function Z5(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 un(n.status,"Invalid folder grant response");return i.folderGrantId}async function rO(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 aO(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 oO(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function Ji(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 un(i.status,"Invalid operations response");return r.operations.map(o=>Q5(o,i.status))}async function xo(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 un(i.status,"Invalid groups response");return r.groups.map(o=>e0(o,i.status))}async function lO(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 e0(i.group,n.status)}async function g_(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 e0(r.group,i.status)}async function cO(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function J5(e,t,n){return kf(e,{title:t},n)}async function kf(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 Q5(r.operation,i.status)}function Q5(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"||ah(n)||ah(n.payload))throw new un(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 e0(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 un(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function t0(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"||ah(n))throw new un(t,"Invalid Theater response");return{id:n.id,label:n.label,createdAt:n.createdAt,lastOpenedAt:n.lastOpenedAt,...typeof n.order=="number"&&Number.isInteger(n.order)&&n.order>=0?{order:n.order}:{},hasWiki:n.hasWiki,activeAdmiralCount:n.activeAdmiralCount}}function uO(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 un(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 hO(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 un(t,"Invalid environment response");return n}function dO(e,t){const n=e;if(!n||n.status!=="accepted")throw new un(t,"Invalid update response");return{status:"accepted"}}function fO(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 un(t,"Invalid release notes response");return{notes:n.notes.map(i=>pO(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function pO(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 un(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>mO(i,t)),localizationFallback:n.localizationFallback}}function mO(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 un(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>gO(i,t))}}function gO(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&&!_O(n.product))throw new un(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 _O(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function vO(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)||ah(n))throw new un(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=>yO(i,t)),truncated:n.truncated===!0?!0:void 0}}function yO(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||ah(n))throw new un(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function ah(e){if(!e||typeof e!="object")return!1;const t=e;return Jj.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 un(e.status,t)}const bO="fleet-console.canvas.",eT="fleet-console.formation-layout",SO=400,Uv=640,Wv=400,CC=40,wO=320,xO=200,CO=8,kO=0,kC=96,EO=.25,TO=1,__=.2,EC=.5,AO=.001,Hl={x:0,y:0,zoom:1},Vl={viewport:Hl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},qv=new Set,Gv=new Set,Kv=new Set,Vv=new Set,Yv=new Set,Xs=new Map,ic=new Map;let $t=null,Ua=null,st=Vl,on=null,tT=0,Lo={},Qi=!1,n0=ZO(),za=Hl,Mo=null,Xf=0;function i0(e){return qv.add(e),()=>{qv.delete(e)}}function hr(){return st}function RO(e){return $t===e?st:l0(e)}function Vs(){return on?.mode==="maximized"?on.operationId:null}function ps(){return on?.mode==="companion"?on.operationId:null}function TC(){return tT}function NO(e){const t=$t===e?on:Xs.get(e)??null;return t?.mode==="companion"?t.operationId:null}function Zf(){return Qi}function AC(){return n0}function nT(){return $t}function s0(){return y.useSyncExternalStore(i0,hr,hr)}function iT(){return y.useSyncExternalStore(fT,Vs,Vs)}function sT(){return y.useSyncExternalStore(fT,ps,ps)}function LO(e){const t=y.useSyncExternalStore(qO,NC,NC);return e===null?{}:t[e]??{}}function MO(e,t,n){const i=Lo[e]??{};i[t]!==n&&(Lo={...Lo,[e]:{...i,[t]:n}},pT())}function Op(){return y.useSyncExternalStore(UO,Zf,Zf)}function rT(){return y.useSyncExternalStore(WO,AC,AC)}function aT(){return y.useSyncExternalStore(i0,LC,LC)}function ts(e){st={viewport:e.viewport??st.viewport,operations:e.operations??st.operations,operationOrder:e.operationOrder??st.operationOrder,operationAccent:e.operationAccent??st.operationAccent,minimized:e.minimized??st.minimized,collapsedGroups:e.collapsedGroups??st.collapsedGroups},VO(),a0()}function oT(e){const t=st.collapsedGroups.includes(e)?st.collapsedGroups.filter(n=>n!==e):[...st.collapsedGroups,e];ts({collapsedGroups:t})}function jO(e,t){if($t===e){oT(t);return}const n=l0(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];c0(e,{...n,collapsedGroups:i}),st={...st},a0()}function OO(){return y.useSyncExternalStore(i0,MC,MC)}function Xv(e){o0();const t=u0(e);za=t,ts({viewport:t})}function lT(e){const t=u0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||Ip()){Xv(t);return}za=t,Mo===null&&(Mo=window.requestAnimationFrame(_T))}function Zv(e,t){const n=Po();ts({operations:{...st.operations,[e]:{...h0(t,n),zIndex:n}}})}function DO(e,t,n=wO,i=xO,r=CO,o=kO,u="grid"){if(!Number.isFinite(t)||t<=0)return[];const d=Math.max(0,e.width-o*2),f=Math.max(0,e.height-o*2);if(u==="columns"){const x=Math.max(0,d-r*(t-1)),k=x/t,O=Math.min(n,k),P=Math.min(Math.max(O,k),x),F=f,T=Math.min(i,F),L=Math.min(Math.max(T,F),f);return Array.from({length:t},(M,z)=>({x:e.x+o+z*(P+r),y:e.y+o,width:P,height:L}))}if(u==="rows"){const x=d,k=Math.min(n,x),O=Math.min(Math.max(k,x),d),P=Math.max(0,f-r*(t-1)),F=P/t,T=Math.min(i,F),L=Math.min(Math.max(T,F),P);return Array.from({length:t},(M,z)=>({x:e.x+o,y:e.y+o+z*(L+r),width:O,height:L}))}const p=Math.ceil(Math.sqrt(t)),m=Math.ceil(t/p),_=Math.max(0,f-r*(m-1)),b=_/m,S=Math.min(i,b),w=Math.min(Math.max(S,b),_);return Array.from({length:t},(x,k)=>{const O=Math.floor(k/p),P=k%p,F=O===m-1?t-(m-1)*p:p,T=Math.max(0,d-r*(F-1)),L=T/F,M=Math.min(n,L),z=Math.min(Math.max(M,L),T);return{x:e.x+o+P*(z+r),y:e.y+o+O*(w+r),width:z,height:w}})}function cT(e){st.minimized.includes(e)||(Vs()===e&&Ga(),ps()===e&&Zs(),ts({minimized:[...st.minimized,e]}))}function IO(e){const t=new Set,i=[...st.minimized.filter(u=>t.has(u)||!(u in st.operations)?!1:(t.add(u),!0)),...e.filter(u=>t.has(u)||!(u in st.operations)?!1:(t.add(u),!0))];if(gT(st.minimized,i))return;const r=Vs(),o=ps();r&&i.includes(r)&&Ga(),o&&i.includes(o)&&Zs(),ts({minimized:i})}function Jf(e){if(!st.minimized.includes(e))return;Vs()===e&&Ga();const t=st.minimized.filter(r=>r!==e),n=st.operations[e];if(!n){ts({minimized:t});return}const i=Po();ts({minimized:t,operations:{...st.operations,[e]:{...n,zIndex:i}}})}function v_(e){ts({operationOrder:yT(e)})}function Po(){return Xf+=1,Xf}function BO(e){const t=st.operations[e];if(t)return t;const n=Object.keys(st.operations).length,i={x:n*CC,y:n*CC,width:Uv,height:Wv,zIndex:Po()};return ts({operations:{...st.operations,[e]:i}}),i}function $O(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(st.operations))t.has(b)?n[b]=S:i=!0;const r=st.minimized.filter(b=>t.has(b)),o=r.length!==st.minimized.length,u=st.operationOrder.filter(b=>t.has(b)),d=u.length!==st.operationOrder.length,f=Object.fromEntries(Object.entries(st.operationAccent).filter(([b])=>t.has(b))),p=Object.keys(f).length!==Object.keys(st.operationAccent).length,m=Vs(),_=ps();m&&(!t.has(m)||r.includes(m))&&Ga(),_&&r.includes(_)&&Zs(),(i||o||d||p)&&ts({operations:n,minimized:r,operationOrder:u,operationAccent:f})}function PO(e){YO(),o0(),KO(),$t=e,st=e?l0(e):Vl;const t=e?Xs.get(e)??null:null,n=!mT(on,t);on=t;const i=e?ic.has(e):!1,r=Qi!==i;Qi=i,za=st.viewport,Xf=Math.max(Xf,bT(st.operations)),a0(),n&&Ch(),r&&sc()}function zO(e,t){const n=st.operations[e];if(!n)return;const i=Math.max(EO,Math.min(TO,Math.min((t.width-kC)/n.width,(t.height-kC)/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};o0(),za=r;const o=Po(),u=st.minimized.includes(e);ts({viewport:r,operations:{...st.operations,[e]:{...h0(n,o),zIndex:o}},...u?{minimized:st.minimized.filter(d=>d!==e)}:{}})}function r0(e){const t={mode:"maximized",operationId:e};$t&&Xs.set($t,t),hT(t)}function Ga(){$t&&Xs.get($t)?.mode==="maximized"&&Xs.delete($t),on?.mode==="maximized"&&(on=null,Ch())}function uT(e){Dp(e);const t=on?.mode==="companion"?on.returnTo:on?.mode==="maximized"?"maximized":"underlay";hT({mode:"companion",operationId:e,returnTo:t})}function hT(e){on?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===on.operationId)&&Dp(on.operationId);const t=st.minimized.filter(r=>r!==e.operationId),n=!gT(st.minimized,t),i=!mT(on,e);i&&(on=e),i&&$t&&Xs.set($t,e),n&&ts({minimized:t}),i&&Ch()}function HO(){if(on?.mode!=="companion")return;const e=on;on=e.returnTo==="maximized"&&e.operationId in st.operations&&!st.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,$t&&(on?Xs.set($t,on):Xs.delete($t)),Dp(e.operationId),Ch()}function Zs(){if(on?.mode!=="companion")return;const e=on.operationId;on=null,$t&&Xs.delete($t),Dp(e),Ch()}function FO(){if($t){if(ps()!==null){Zs(),Qi||(ic.set($t,!0),Qi=!0,sc());return}if(Qi){dT();return}Ga(),Zs(),ic.set($t,!0),Qi=!0,sc()}}function y_(e){if($t){if(ps()!==null){RC(e),Zs(),Qi||(ic.set($t,!0),Qi=!0,sc());return}if(Qi&&n0===e){dT();return}RC(e),Qi||(Ga(),Zs(),ic.set($t,!0),Qi=!0,sc())}}function dT(){$t&&ic.delete($t),Qi&&(Qi=!1,sc())}function RC(e){n0=e,JO(e),GO()}function UO(e){return Vv.add(e),()=>{Vv.delete(e)}}function WO(e){return Yv.add(e),()=>{Yv.delete(e)}}function a0(){for(const e of qv)e()}function fT(e){return Gv.add(e),()=>{Gv.delete(e)}}function qO(e){return Kv.add(e),()=>{Kv.delete(e)}}function NC(){return Lo}function pT(){for(const e of Kv)e()}function Dp(e){if(!(e in Lo))return;const t={...Lo};delete t[e],Lo=t,pT()}function sc(){for(const e of Vv)e()}function GO(){for(const e of Yv)e()}function LC(){return st.minimized}function MC(){return st.collapsedGroups}function Ch(){tT+=1;for(const e of Gv)e()}function KO(){$t&&(on?Xs.set($t,on):Xs.delete($t))}function mT(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function gT(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function _T(){const e=st.viewport,t=za.x-e.x,n=za.y-e.y,i=za.zoom-e.zoom;if(Math.abs(t)<EC&&Math.abs(n)<EC&&Math.abs(i)<AO){Mo=null,ts({viewport:za});return}ts({viewport:{x:e.x+t*__,y:e.y+n*__,zoom:e.zoom+i*__}}),Mo=typeof window<"u"?window.requestAnimationFrame(_T):null}function o0(){Mo===null||typeof window>"u"||(window.cancelAnimationFrame(Mo),Mo=null)}function Ip(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function VO(){!$t||typeof window>"u"||(XO(),Ua=window.setTimeout(()=>{Ua=null,c0($t,st)},SO))}function YO(){!Ua||!$t||typeof window>"u"||(window.clearTimeout(Ua),Ua=null,c0($t,st))}function XO(){!Ua||typeof window>"u"||(window.clearTimeout(Ua),Ua=null)}function l0(e){if(typeof window>"u")return Vl;try{const t=window.localStorage.getItem(vT(e));if(!t)return Vl;const n=JSON.parse(t);return QO(n)}catch{return Vl}}function c0(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(vT(e),JSON.stringify(t))}catch{}}function ZO(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(eT);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function JO(e){if(!(typeof window>"u"))try{window.localStorage.setItem(eT,e)}catch{}}function vT(e){return`${bO}${e}`}function QO(e){if(!rc(e))return Vl;const t=nD(e.operations);return{viewport:u0(e.viewport),operations:t,operationOrder:yT(e.operationOrder),operationAccent:eD(e.operationAccent),minimized:tD(e.minimized,t),collapsedGroups:sD(e.collapsedGroups)}}function yT(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 eD(e){if(!rc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function tD(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 u0(e){if(!rc(e))return Hl;const t=Zu(e.x,Hl.x),n=Zu(e.y,Hl.y),i=Jv(e.zoom,Hl.zoom);return{x:t,y:n,zoom:i}}function nD(e){if(!rc(e))return{};const t={};for(const[n,i]of Object.entries(e))rc(i)&&(t[n]=h0(i,iD(t)));return t}function h0(e,t){return rc(e)?{x:Zu(e.x,0),y:Zu(e.y,0),width:Jv(e.width,Uv),height:Jv(e.height,Wv),zIndex:Zu(e.zIndex,t)}:{x:0,y:0,width:Uv,height:Wv,zIndex:t}}function iD(e){return bT(e)+1}function bT(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Zu(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Jv(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function rc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sD(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}const rD="__unassigned__";function aD(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(cD(i,t.get(i.theaterId)));return n}function oD(e,t){const n=d0(t);return n.length===0?e:e.filter(i=>{const r=uD(i);return n.every(o=>r.includes(o))})}function lD(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??rD,o=n.get(r);if(o!==void 0){const u=t[o];u&&(t[o]={...u,entries:[...u.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function d0(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function cD(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function uD(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const hD=200,dD=.5,fD="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",pD=["monospace","serif","sans-serif"],Bu=new Map;function mD(e,t={}){const n=Bp(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 u=o.createElement("canvas").getContext("2d");if(!u)return!1;const d=pD.some(f=>{const p=jC(u,`${ST(n)}, ${f}`),m=jC(u,f);return Math.abs(p-m)>dD});return gD(i,d,t.maxEntries??hD),d}function ST(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Qf(e,t){const n=Bp(e);return n?`${ST(n)}, ${t}`:t}function Bp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function jC(e,t){return e.font=`28px ${t}`,e.measureText(fD).width}function gD(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 Yl={min:12,max:18,step:1,defaultValue:14},Ju={source:"builtin",id:"manrope",size:Yl.defaultValue},ep=[{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 _D(e){if(!e||typeof e!="object")return Ju;const t=e,n=vD(t.size);if(t.source==="builtin"&&bD(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Bp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Ju}function vD(e){return typeof e!="number"||!Number.isInteger(e)||e<Yl.min||e>Yl.max?Yl.defaultValue:e}function wT(e){return e.source==="system"?Qf(e.familyName,ep[0].family):yD(e.id).family}function yD(e){return ep.find(t=>t.id===e)??ep[0]}function bD(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const Qv="fleet-console.activeTheaterId",xT="fleet-console.commissioningSeen",CT="fleet-console.whatsNewSeenVersion",kT="fleet-console.notificationPreferences",ET=1,SD="instrument",Ud={globalMute:!1,dnd:!1,mutedTheaterIds:{}},ey=new Set;let OC=0,ty=null,Ze={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:SD,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,keyboardFocusRequest:null,pendingSideBarAddTheater:!1,pendingSideBarTheaterLaunch:null,launchMenuRequest:null,keyboardShortcutsOpen:!1,operationNotifications:{},notificationPreferences:nI(),codexReader:null,codexReaderExpanded:!1};function zo(){return Ze}function TT(e){return ey.add(e),()=>{ey.delete(e)}}function lt(e){Ze={...Ze,...e},JD()}function wD(e){Ze.operationsViewActive!==e&<({operationsViewActive:e})}function ac(e){TD(e),lt({activeTheme:e})}function ny(e){RD(e)}function xD(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,...DT({...Ze,version:e.version})})}function CD(){lt({releaseNotesLoading:!0,releaseNotesError:null})}function kD(e){const t={...Ze,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Ze.selectedReleaseNoteKey&&BT(e.notes,Ze.selectedReleaseNoteKey)?Ze.selectedReleaseNoteKey:IT(e.notes)};lt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...DT(t)})}function ED(e){lt({releaseNotesLoading:!1,releaseNotesError:e})}function TD(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function AD(){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 RD(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",wT(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function iy(e){const t=OT(e,Ze.activeTheaterId);lt({theaters:e,activeTheaterId:t})}function ND(e){iy(e.theaters)}function fs(e){lt({operations:e,operationsHydrated:!0})}function LD(e){const t=new Set(e.map(i=>i.id)),n=Ze.operations.filter(i=>!t.has(i.id));lt({operations:[...e,...n],operationsHydrated:!0})}function MD(e){const t=Ze.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Ze.operations];n[t]=e,lt({operations:n})}function Co(e){lt({groups:e})}function f0(e){$p(e),lt({activeTheaterId:e})}function Di(e){Ze.activeOperationId!==e&<({activeOperationId:e})}function jD(e,t){if(t==="idle"){AT(e);return}Ze.operationStatus[e]!==t&<({operationStatus:{...Ze.operationStatus,[e]:t}})}function AT(e){if(!(e in Ze.operationStatus))return;const t={...Ze.operationStatus};delete t[e],lt({operationStatus:t})}function OD(e){if(!e.operationId)return;const t=Ze.operations.find(u=>u.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Ze.theaters.find(u=>u.id===n)?.label??n??"Unknown",r=t.title,o=eI(e.kind);OC+=1,lt({operationNotifications:{...Ze.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:OC}}})}function RT(){lt({addingTheater:!0,theaterError:null})}function NT(e){const t=[e,...Ze.theaters.filter(n=>n.id!==e.id)];$p(e.id),lt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function DD(){lt({addingTheater:!1,theaterError:null})}function sy(e){lt({addingTheater:!1,theaterError:e})}function oc(e){const t=Ze.operations.find(n=>n.id===e);t&&($p(t.theaterId),lt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:jT(Ze.operationNotifications,e)}))}function ID(){Ze.pendingOperationFocus!==null&<({pendingOperationFocus:null})}function BD(){lt({pendingSideBarAddTheater:!0})}function $D(){Ze.pendingSideBarAddTheater&<({pendingSideBarAddTheater:!1})}function PD(e){lt({pendingSideBarTheaterLaunch:e})}function DC(){Ze.pendingSideBarTheaterLaunch!==null&<({pendingSideBarTheaterLaunch:null})}function vo(e){lt({keyboardFocusRequest:{operationId:e,requestId:(Ze.keyboardFocusRequest?.requestId??0)+1}})}function zD(){lt({launchMenuRequest:{requestId:(Ze.launchMenuRequest?.requestId??0)+1}})}function HD(){Ze.launchMenuRequest!==null&<({launchMenuRequest:null})}function FD(){Ze.keyboardShortcutsOpen||lt({keyboardShortcutsOpen:!0})}function UD(){Ze.keyboardShortcutsOpen&<({keyboardShortcutsOpen:!1})}function WD(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 p0(e,t){if(t.length===0)return[...e].sort(ry);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),u=n.get(r.id);return o!==void 0&&u!==void 0?o-u:o!==void 0?-1:u!==void 0?1:ry(i,r)})}function m0(e,t,n,i=[]){const r=p0(e,n),o=new Set(i),u=[...t].sort((f,p)=>f.order-p.order||f.createdAt-p.createdAt),d=new Map;for(const f of u)d.set(f.id,[]);d.set(null,[]);for(const f of r){const p=f.groupId??null;p!==null&&d.has(p)?d.get(p).push(f):d.get(null).push(f)}return[...u.filter(f=>!o.has(f.id)).flatMap(f=>d.get(f.id)??[]),...d.get(null)??[]]}function qD(e,t,n,i,r){const o=new Set(r),u=m0(e,t,n,i),d=u.filter(f=>!o.has(f.id));return(d.length>0?d:u).map(f=>f.id)}function ry(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Wd(){lt({operationSearchOpen:!1})}function LT(){lt({operationSearchOpen:!Ze.operationSearchOpen})}function MT(){Ze.releaseNotes.length===0||Ze.whatsNewOpen||lt({whatsNewOpen:!0,selectedReleaseNoteKey:Ze.selectedReleaseNoteKey??IT(Ze.releaseNotes)})}function qd(){Ze.whatsNewOpen&&(Ze.automaticWhatsNewVersion&&aI(Ze.automaticWhatsNewVersion),lt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function IC(e){BT(Ze.releaseNotes,e)&<({selectedReleaseNoteKey:e})}function fu(){sI(!0),Ze.onboardingOpen&<({onboardingOpen:!1})}function ur(e){lt({codexReader:e,codexReaderExpanded:!1})}function Ef(){Ze.codexReader!==null&<({codexReaderExpanded:!0})}function GD(){lt({codexReaderExpanded:!1})}function b_(){lt({codexReader:null,codexReaderExpanded:!1})}function BC(){if(Ze.bootstrapped)return;const e=Ze.theaters.length===0&&!iI();lt({bootstrapped:!0,onboardingOpen:e?!0:Ze.onboardingOpen})}function $C(e){const t=Ze.theaters.filter(u=>u.id!==e),n=OT(t,Ze.activeTheaterId===e?null:Ze.activeTheaterId),i=QD(Ze.operationNotifications,e),r=new Set(Ze.operations.filter(u=>u.theaterId===e).map(u=>u.id)),o=Ze.activeOperationId&&r.has(Ze.activeOperationId)?null:Ze.activeOperationId;$p(n),lt({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function KD(e){const t=jT(Ze.operationNotifications,e);t!==Ze.operationNotifications&<({operationNotifications:t})}function VD(e){const t={...Ze.notificationPreferences,globalMute:e};_0(t),lt({notificationPreferences:t})}function YD(e){const t={...Ze.notificationPreferences,dnd:e};_0(t),lt({notificationPreferences:t})}function XD(e){const t={...Ze.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Ze.notificationPreferences,mutedTheaterIds:t};_0(n),lt({notificationPreferences:n})}function ZD(e){return aD(e)}function JD(){for(const e of ey)e()}function jT(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function QD(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 OT(e,t){const n=new Set(e.map(r=>r.id)),i=tI();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function eI(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function DT(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||rI()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:g0(n.version,t)}}function IT(e){return e[0]?g0(e[0].version,0):null}function BT(e,t){return e.some((n,i)=>g0(n.version,i)===t)}function g0(e,t){return`${e}:${t}`}function tI(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Qv)}catch{return null}}function $p(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Qv,e):window.localStorage.removeItem(Qv)}catch{}}function nI(){if(typeof window>"u")return Ud;try{const e=window.localStorage.getItem(kT);if(!e)return Ud;const t=JSON.parse(e);return oI(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Ud}catch{return Ud}}function iI(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(xT)==="1"}catch{return!1}}function sI(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(xT,"1")}catch{}}function rI(){if(ty!==null)return ty;if(typeof window>"u")return null;try{return window.localStorage.getItem(CT)}catch{return null}}function aI(e){if(ty=e,!(typeof window>"u"))try{window.localStorage.setItem(CT,e)}catch{}}function _0(e){if(!(typeof window>"u"))try{window.localStorage.setItem(kT,JSON.stringify({version:ET,preferences:e}))}catch{}}function oI(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==ET||!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 PC(e,t){return e!==null&&e===t?e:null}function lI(e,t,n,i){return m0(e.filter(r=>r.theaterId===n),t.filter(r=>r.theaterId===n),i)}function cI(e,t,n){if(t===null||n===null)return null;const i=e.find(r=>r.id===t)??null;return i!==null&&i.theaterId===n?i:null}function uI(e,t){return!(t instanceof Node&&e.contains(t))}function hI(e,t,n,i,r=12){const o=i-r-n-t,u=r-t;return Math.max(u,Math.min(e,o))}const dI=288,fI=520,pu=12;function $T({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:u,onClose:d}){const f=y.useRef(null),p=y.useRef(null);return y.useEffect(()=>{const m=b=>{f.current?.contains(b.target)||d()},_=b=>{b.key==="Escape"&&d()};return document.addEventListener("mousedown",m),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",_)}},[d]),y.useEffect(()=>{p.current?.focus()},[]),c.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:f,style:mI(e,t,n),"data-canvas-blocker":!0,children:c.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:p,children:[c.jsxs("div",{className:"canvas-context-menu-head",children:[c.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:c.jsx(pI,{})}),c.jsx("span",{className:"canvas-context-menu-head-text",children:c.jsx("strong",{children:"Canvas controls"})})]}),c.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((m,_)=>c.jsxs("div",{children:[_>0?c.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,c.jsx("p",{className:"canvas-context-menu-plugin",children:m.title}),m.kinds.map(b=>{const S=b.disabled===!0||!r;return c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>u(m.id,b),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(m.id,b)??c.jsx(gI,{})}),c.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?c.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${m.id}:${b.id}`)})]},m.id)):c.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function pI(){return c.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),c.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"}),c.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function mI(e,t,n){const i=t?Math.max(pu,Math.min(e.x,t.width-dI-pu)):e.x;if(n==="above")return{left:i,bottom:Math.max(pu,e.y)};const r=t?Math.max(pu,Math.min(e.y,t.height-fI-pu)):e.y;return{left:i,top:r}}function gI(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function PT(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const Gd="directory-browser-sectors";function zT({open:e,onCancel:t,onConfirm:n}){const[i,r]=y.useState(null),[o,u]=y.useState(null),[d,f]=y.useState(null),[p,m]=y.useState(""),[_,b]=y.useState(""),[S,w]=y.useState(0),x=y.useRef(null),k=y.useRef(null),O=async(N,E)=>{u(N),f(null),m(""),w(0);try{const $=await sO(N,E);r($)}catch($){if($ instanceof DOMException&&$.name==="AbortError")return;f($ instanceof un?$.message:String($))}finally{u(null)}};y.useEffect(()=>{if(!e)return;const N=new AbortController;return O(null,N.signal),()=>N.abort()},[e]),y.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const P=i?.entries??[],F=y.useMemo(()=>{const N=p.trim().toLowerCase();return N===""?P:P.filter(E=>E.name.toLowerCase().includes(N))},[P,p]),T=y.useMemo(()=>i?_I(i):[],[i]),L=i?zC(i.path):null,M=i?.roots??[],z=M.length>1,U=F.length===0?-1:Math.min(S,F.length-1);if(y.useEffect(()=>{if(U<0)return;k.current?.querySelector(`[data-index="${U}"]`)?.scrollIntoView({block:"nearest"})},[U,i?.path]),!e)return null;const Z=N=>{N.accessible&&o===null&&O(N.path)},Q=()=>{i?.parentPath!=null&&o===null&&O(i.parentPath)},G=()=>{const N=_.trim();N!==""&&o===null&&O(N)},B=i?.path??null,R=U>=0?`${Gd}-${U}`:void 0,D=N=>{switch(N.key){case"Escape":p!==""?m(""):t();return;case"ArrowDown":N.preventDefault(),w(E=>Math.min(E+1,Math.max(F.length-1,0)));return;case"ArrowUp":N.preventDefault(),w(E=>Math.max(E-1,0));return;case"Enter":{N.preventDefault();const E=F[U];E&&Z(E);return}case"Backspace":p===""&&(N.preventDefault(),Q());return;default:return}};return Ya.createPortal(c.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[c.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),c.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:D,children:[c.jsxs("header",{className:"directory-browser-header",children:[c.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:c.jsx(bI,{})}),c.jsxs("div",{className:"directory-browser-heading",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),c.jsx("h2",{children:"Add Theater"})]}),c.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),z?c.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),c.jsx("div",{className:"directory-browser-root-chips",children:M.map(N=>{const E=L!=null&&zC(N)===L;return c.jsx("button",{type:"button",className:`directory-browser-root-chip ${E?"is-active":""}`,"aria-current":E?"location":void 0,disabled:o!==null,title:N,onClick:()=>{o===null&&O(N)},onKeyDown:$=>$.stopPropagation(),children:yI(N)},N)})})]}):null,c.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:T.map((N,E)=>{const $=E===T.length-1;return c.jsxs("span",{className:"directory-browser-course-seg",children:[E>0?c.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,c.jsx("button",{type:"button",className:`directory-browser-crumb ${$?"is-current":""}`,"aria-current":$?"location":void 0,disabled:$||o!==null,title:N.path,onClick:()=>{O(N.path)},children:N.label})]},N.path)})}),c.jsxs("div",{className:"directory-browser-toolbar",children:[c.jsxs("div",{className:"directory-browser-filter",children:[c.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:c.jsx(wI,{})}),c.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":Gd,value:p,spellCheck:!1,autoComplete:"off",onChange:N=>{m(N.target.value),w(0)}})]}),c.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:Q,children:[c.jsx(xI,{}),c.jsx("span",{children:"Up"})]})]}),c.jsxs("div",{className:"directory-browser-jump",children:[c.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:_,spellCheck:!1,autoComplete:"off",onChange:N=>b(N.target.value),onKeyDown:N=>{N.stopPropagation(),N.key==="Enter"&&(N.preventDefault(),G())}}),c.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:_.trim()===""||o!==null,onClick:G,onKeyDown:N=>N.stopPropagation(),children:"Go"})]}),d?c.jsx("p",{className:"directory-browser-error",role:"alert",children:d}):null,c.jsx("div",{className:"directory-browser-list",id:Gd,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":R,ref:k,children:o!==null?c.jsxs("p",{className:"directory-browser-state is-live",children:[c.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):F.length===0?c.jsx("p",{className:"directory-browser-state",children:p!==""?"No folders match the filter.":"No folders available."}):F.map((N,E)=>c.jsxs("div",{id:`${Gd}-${E}`,"data-index":E,role:"option","aria-selected":E===U,"aria-disabled":!N.accessible,className:`directory-browser-sector ${E===U?"is-active":""} ${N.accessible?"":"is-locked"}`,title:N.path,onClick:()=>{w(E),Z(N)},children:[c.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:c.jsx(SI,{})}),c.jsx("span",{className:"directory-browser-sector-name",children:N.name}),N.accessible?c.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):c.jsxs("span",{className:"directory-browser-sector-lock",children:[c.jsx(CI,{})," Locked"]})]},N.path))}),i?.truncated?c.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,c.jsxs("footer",{className:"directory-browser-actions",children:[c.jsxs("div",{className:"directory-browser-target",children:[c.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),c.jsx("span",{className:"directory-browser-target-path",title:B??"",children:B??"Loading…"})]}),c.jsxs("div",{className:"directory-browser-buttons",children:[c.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),c.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:B===null||o!==null,onClick:()=>B&&n(B),children:"Add Theater"})]})]})]})]}),document.body)}function _I(e){if(vI(e)==="/"){const u=[{label:"/",path:"/"}];let d="";for(const f of e.path.split("/").filter(Boolean))d+=`/${f}`,u.push({label:f,path:d});return u}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 u of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${u}`,r.push({label:u,path:o});return r}function vI(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function zC(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function yI(e){return e.replace(/[\\/]+$/,"")||e}function bI(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),c.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 SI(){return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.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 wI(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function xI(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 CI(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.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"})]})}function Qs(){return y.useSyncExternalStore(TT,zo,zo)}const v0=[{key:"crimson",label:"Crimson",color:"var(--id-crimson)"},{key:"amber",label:"Amber",color:"var(--id-amber)"},{key:"moss",label:"Moss",color:"var(--id-moss)"},{key:"teal",label:"Teal",color:"var(--id-teal)"},{key:"cerulean",label:"Cerulean",color:"var(--id-cerulean)"},{key:"indigo",label:"Indigo",color:"var(--id-indigo)"},{key:"plum",label:"Plum",color:"var(--id-plum)"},{key:"rose",label:"Rose",color:"var(--id-rose)"}],kI={red:"crimson",orange:"amber",yellow:"amber",lime:"moss",green:"moss",emerald:"teal",cyan:"teal",sky:"cerulean",blue:"cerulean",violet:"plum",purple:"plum",magenta:"rose"};function HT(e){return typeof e!="string"||e.length===0?null:v0.some(t=>t.key===e)?e:kI[e]??null}function Ka(e){const t=HT(e);return t?v0.find(n=>n.key===t)?.color??null:null}function ay(e){return typeof e.accent=="string"?e.accent:null}const HC=8,EI=268;function y0({accentKey:e,includeNone:t,onSelect:n}){const i=HT(e);return c.jsxs(c.Fragment,{children:[t?c.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>n(null),children:[c.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:"None"})]}):null,v0.map(r=>c.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","aria-label":r.label,"aria-pressed":i===r.key,onClick:()=>n(r.key),children:[c.jsx("span",{className:"accent-tone-flag",style:{background:r.color},"aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:r.label})]},r.key))]})}function TI({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)),f=e.bottom+HC,p=f+EI>window.innerHeight;o(p?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+HC)}:{position:"fixed",left:d,top:Math.round(f)})},[e]),y.useEffect(()=>{const d=f=>{f.key==="Escape"&&(f.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 u=d=>{n(d),i()};return Ya.createPortal(c.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:r?c.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:d=>d.stopPropagation(),children:c.jsx(y0,{accentKey:t,includeNone:!0,onSelect:u})}):null}),document.body)}const FC=8,AI=320;function UC(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)),u=t.bottom+FC,d=u+AI>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+FC)}:{position:"fixed",left:o,top:Math.round(u)})},[t]),y.useEffect(()=>{const o=u=>{u.key==="Escape"&&(u.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]),Ya.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?c.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"?c.jsx(RI,{...e}):c.jsx(NI,{...e})}):null}),document.body)}function RI({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,u]=y.useState(!1),[d,f]=y.useState(`Group ${t.length+1}`),p=y.useRef(!1),m=y.useRef(null);y.useEffect(()=>{o&&m.current?.select()},[o]);const _=()=>{const b=d.trim();b&&(i.onCreateGroup(b),r())};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=Ka(b.color),w=e.groupId===b.id;return c.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:[c.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),c.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?c.jsx(LI,{}):null]},b.id)}),o?c.jsx("input",{ref:m,className:"group-context-menu-new-input",type:"text",value:d,onChange:b=>f(b.target.value),onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:b=>{b.key==="Enter"&&!p.current&&(b.preventDefault(),_()),b.key==="Escape"&&(b.preventDefault(),u(!1))},onBlur:()=>u(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>u(!0),children:c.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),c.jsx(y0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function NI({group:e,actions:t,onClose:n}){const[i,r]=y.useState(e.name),[o,u]=y.useState(!1),d=y.useRef(!1),f=()=>{const p=i.trim();if(!p||p===e.name){n();return}t.onRename(p),n()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),c.jsx(y0,{accentKey:e.color,includeNone:!1,onSelect:p=>{p&&t.onSetColor(p),n()}}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),c.jsx("input",{className:"group-context-menu-new-input",type:"text",value:i,onChange:p=>r(p.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:p=>{p.key==="Enter"&&!d.current&&(p.preventDefault(),f()),p.key==="Escape"&&(p.preventDefault(),n())},onBlur:f,"aria-label":"Group name"}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){u(!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 LI(){return c.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:c.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const MI=[{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"}]}],$u="data-keyboard-shortcuts-open",jI='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function FT(){return document.body.getAttribute($u)==="true"}function OI(){return!FT()}function UT({onClose:e}){const t=y.useRef(null);y.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute($u);return document.body.setAttribute($u,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute($u):document.body.setAttribute($u,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(jI)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],u=r[r.length-1],d=document.activeElement;(d===t.current||!t.current?.contains(d)||(i.shiftKey?d===o:d===u))&&(i.preventDefault(),(i.shiftKey?u:o)?.focus())};return Ya.createPortal(c.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:c.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:[c.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[c.jsx("strong",{children:"Keyboard Shortcuts"}),c.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),MI.map(i=>c.jsxs("section",{className:"keyboard-shortcuts-group",children:[c.jsx("h3",{children:i.title}),c.jsx("dl",{children:i.entries.map(r=>c.jsxs("div",{children:[c.jsx("dt",{children:r.combos.map((o,u)=>c.jsxs("span",{children:[u>0?" or ":null,o.map(d=>c.jsx("kbd",{children:d==="Mod"?"⌘/Ctrl":d},d))]},o.join("+")))}),c.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const DI=1400,II="https://github.com/sbluemin/fleet-harness",BI="https://github.com/sbluemin/fleet-harness/stargazers",$I="https://api.github.com/repos/sbluemin/fleet-harness",b0="fleet-console.github-stars",PI=360*60*1e3,WC='[role="menuitem"]:not([disabled])';function zI(){const e=Qs();return c.jsxs("div",{className:"side-bar-brand-foot",children:[c.jsx(FI,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),c.jsx(UI,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function HI({className:e="brand-foot-home"}){return c.jsxs(rh,{className:e,to:"/operations","aria-label":"Operations",children:[c.jsx(e8,{}),c.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function FI({latestVersion:e,updateAvailable:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,u]=y.useState(!1),d=pc();WT(n,i,r,o,u);const f=p=>{u(!1),d(p),window.requestAnimationFrame(()=>{const m=document.querySelector("main h2, h2");m?.focus?.(),m&&document.activeElement!==m&&(m.setAttribute("tabindex","-1"),m.focus())})};return c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[c.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>u(p=>!p),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[c.jsx(qC,{}),c.jsx("span",{children:"System Menu"})]}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>f("/settings"),children:[c.jsx(qC,{}),c.jsx("span",{children:"Settings"})]}),t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(WI,{latestVersion:e})]}):null]}):null]})}function UI({releaseDisabled:e,version:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,u]=y.useState(!1),[d,f]=y.useState(!1);return WT(n,i,r,o,u),c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[c.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>u(p=>!p),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:c.jsx(t8,{})}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[c.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{u(!1),MT()},children:[c.jsx(n8,{}),c.jsx("span",{children:"What's New"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),f(!0)},children:[c.jsx(i8,{}),c.jsx("span",{children:"Keyboard Shortcuts"})]}),c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(qI,{menuItem:!0,version:t})]}):null,d?c.jsx(UT,{onClose:()=>{f(!1),i.current?.focus()}}):null]})}function WT(e,t,n,i,r){y.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(WC)?.focus()}),u=f=>{f.target instanceof Node&&e.current?.contains(f.target)||r(!1)},d=f=>{if(f.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;const p=[...n.current?.querySelectorAll(WC)??[]];if(p.length===0)return;f.preventDefault();const m=p.findIndex(b=>b===document.activeElement),_=f.key==="Home"||f.key==="ArrowDown"&&m===p.length-1?0:f.key==="End"||f.key==="ArrowUp"&&m<=0?p.length-1:f.key==="ArrowDown"?m+1:m-1;p[_]?.focus()};return window.addEventListener("pointerdown",u,!0),window.addEventListener("keydown",d,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("keydown",d,!0)}},[n,i,e,r,t])}function WI({latestVersion:e}){const[t,n]=y.useState("idle"),[i,r]=y.useState(null),o=y.useRef(null),u=GI(t,i,e);y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const d=async()=>{if(!u.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await nO()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},DI)}catch(f){const p=f instanceof un?f.message:"network_error";r(p),n(VI(p)?"blocked":"error")}}};return c.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${u.tone}`,onClick:d,disabled:u.disabled,title:u.title,"aria-live":"polite",children:u.label})}function qI({menuItem:e=!1,version:t}){const n=YI(),i=n.count!==null;return c.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[c.jsx("a",{className:"brand-foot-github-link",href:II,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:c.jsx(s8,{})}),c.jsxs("a",{className:"brand-foot-github-stars",href:BI,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:[c.jsx(r8,{}),i?c.jsx("span",{className:"brand-foot-github-stars-count",children:QI(n.count)}):null]}),c.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function GI(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"?KI(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 KI(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 VI(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function YI(){const[e,t]=y.useState(()=>{const n=XI();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return y.useEffect(()=>{if(ZI())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch($I,{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}JI(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function XI(){try{const e=window.localStorage.getItem(b0);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function ZI(){try{const e=window.localStorage.getItem(b0);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<PI}catch{return!1}}function JI(e){try{window.localStorage.setItem(b0,JSON.stringify({count:e,at:Date.now()}))}catch{}}function QI(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function e8(){return c.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),c.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),c.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),c.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),c.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),c.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function qC(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function t8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.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"}),c.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function n8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function i8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function s8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 r8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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"})})}function a8(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const u=o.groupId??"__ungrouped__",d=n.querySelector(`[data-drop-zone-group-id="${u}"]`);if(!d)continue;const f=d.getBoundingClientRect();if(e<f.top||e>f.bottom)continue;const p=d.querySelector(`[data-group-section-id="${u}"]`);if(!p||e<p.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const m=Array.from(p.querySelectorAll("[data-side-bar-chip-id]"));for(const _ of m){const b=_.dataset.sideBarChipId;if(!b||b===i)continue;const S=_.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function o8(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 u=o.dataset.dropZoneGroupId;if(!u||u==="__ungrouped__"||u===i)continue;const d=t.indexOf(u);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function l8(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of r){const u=o.dataset.theaterId;if(!u||u===i)continue;const d=t.indexOf(u);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function c8(e,t,n,i){const r=e.filter(m=>m!==t),o=new Set(i),u=r.filter(m=>o.has(m)),d=Math.max(0,Math.min(n,u.length));if(u.length===0)return[...r,t];if(d<u.length){const m=r.indexOf(u[d]),_=[...r];return _.splice(m,0,t),_}const f=r.indexOf(u[u.length-1]),p=[...r];return p.splice(f+1,0,t),p}function u8(e,t,n,i){const r=new Set(i),o=e.filter(_=>r.has(_)),u=o.indexOf(t),d=o.filter(_=>_!==t),f=n>u?n-1:n,p=Math.max(0,Math.min(f,d.length));d.splice(p,0,t);let m=0;return e.map(_=>r.has(_)?d[m++]??_:_)}function h8(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 d8(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,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function f8(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,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function p8(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(u=>u!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function Pp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function m8(e){const t=Pp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function S0(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=y.useRef(null),o=y.useRef(!1),u=y.useRef(!1),[d,f]=y.useState(!1),[p,m]=y.useState("");y.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const _=()=>{i?.(),u.current=!1,m(t),f(!0)},b=()=>{u.current=!0,f(!1),m("")},S=()=>{if(!o.current){o.current=!0;try{n(p)}finally{o.current=!1,u.current=!0,f(!1)}}};return{renaming:d,draftTitle:p,inputRef:r,begin:_,cancel:b,commit:S,setDraftTitle:m,handleKeyDown:k=>{if(k.key==="Enter"){k.preventDefault(),S();return}k.key==="Escape"&&(k.preventDefault(),b())},handleBlur:()=>{if(u.current){u.current=!1;return}S()}}}function qT({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:u,preview:d=!1,onArmClose:f,onDisarmClose:p,onClose:m,onMinimize:_,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:k}){const O=y.useRef(!1),{operation:P,active:F,minimized:T,notificationCount:L,status:M}=e,z=g8(P),U=S0({currentTitle:z,onCommit:E=>k(P.id,E),onBegin:p}),Z=["side-bar-chip",F?"side-bar-chip--active":"",T?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",u?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),Q=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),G={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},B=()=>{if(p(),O.current){O.current=!1;return}b(P.id)},R=E=>{E.stopPropagation()},D=E=>{if(E.stopPropagation(),!n){f(P.id);return}p(),m(P.id)},N=E=>{E.preventDefault(),p(),x(P.id,E.currentTarget.getBoundingClientRect())};return c.jsxs("li",{"data-side-bar-chip-id":P.id,className:Z,role:"button",tabIndex:0,"aria-label":F?`${z} (focused)`:`Focus operation ${z}`,"aria-current":F?"true":void 0,title:d?"Click to open in its Theater":F?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:G,onClick:B,onContextMenu:d?void 0:N,onFocus:()=>{n||p()},onPointerDown:E=>w(E,P.id),onPointerUp:()=>{r&&(O.current=!0)},onKeyDown:E=>{if(E.target===E.currentTarget){if(!d&&E.altKey&&E.shiftKey&&(E.key==="ArrowUp"||E.key==="ArrowDown")){E.preventDefault(),S(P.id,E.key==="ArrowUp"?-1:1);return}(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),B())}},children:[c.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:c.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??c.jsx(b8,{})})}),U.renaming?c.jsx("input",{className:"side-bar-chip-rename-input",ref:U.inputRef,value:U.draftTitle,"aria-label":`Rename operation ${z}`,onChange:E=>U.setDraftTitle(E.target.value),onKeyDown:U.handleKeyDown,onBlur:U.handleBlur,onPointerDown:E=>E.stopPropagation(),onClick:E=>E.stopPropagation()}):c.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:U.begin,children:z}),L>0?c.jsx("span",{className:"side-bar-chip-count",children:L}):null,c.jsx("span",{className:`side-bar-chip-status ${_8(M)}`,role:"img","aria-label":GC(M),title:GC(M)}),!d&&!T?c.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:R,onClick:E=>{E.stopPropagation(),p(),_(P.id)},"aria-label":`Minimize operation ${z}`,title:"Minimize operation",children:c.jsx(y8,{})}):null,d?null:c.jsx("button",{type:"button",className:Q,onPointerDown:R,onClick:D,"aria-label":n?`Confirm close operation ${z}`:`Close operation ${z}`,title:n?"Confirm close":"Close operation",children:n?"Close?":c.jsx(v8,{})})]})}function g8(e){return e.title}function _8(e){const t=Pp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function GC(e){return m8(e)}function v8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 y8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function b8(){return c.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function GT({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:u,onContextMenu:d,onPointerDragStart:f}){const p=y.useRef(!1),m=Ka(e.color),_=["side-bar-group-header",n?"side-bar-group-header--collapsed":"",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={...m?{"--grp-color":m}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=k=>{k.preventDefault(),d(e.id,k.currentTarget.getBoundingClientRect())},w=k=>{k.target instanceof Element&&k.target.closest("button")||f(k,e.id)},x=()=>{i&&(p.current=!0)};return c.jsxs("div",{className:_,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:x,role:"group","aria-label":e.name,children:[c.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>u(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:c.jsx(S8,{collapsed:n})}),c.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-group-header__name",children:e.name}),c.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function S8({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:c.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const KT="fleet-console.operations.side-width",VT="fleet-console.operations.side-collapsed",YT="fleet-console.operations.theater-collapsed",zp=280,KC=zp,oy=new Set,ly=new Set;let jo={width:k8(),collapsed:E8()},Tf=T8();function XT(){return y.useSyncExternalStore(A8,tp,tp)}function w8(){return y.useSyncExternalStore(N8,VC,VC)}function x8(e){const t=Math.max(zp,Math.min(ZT(),e));if(jo.width!==t){jo={...jo,width:t};try{typeof window<"u"&&localStorage.setItem(KT,String(t))}catch{}JT()}}function Xl(e){if(jo.collapsed!==e){jo={...jo,collapsed:e};try{typeof window<"u"&&localStorage.setItem(VT,e?"1":"0")}catch{}JT()}}function C8(e,t){const n=new Set(Tf);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Tf.join("\0")){Tf=i;try{typeof window<"u"&&localStorage.setItem(YT,JSON.stringify(i))}catch{}R8()}}function ZT(){return typeof window<"u"?Math.max(zp,window.innerWidth-480):800}function k8(){try{if(typeof window>"u")return KC;const e=localStorage.getItem(KT);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(zp,Math.min(ZT(),t))}}catch{}return KC}function E8(){try{return typeof window<"u"&&localStorage.getItem(VT)==="1"}catch{return!1}}function T8(){try{if(typeof window>"u")return[];const e=localStorage.getItem(YT),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function JT(){for(const e of oy)e()}function tp(){return jo}function A8(e){return oy.add(e),()=>oy.delete(e)}function R8(){for(const e of ly)e()}function VC(){return Tf}function N8(e){return ly.add(e),()=>ly.delete(e)}function QT(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 L8=1500,M8=6,YC=34,XC=18;function j8({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:u,catalog:d,canLaunch:f,addingTheater:p,theaterError:m,renderKindIcon:_,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:x,onFocus:k,onSetAccent:O,onRename:P,onSetGroupId:F,onCreateGroup:T,onSetGroupColor:L,onRenameGroup:M,onReorderGroups:z,onReorderTheaters:U,onUngroupAll:Z,onSelectTheater:Q,onAddTheater:G,onCancelAddTheater:B,onForgetTheater:R}){const D=y.useRef(null),N=y.useRef(null),E=XT(),{width:$,collapsed:j}=E,q=y.useRef(j),H=s0(),A=rT(),Y=Op(),J=y.useRef(null),[he,de]=y.useState(null),[ae,we]=y.useState(null),je=y.useRef(null),De=y.useRef([]),We=y.useRef([]),ke=y.useRef([]),Le=y.useRef([]),Ae=y.useRef([]),Me=y.useRef(F),et=y.useRef(z),dt=y.useRef(U),[Je,oe]=y.useState(null),[qe,Ye]=y.useState(null),[Mt,Wt]=y.useState(!1),[hn,ct]=y.useState(!1),Yt=OO(),bt=w8(),{operationStatus:Se,pendingSideBarAddTheater:Qe,pendingSideBarTheaterLaunch:Ne,launchMenuRequest:Ce}=Qs();y.useLayoutEffect(()=>{!q.current&&j&&PT(D.current,".command-band-sidebar-toggle"),q.current=j},[j]);const ut=n.filter(le=>le.theaterId===t),dn=i.filter(le=>le.theaterId===t),jt=new Set(r),ne=new Set(Yt),ce=p0(ut,H.operationOrder).map(le=>{const at=QT(d,le),Xt=at?_(le.pluginId,at):null;return{operation:le,active:o===le.id,minimized:jt.has(le.id),notificationCount:u[le.id]?1:0,status:Se[le.id],icon:Xt}}),$e=eA(ce,dn,H.operationOrder),Oe=$e.some(le=>le.group!==null),Ge=$e.flatMap(le=>le.groupId?[le.groupId]:[]),Ht=$e.flatMap(le=>ne.has(le.groupId??"")?[]:le.entries),pi=ce.map(le=>le.operation.id),Ft=y.useCallback(()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},[]),On=y.useCallback(()=>{Ft(),de(null)},[Ft]),yn=y.useCallback(le=>{Ft(),de(le),J.current=window.setTimeout(()=>{J.current=null,de(null)},L8)},[Ft]);y.useEffect(()=>Ft,[Ft]),y.useEffect(()=>{he!==null&&(ce.some(le=>le.operation.id===he)||On())},[he,ce,On]),y.useEffect(()=>{if(!Ce)return;HD();const at=D.current?.querySelector('.side-bar-theater-section--active .side-bar-theater-row-btn[aria-label^="New Operation in"]')?.getBoundingClientRect();oe(null),Ye({anchor:at?{x:at.right+8,y:at.top}:{x:16,y:64},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},[Ce]);const K=Je?.kind==="chip"?ce.find(le=>le.operation.id===Je.operationId)?.operation??null:null,pe=Je?.kind==="group"?i.find(le=>le.id===Je.groupId)??null:null,be=Je?.kind==="theater"?e.find(le=>le.id===Je.theaterId)??null:null,Xe=(le,at)=>{const Xt=Ht.findIndex(Ee=>Ee.operation.id===le);if(Xt===-1)return;const xe=Math.max(0,Math.min(Ht.length-1,Xt+at));if(xe===Xt)return;const W=Ht.map(Ee=>Ee.operation.id),fe=p8(W,le,xe);v_(h8(pi,W,fe))},qt=$e.map(le=>({groupId:le.groupId,entryIds:le.entries.map(at=>at.operation.id)}));y.useEffect(()=>{De.current=ce,We.current=pi,ke.current=qt,Le.current=Ge,Ae.current=e.map(le=>le.id),Me.current=F,et.current=z,dt.current=U});const St=le=>{je.current=le,we(le)},Be=ae?.pointerId??null;y.useEffect(()=>{if(Be===null)return;const le=xe=>{if(xe.pointerId!==Be)return;const W=je.current;if(!W)return;if(xe.buttons===0){St(null);return}const fe=Math.hypot(xe.clientX-W.startX,xe.clientY-W.startY);if(!W.dragging&&fe<M8)return;if(W.dragging&&xe.preventDefault(),H8(xe.clientY,N.current),W.kind==="chip"){const ot=a8(xe.clientY,ke.current,N.current,W.sourceId);St({...W,currentY:xe.clientY,dragging:!0,dropIndex:ot.index,dropGroupId:ot.groupId});return}if(W.kind==="theater"){const ot=l8(xe.clientY,Ae.current,N.current,W.sourceTheaterId);St({...W,currentY:xe.clientY,dragging:!0,dropIndex:ot});return}const Ee=o8(xe.clientY,Le.current,N.current,W.sourceGroupId);St({...W,currentY:xe.clientY,dragging:!0,dropIndex:Ee})},at=xe=>{if(xe.pointerId!==Be)return;const W=je.current;if(St(null),!W?.dragging)return;if(W.kind==="theater"){const pt=f8(Ae.current,W.sourceTheaterId,W.dropIndex);if(pt.join("\0")===Ae.current.join("\0"))return;dt.current(pt);return}if(W.kind==="group"){const pt=d8(Le.current,W.sourceGroupId,W.dropIndex);if(pt.join("\0")===Le.current.join("\0"))return;et.current(pt);return}const{sourceId:fe,sourceGroupId:Ee,dropIndex:ot,dropGroupId:ft}=W,He=ke.current,Ot=We.current;if(ft!==Ee){const Zt=He.find($n=>$n.groupId===ft)?.entryIds??[];v_(c8(Ot,fe,ot,Zt)),Me.current(fe,ft);return}const ye=He.find(pt=>pt.groupId===Ee)?.entryIds??[],ze=ye.indexOf(fe);if(ze===-1||ot===ze)return;const Ue=u8(Ot,fe,ot,ye);v_(Ue)},Xt=xe=>{xe.pointerId===Be&&St(null)};return window.addEventListener("pointermove",le),window.addEventListener("pointerup",at),window.addEventListener("pointercancel",Xt),()=>{window.removeEventListener("pointermove",le),window.removeEventListener("pointerup",at),window.removeEventListener("pointercancel",Xt)}},[Be]);const Ie=(le,at)=>{if(le.button!==0||le.target instanceof Element&&le.target.closest("button"))return;oe(null),On();const xe=ce.find(W=>W.operation.id===at)?.operation.groupId??null;St({kind:"chip",sourceId:at,sourceGroupId:xe,pointerId:le.pointerId,startX:le.clientX,startY:le.clientY,currentY:le.clientY,dragging:!1,dropIndex:pi.indexOf(at),dropGroupId:xe})},nt=(le,at)=>{le.button===0&&(le.target instanceof Element&&le.target.closest("button")||Ge.includes(at)&&(oe(null),On(),St({kind:"group",sourceGroupId:at,pointerId:le.pointerId,startX:le.clientX,startY:le.clientY,currentY:le.clientY,dragging:!1,dropIndex:Ge.indexOf(at)})))},ln=(le,at)=>{if(le.button!==0||le.target instanceof Element&&le.target.closest("button"))return;const Xt=e.map(xe=>xe.id);Xt.includes(at)&&(oe(null),On(),St({kind:"theater",sourceTheaterId:at,pointerId:le.pointerId,startX:le.clientX,startY:le.clientY,currentY:le.clientY,dragging:!1,dropIndex:Xt.indexOf(at)}))},Ct=y.useCallback(le=>{le.preventDefault();const at=le.clientX,Xt=E.width;ct(!0);const xe=fe=>{const Ee=fe.clientX-at;x8(Xt+Ee)},W=()=>{ct(!1),document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",W),document.removeEventListener("pointercancel",W)};document.addEventListener("pointermove",xe),document.addEventListener("pointerup",W),document.addEventListener("pointercancel",W)},[E.width]),Yn=()=>{Xl(!j)},vs=()=>{Ye(null),oe(null),Wt(!0)},Ps=()=>{Wt(!1),B()},Ci=le=>{Wt(!1),G(le)},rn=le=>{le.defaultPrevented||(le.preventDefault(),oe(null),Ye({anchor:{x:le.clientX,y:le.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Ut=y.useCallback(()=>{const le=Je?.kind==="theater"?Je.returnFocus:null;oe(null),le?.focus()},[Je]),Hi=(le,at)=>{at!==t&&Q(at),oe(null),Ye({anchor:{x:le.right+8,y:le.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},zs=(le,at)=>{le.stopPropagation(),Hi(le.currentTarget.getBoundingClientRect(),at)};y.useEffect(()=>{Qe&&($D(),j&&Xl(!1),vs())},[Qe]),y.useEffect(()=>{const le=Ne;if(le===null)return;if(j){Xl(!1);return}if(!e.some(W=>W.id===le)){DC();return}const at=()=>{DC();const fe=Array.from(D.current?.querySelectorAll("[data-theater-id]")??[]).find(Ee=>Ee.dataset.theaterId===le)?.querySelector(".side-bar-theater-launch-btn");fe&&Hi(fe.getBoundingClientRect(),le)};if(D.current!==null&&Math.abs(D.current.getBoundingClientRect().width-$)<=1){at();return}const xe=window.setTimeout(at,220);return()=>window.clearTimeout(xe)},[Ne,j]);const wr=le=>{C8(le,!bt.includes(le))};return c.jsxs("aside",{className:`operations-side-bar ${j?"is-closed":"is-expanded"}`,ref:D,"data-sidebar-state":j?"closed":"expanded","data-resizing":hn?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${$}px`},inert:j,onContextMenu:rn,children:[c.jsxs("div",{className:"side-bar-theater-add-row",children:[c.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:vs,disabled:p,"aria-label":"Add Theater",title:p?"Adding Theater":"Add Theater",children:[c.jsx(w0,{}),c.jsx("span",{children:"Add Theater"})]}),c.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[c.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:c.jsx(D8,{})}),c.jsx("span",{className:"side-bar-formation-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>y_("grid"),disabled:t===null,"aria-pressed":Y&&A==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:c.jsx(O8,{})}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>y_("columns"),disabled:t===null,"aria-pressed":Y&&A==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:c.jsx(I8,{})}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>y_("rows"),disabled:t===null,"aria-pressed":Y&&A==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:c.jsx(B8,{})})]})]}),!j&&m?c.jsx("p",{className:"side-bar-theater-error",children:m}):null,c.jsx("ol",{className:"operations-side-bar-chips",ref:N,"aria-label":"Operations",children:e.map((le,at)=>{const Xt=le.id===t,xe=n.filter(He=>He.theaterId===le.id).length,W=bt.includes(le.id),fe=ae?.kind==="theater"&&ae.sourceTheaterId===le.id&&ae.dragging,Ee=fe&&ae?.kind==="theater"?ae.currentY-ae.startY:0,ot=ae?.kind==="theater"&&ae.dragging&&ae.sourceTheaterId!==le.id&&ae.dropIndex===at,ft=ae?.kind==="theater"&&ae.dragging&&ae.sourceTheaterId!==le.id&&at===e.length-1&&ae.dropIndex===e.length;if(!Xt){const He=RO(le.id),Ot=$8({theaterId:le.id,operations:n,operationOrder:He.operationOrder,minimizedSet:new Set(He.minimized),activeOperationId:null,operationNotifications:u,operationStatus:Se,catalog:d,renderKindIcon:_});return c.jsx(P8,{theater:le,entries:W?[]:Ot,groups:i.filter(Dt=>Dt.theaterId===le.id),collapsedGroups:new Set(He.collapsedGroups),operationAccent:He.operationAccent,operationCount:xe,collapsed:W,dragging:fe,dropBefore:ot,dropAfter:ft,dragOffsetY:Ee,onSelectTheater:Q,onFocus:k,onToggleCollapsed:wr,onOpenActions:(Dt,ye)=>{Ye(null),oe({kind:"theater",theaterId:le.id,anchor:Dt,returnFocus:ye})},onOpenLaunch:zs,onContextMenu:Dt=>{Ye(null),oe({kind:"theater",theaterId:le.id,anchor:Dt})},onPointerDragStart:ln},le.id)}return c.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",ot?"side-bar-theater-section--drop-before":"",ft?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":le.id,children:[c.jsx(tA,{theater:le,operationCount:xe,active:!0,collapsed:W,dragging:fe,dropTarget:ot,dragOffsetY:Ee,onSelectTheater:Q,onToggleCollapsed:wr,onOpenActions:(He,Ot)=>{Ye(null),oe({kind:"theater",theaterId:le.id,anchor:He,returnFocus:Ot})},onOpenLaunch:zs,onContextMenu:He=>{Ye(null),oe({kind:"theater",theaterId:le.id,anchor:He})},onPointerDragStart:ln}),W?null:c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${le.label} operations`,children:$e.map(He=>{const Ot=He.groupId!==null&&ne.has(He.groupId),Dt=He.group?Ka(He.group.color):null,ye=Dt?{"--grp-color":Dt}:void 0,ze=He.groupId?Ge.indexOf(He.groupId):-1,Ue=ae?.kind==="group"&&ae.sourceGroupId===He.groupId&&ae.dragging,pt=ae?.kind==="group"&&ae.dragging&&He.groupId!==null&&ae.sourceGroupId!==He.groupId&&ae.dropIndex===ze,Zt=ae?.kind==="group"&&ae.dragging&&He.groupId!==null&&ae.sourceGroupId!==He.groupId&&ze===Ge.length-1&&ae.dropIndex===Ge.length,$n=[He.groupId?"side-bar-group-section":"side-bar-ungrouped-section",pt?"side-bar-group-section--drop-before":"",Zt?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return c.jsxs("li",{"data-drop-zone-group-id":He.groupId??"__ungrouped__",className:$n,style:ye,children:[He.group?c.jsx(GT,{group:He.group,count:He.entries.length,collapsed:Ot,dragging:Ue,dragOffsetY:Ue?ae.currentY-ae.startY:0,dropTarget:pt,onToggle:oT,onContextMenu:(cn,ti)=>oe({kind:"group",groupId:cn,anchor:ti}),onPointerDragStart:nt}):Oe&&He.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,Ot?null:c.jsx("ol",{className:["side-bar-group-chips",ae?.kind==="chip"&&ae.dragging&&ae.dropGroupId===He.groupId&&ae.dropGroupId!==ae.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":He.groupId??"__ungrouped__","aria-label":He.group?He.group.name:"Ungrouped",children:He.entries.map(cn=>{const ti=ce.indexOf(cn),Jt=He.entries.indexOf(cn),ki=H.operationAccent[cn.operation.id]??ay(cn.operation),Vo=ki?Ka(ki):null;return c.jsx(qT,{entry:cn,index:ti,isCloseArmed:he===cn.operation.id,accentValue:Vo,dragging:ae?.kind==="chip"&&ae.sourceId===cn.operation.id&&ae.dragging,dragOffsetY:ae?.kind==="chip"&&ae.sourceId===cn.operation.id&&ae.dragging?ae.currentY-ae.startY:0,dropTarget:ae?.kind==="chip"&&ae.dragging===!0&&ae.dropGroupId===He.groupId&&ae.dropGroupId===ae.sourceGroupId&&ae.dropIndex===Jt&&ae.sourceId!==cn.operation.id,onArmClose:yn,onDisarmClose:On,onClose:w,onMinimize:x,onFocus:k,onKeyboardMove:Xe,onPointerDragStart:Ie,onOpenAccent:(na,Qa)=>oe({kind:"chip",operationId:na,anchor:Qa}),onRename:P},cn.operation.id)})})]},He.groupId??"__ungrouped__")})})]},le.id)})}),c.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Ct,onDoubleClick:Yn,"aria-hidden":"true"}),qe?Ya.createPortal(c.jsx($T,{anchor:qe.anchor,viewportBounds:qe.viewportBounds,placement:"cursor",catalog:d,canLaunch:f,renderKindIcon:_,onLaunchKind:(le,at)=>{Ye(null),b(le,at)},onClose:()=>Ye(null)},`${qe.anchor.x}:${qe.anchor.y}`),document.body):null,Je?.kind==="chip"&&K?c.jsx(UC,{kind:"chip",operation:K,groups:i.filter(le=>le.theaterId===K.theaterId),accentKey:H.operationAccent[K.id]??ay(K),anchor:Je.anchor,actions:{onSetAccent:le=>O(K.id,le),onSetGroupId:le=>F(K.id,le),onCreateGroup:le=>T(K.theaterId,le,K.id)},onClose:()=>oe(null)}):Je?.kind==="group"&&pe?c.jsx(UC,{kind:"group-header",group:pe,anchor:Je.anchor,actions:{onSetColor:le=>L(pe.id,le),onRename:le=>M(pe.id,le),onUngroupAll:()=>Z(pe.id)},onClose:()=>oe(null)}):Je?.kind==="theater"&&be?c.jsx(z8,{theater:be,groupCount:i.filter(le=>le.theaterId===be.id).length,anchor:Je.anchor,onCreateGroup:le=>{T(be.id,le),Ut()},onForgetTheater:()=>{R(be.id),Ut()},onClose:Ut}):null,c.jsx(zT,{open:Mt,onCancel:Ps,onConfirm:Ci}),j?null:c.jsx(zI,{})]})}function O8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function D8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function I8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function B8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function eA(e,t,n){const i=[...t].sort((d,f)=>d.order-f.order||d.createdAt-f.createdAt),r=i.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},u=new Map(i.map(d=>[d.id,d]));for(const d of e){const f=d.operation.groupId??null;f!==null&&u.has(f)?r.find(m=>m.groupId===f)?.entries.push(d):o.entries.push(d)}return[...r,o]}function $8({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:u,catalog:d,renderKindIcon:f}){return p0(t.filter(p=>p.theaterId===e),n).map(p=>{const m=QT(d,p),_=m?f(p.pluginId,m):null;return{operation:p,active:r===p.id,minimized:i.has(p.id),notificationCount:o[p.id]?1:0,status:u[p.id],icon:_}})}function tA({theater:e,operationCount:t,active:n,collapsed:i,dragging:r,dropTarget:o,dragOffsetY:u,onSelectTheater:d,onToggleCollapsed:f,onOpenActions:p,onOpenLaunch:m,onContextMenu:_,onPointerDragStart:b}){const S=y.useRef(!1),w=["side-bar-theater-header",n?"is-active":"",r?"side-bar-theater-header--dragging":"",o?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),x=r?{"--drag-dy":`${Math.round(u)}px`}:void 0,k=L=>{L.preventDefault(),_(L.currentTarget.getBoundingClientRect())},O=L=>{L.target===L.currentTarget&&(L.key!=="Enter"&&L.key!==" "||(L.preventDefault(),d(e.id)))},P=L=>{L.target instanceof Element&&L.target.closest("button")||b(L,e.id)},F=()=>{r&&(S.current=!0)},T=()=>{if(S.current){S.current=!1;return}d(e.id)};return c.jsxs("div",{role:"button",tabIndex:0,className:w,style:x,onClick:T,onKeyDown:O,onContextMenu:k,onPointerDown:P,onPointerUp:F,"aria-current":n?"true":void 0,"aria-expanded":!i,title:e.label,children:[c.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:x0(e.label)}),c.jsx("span",{className:"side-bar-theater-name",children:e.label}),c.jsx("span",{className:"side-bar-theater-count",children:t}),c.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[c.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:L=>{L.stopPropagation(),f(e.id)},children:c.jsx(F8,{collapsed:i})}),c.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:L=>{L.stopPropagation(),p(L.currentTarget.getBoundingClientRect(),L.currentTarget)},children:c.jsx(U8,{})}),c.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-launch-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:L=>m(L,e.id),children:c.jsx(w0,{})})]})]})}function P8({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:u,dragging:d,dropBefore:f,dropAfter:p,dragOffsetY:m,onSelectTheater:_,onFocus:b,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:k,onPointerDragStart:O}){const P=eA(t,n),F=P.some(T=>T.group!==null);return c.jsxs("li",{className:["side-bar-theater-section",f?"side-bar-theater-section--drop-before":"",p?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[c.jsx(tA,{theater:e,operationCount:o,active:!1,collapsed:u,dragging:d,dropTarget:f,dragOffsetY:m,onSelectTheater:_,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:k,onPointerDragStart:O}),!u&&P.length>0?c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:P.map(T=>{const L=T.groupId!==null&&i.has(T.groupId),M=T.group?Ka(T.group.color):null;return c.jsxs("li",{className:T.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:M?{"--grp-color":M}:void 0,children:[T.group?c.jsx(GT,{group:T.group,count:T.entries.length,collapsed:L,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:z=>jO(e.id,z),onContextMenu:()=>{},onPointerDragStart:()=>{}}):F&&T.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,L?null:c.jsx("ol",{className:"side-bar-group-chips","aria-label":T.group?T.group.name:"Ungrouped",children:T.entries.map((z,U)=>{const Z=r[z.operation.id]??ay(z.operation),Q=Z?Ka(Z):null;return c.jsx(qT,{entry:z,index:U,isCloseArmed:!1,accentValue:Q,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:b,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},z.operation.id)})})]},T.groupId??"__ungrouped__")})}):null]})}function z8({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[u,d]=y.useState(!1),[f,p]=y.useState(`Group ${t+1}`),m=y.useRef(!1),_=y.useRef(null),b=y.useRef(null),[S,w]=y.useState(n.bottom+6);y.useLayoutEffect(()=>{const k=b.current?.getBoundingClientRect().height??0,O=window.innerHeight-k-8;w(Math.max(8,Math.min(n.bottom+6,O)))},[n,u]),y.useEffect(()=>{u&&_.current?.select()},[u]),y.useEffect(()=>{const k=O=>{O.key==="Escape"&&(O.preventDefault(),o())};return window.addEventListener("keydown",k),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",k),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const k=f.trim();k&&i(k)};return Ya.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:c.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:k=>k.stopPropagation(),children:[u?c.jsx("input",{ref:_,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:f,onChange:k=>p(k.target.value),onCompositionStart:()=>{m.current=!0},onCompositionEnd:()=>{m.current=!1},onKeyDown:k=>{k.key==="Enter"&&!m.current&&(k.preventDefault(),x()),k.key==="Escape"&&(k.preventDefault(),d(!1))},onBlur:()=>d(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>d(!0),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(w0,{})}),c.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),c.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:r,children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(q8,{})}),c.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function H8(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+YC?t.scrollTop-=XC:e>n.bottom-YC&&(t.scrollTop+=XC)}function F8({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?c.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):c.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function U8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),c.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function w0(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function x0(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>W8(i)):nA(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function W8(e){return nA(e).slice(0,1)}function nA(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function q8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function G8({theaters:e,operations:t,activeTheaterId:n,addingTheater:i,onSelectTheater:r,onAddTheater:o,style:u,containerRef:d}){const f=[e.map(p=>{const m=t.filter(_=>_.theaterId===p.id).length;return{key:p.id,role:"menuitemradio",label:p.label,checked:p.id===n,mark:x0(p.label),meta:`${m} ${m===1?"op":"ops"}`,onSelect:()=>r(p.id)}}),[{key:"__add-theater__",role:"menuitem",label:"Add Theater…",action:!0,disabled:i,onSelect:o}]];return c.jsx(iA,{menuLabel:"Switch Theater",sections:f,style:u,containerRef:d})}function K8({operations:e,activeOperationId:t,theaterLabel:n,onSelectOperation:i,onRenameOperation:r,onNewOperation:o,style:u,containerRef:d}){const f=[e.map(p=>({key:p.id,role:"menuitemradio",label:p.title,checked:p.id===t,meta:Y8(p),onSelect:()=>i(p.id)})),[...r!==null?[{key:"__rename-operation__",role:"menuitem",label:"Rename current operation…",onSelect:r}]:[],{key:"__new-operation__",role:"menuitem",label:`New Operation in ${n}…`,action:!0,onSelect:o}]];return c.jsx(iA,{menuLabel:"Switch operation",sections:f,emptyNote:e.length===0?"No operations in this Theater":null,style:u,containerRef:d})}function iA({menuLabel:e,sections:t,emptyNote:n,style:i,containerRef:r}){const o=()=>Array.from(r.current?.querySelectorAll(".command-band-menu-item:not(:disabled)")??[]);y.useEffect(()=>{const f=o();(f.find(p=>p.getAttribute("aria-checked")==="true")??f[0])?.focus()},[]);const u=f=>{if(f.key!=="ArrowDown"&&f.key!=="ArrowUp"&&f.key!=="Home"&&f.key!=="End")return;const p=o();if(p.length===0)return;f.preventDefault();const m=p.findIndex(b=>b===document.activeElement),_=f.key==="Home"?0:f.key==="End"?p.length-1:f.key==="ArrowDown"?(m+1)%p.length:m<=0?p.length-1:m-1;p[_]?.focus()},d=t.filter(f=>f.length>0);return c.jsxs("div",{ref:r,className:"command-band-menu",role:"menu","aria-label":e,style:i,onKeyDown:u,children:[n?c.jsx("p",{className:"command-band-menu-empty",children:n}):null,d.map((f,p)=>c.jsxs(y.Fragment,{children:[p>0||n?c.jsx("div",{className:"command-band-menu-divider","aria-hidden":"true"}):null,f.map(m=>c.jsxs("button",{type:"button",role:m.role,"aria-checked":m.role==="menuitemradio"?m.checked===!0:void 0,className:`command-band-menu-item${m.checked?" is-active":""}${m.action?" command-band-menu-action":""}`,disabled:m.disabled,onClick:m.onSelect,children:[c.jsx("span",{className:"command-band-menu-check","aria-hidden":"true",children:m.checked?c.jsx(V8,{}):null}),m.mark!==void 0?c.jsx("span",{className:"command-band-theater-mark","aria-hidden":"true",children:m.mark}):null,c.jsx("span",{className:"command-band-menu-label",children:m.label}),m.meta?c.jsx("span",{className:"command-band-menu-meta",children:m.meta}):null]},m.key))]},f[0]?.key??p))]})}function S_(){return c.jsx("span",{className:"command-band-trigger-caret","aria-hidden":"true",children:c.jsx("svg",{viewBox:"0 0 10 10",children:c.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})}function V8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Y8(e){const t=e.payload.cliLabel;if(typeof t=="string")return t;const n=e.payload.cliId;return typeof n=="string"?n:null}const np="fleet-console.rail.activePanelId",sA="fleet-console.rail.chromeExpanded",X8="fleet-console.repository.source",cy=new Set;let es={activeRailPanelId:i7(),railChromeExpanded:s7(),panelExtraWidth:0};function C0(e){return cy.add(e),()=>{cy.delete(e)}}function k0(){return es}function Z8(e){es.activeRailPanelId!==e&&(kh({...es,activeRailPanelId:e,panelExtraWidth:0}),T0(e))}function J8(e){const t=es.activeRailPanelId===e?null:e;kh({...es,activeRailPanelId:t,panelExtraWidth:0}),T0(t)}function Q8(e){Z8(e)}function e7(){es.activeRailPanelId!==null&&(kh({...es,activeRailPanelId:null,panelExtraWidth:0}),T0(null))}function rA(e){es.railChromeExpanded!==e&&(kh({...es,railChromeExpanded:e}),r7(e))}function E0(){rA(!es.railChromeExpanded)}function t7(e,t){if(e!==es.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!==es.panelExtraWidth&&kh({...es,panelExtraWidth:r})}function aA(){return y.useSyncExternalStore(C0,k0).activeRailPanelId}function oA(){return y.useSyncExternalStore(C0,k0).railChromeExpanded}function n7(){return y.useSyncExternalStore(C0,k0).panelExtraWidth}function i7(){try{const e=localStorage.getItem(np);if(e==="diff"||e==="history"){try{localStorage.setItem(np,"repository"),e==="history"&&localStorage.setItem(X8,"history")}catch{}return"repository"}return e}catch{return null}}function s7(){try{return localStorage.getItem(sA)!=="0"}catch{return!0}}function T0(e){try{e===null?localStorage.removeItem(np):localStorage.setItem(np,e)}catch{}}function r7(e){try{localStorage.setItem(sA,e?"1":"0")}catch{}}function kh(e){es=e;for(const t of cy)t()}function lA(e){const{sizeRange:t}=e,[n,i]=y.useState(""),[r,o]=y.useState(e.size),u=y.useRef(Promise.resolve()),d=y.useId(),f=y.useMemo(()=>a7(e),[e]),p=y.useMemo(()=>o7(f,n),[f,n]),m=y.useMemo(()=>p.map((M,z)=>({row:M,index:z})),[p]),[_,b]=y.useState(()=>l7(f,e.selected)),S=f.find(M=>ip(M.selection,e.selected))??null,w=m[Math.min(_,Math.max(0,m.length-1))]?.row??null,x=`${d}-built-ins`,k=`${d}-installed`;y.useEffect(()=>{o(e.size)},[e.size]),y.useEffect(()=>{_>=m.length&&b(Math.max(0,m.length-1))},[_,m.length]);const O=y.useCallback(M=>{const z=JC(M,t);o(z),u.current=u.current.catch(()=>{}).then(()=>e.onSizeCommit(z))},[e.onSizeCommit,t]),P=y.useCallback(M=>{p.length&&b(z=>(z+M+p.length)%p.length)},[p.length]),F=y.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),T=y.useCallback((M,z)=>{b(M),e.onSelectionChange(z)},[e]),L=M=>{M.key==="ArrowDown"?(M.preventDefault(),P(1)):M.key==="ArrowUp"?(M.preventDefault(),P(-1)):M.key==="Home"?(M.preventDefault(),b(0)):M.key==="End"?(M.preventDefault(),b(Math.max(0,p.length-1))):(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),F())};return c.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:c.jsxs("div",{className:"fc-font-browser__panes",children:[c.jsxs("div",{className:"fc-font-browser__chooser",children:[c.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${d}-search`,children:"Search fonts"}),c.jsx("input",{id:`${d}-search`,className:"fc-font-browser__search",type:"search",value:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:M=>{i(M.currentTarget.value),b(0)}}),e.loading?c.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?c.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,c.jsxs("div",{id:d,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?cA(d,_):void 0,"aria-busy":e.loading||void 0,onKeyDown:L,children:[c.jsx(ZC,{groupId:x,label:"Built-in",rows:m.filter(({row:M})=>M.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),c.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),c.jsx(ZC,{groupId:k,label:"Installed on this machine",rows:m.filter(({row:M})=>M.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),!e.loading&&!m.length?c.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),c.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[c.jsxs("div",{className:"fc-font-browser__preview-head",children:[c.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),c.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),c.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),c.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>O(r-t.step),"aria-label":"Decrease font size",children:"−"}),c.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>O(r+t.step),"aria-label":"Increase font size",children:"+"})]}),c.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:M=>o(JC(Number(M.currentTarget.value),t)),onPointerUp:M=>O(Number(M.currentTarget.value)),onKeyUp:M=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(M.key)&&O(Number(M.currentTarget.value))}})]})]})})}function ZC({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:u,onSelect:d}){return c.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[c.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:f,index:p})=>c.jsxs("button",{id:cA(o,p),type:"button",className:`fc-font-browser__row${ip(f.selection,i?.selection??null)?" is-active":""}${f.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":ip(f.selection,r),disabled:u||f.unavailable,onClick:()=>d(p,f.selection),children:[c.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:f.previewFamily},children:f.label}),f.description?c.jsx("span",{className:"fc-font-browser__row-meta",children:f.description}):null,f.unavailable?c.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},f.id))]})}function a7(e){const t=new Set,n=e.builtIns.flatMap(o=>{const u=[o.id,o.label,...o.aliases??[]].map(Qu);return u.some(d=>t.has(d))?[]:(u.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-${Qu(o.family)}`,label:o.family,family:o.family,previewFamily:Qf(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!mD(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${Qu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:Qf(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function o7(e,t){const n=Qu(t);return n?e.filter(i=>Qu(`${i.label} ${i.description??""}`).includes(n)):e}function Qu(e){return e.trim().toLocaleLowerCase()}function cA(e,t){return`${e}-option-${t}`}function l7(e,t){const n=e.findIndex(i=>ip(i.selection,t));return n>=0?n:0}function ip(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function JC(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 c7="/api/v1/settings/fonts/system";class Fl extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function u7(e){if(!hA(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new Fl("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(h7)}}async function uA(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new Fl("System font fetching is unavailable in this environment.");let n;try{n=await t(c7,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new Fl("System fonts could not be loaded.")}if(!n.ok)throw new Fl("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new Fl("System font response is not valid JSON.",n.status)}return u7(i)}function h7(e){if(!hA(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new Fl("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function d7(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hA(e,t){return d7(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const QC=250,f7=5e3,ek=1,p7=1013,m7=4e3,g7=4001;function _7(e){const t=new AbortController,n=new TextEncoder;let i=QC,r=null,o=null,u=null,d=!1;const f=()=>{o?.dispose(),o=null},p=(b,S)=>{u={cols:b,rows:S},r?.readyState===ek&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},m=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await y7(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await _(v7(b,e.location,e.wsPath),e),i=QC}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await S7(i,t.signal),i=Math.min(i*2,f7)}},_=async(b,S)=>{await new Promise((w,x)=>{const k=(S.webSocketFactory??b7)(b);r=k,k.binaryType="arraybuffer",k.onopen=()=>{S.onStatus?.("live"),f(),o=S.terminal.onData(O=>{k.readyState===ek&&k.send(n.encode(O))}),u&&p(u.cols,u.rows)},k.onmessage=O=>{O.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(O.data))},k.onerror=()=>{x(new Error("Terminal WebSocket error"))},k.onclose=O=>{f(),r===k&&(r=null);const P=O?.code;P===m7?(t.abort(),S.onStatus?.("closed","terminal_replaced")):P===g7?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):P===p7&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{d||(d=!0,m())},resize:p,dispose:()=>{t.abort(),f(),e.onStatus?.("closed"),r?.close(),r=null}}}function v7(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function y7(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 b7(e){return new WebSocket(e)}async function S7(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var w7=2,x7=1,C7=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),u={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=u.top+u.bottom,f=u.right+u.left,p=i-d,m=r-f-t;return{cols:Math.max(w7,Math.floor(m/e.css.cell.width)),rows:Math.max(x7,Math.floor(p/e.css.cell.height))}}};var w_=[[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]],k7=[[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]],Zn;function E7(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 T7=class{constructor(){if(this.version="6",!Zn){Zn=new Uint8Array(65536),Zn.fill(1),Zn[0]=0,Zn.fill(0,1,32),Zn.fill(0,127,160),Zn.fill(2,4352,4448),Zn[9001]=2,Zn[9002]=2,Zn.fill(2,11904,42192),Zn[12351]=1,Zn.fill(2,44032,55204),Zn.fill(2,63744,64256),Zn.fill(2,65040,65050),Zn.fill(2,65072,65136),Zn.fill(2,65280,65377),Zn.fill(2,65504,65511);for(let t=0;t<w_.length;++t)Zn.fill(0,w_[t][0],w_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Zn[t]:E7(t,k7)?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=rp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return rp.createPropertyValue(0,i,r)}},A7=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?tk.isErrorNoTelemetry(t)?new tk(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)}},R7=new A7;function x_(e){N7(e)||R7.onUnexpectedError(e)}var uy="Canceled";function N7(e){return e instanceof L7?!0:e instanceof Error&&e.name===uy&&e.message===uy}var L7=class extends Error{constructor(){super(uy),this.name=this.message}},tk=class hy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof hy)return t;let n=new hy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function M7(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}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||={});var dA;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function u(T){return T||n}e.from=u;function*d(T){for(let L=T.length-1;L>=0;L--)yield T[L]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function m(T,L){let M=0;for(let z of T)if(L(z,M++))return!0;return!1}e.some=m;function _(T,L){for(let M of T)if(L(M))return M}e.find=_;function*b(T,L){for(let M of T)L(M)&&(yield M)}e.filter=b;function*S(T,L){let M=0;for(let z of T)yield L(z,M++)}e.map=S;function*w(T,L){let M=0;for(let z of T)yield*L(z,M++)}e.flatMap=w;function*x(...T){for(let L of T)yield*L}e.concat=x;function k(T,L,M){let z=M;for(let U of T)z=L(z,U);return z}e.reduce=k;function*O(T,L,M=T.length){for(L<0&&(L+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);L<M;L++)yield T[L]}e.slice=O;function P(T,L=Number.POSITIVE_INFINITY){let M=[];if(L===0)return[M,T];let z=T[Symbol.iterator]();for(let U=0;U<L;U++){let Z=z.next();if(Z.done)return[M,e.empty()];M.push(Z.value)}return[M,{[Symbol.iterator](){return z}}]}e.consume=P;async function F(T){let L=[];for await(let M of T)L.push(M);return Promise.resolve(L)}e.asyncToArray=F})(dA||={});function fA(e){if(dA.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 O7(...e){return pA(()=>fA(e))}function pA(e){return{dispose:M7(()=>{e()})}}var mA=class gA{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{fA(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?gA.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)}};mA.DISABLE_DISPOSED_WARNING=!1;var A0=mA,sp=class{constructor(){this._store=new A0,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)}};sp.None=Object.freeze({dispose(){}});var D7=globalThis.performance&&typeof globalThis.performance.now=="function",I7=class _A{static create(t){return new _A(t)}constructor(t){this._now=D7&&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}},B7;(e=>{e.None=()=>sp.None;function t(B,R){return _(B,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function n(B){return(R,D=null,N)=>{let E=!1,$;return $=B(j=>{if(!E)return $?$.dispose():E=!0,R.call(D,j)},null,N),E&&$.dispose(),$}}e.once=n;function i(B,R,D){return p((N,E=null,$)=>B(j=>N.call(E,R(j)),null,$),D)}e.map=i;function r(B,R,D){return p((N,E=null,$)=>B(j=>{R(j),N.call(E,j)},null,$),D)}e.forEach=r;function o(B,R,D){return p((N,E=null,$)=>B(j=>R(j)&&N.call(E,j),null,$),D)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(R,D=null,N)=>{let E=O7(...B.map($=>$(j=>R.call(D,j))));return m(E,N)}}e.any=d;function f(B,R,D,N){let E=D;return i(B,$=>(E=R(E,$),E),N)}e.reduce=f;function p(B,R){let D,N={onWillAddFirstListener(){D=B(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new ja(N);return R?.add(E),E.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function _(B,R,D=100,N=!1,E=!1,$,j){let q,H,A,Y=0,J,he={leakWarningThreshold:$,onWillAddFirstListener(){q=B(ae=>{Y++,H=R(H,ae),N&&!A&&(de.fire(H),H=void 0),J=()=>{let we=H;H=void 0,A=void 0,(!N||Y>1)&&de.fire(we),Y=0},typeof D=="number"?(clearTimeout(A),A=setTimeout(J,D)):A===void 0&&(A=0,queueMicrotask(J))})},onWillRemoveListener(){E&&Y>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},de=new ja(he);return j?.add(de),de.event}e.debounce=_;function b(B,R=0,D){return e.debounce(B,(N,E)=>N?(N.push(E),N):[E],R,void 0,!0,void 0,D)}e.accumulate=b;function S(B,R=(N,E)=>N===E,D){let N=!0,E;return o(B,$=>{let j=N||!R($,E);return N=!1,E=$,j},D)}e.latch=S;function w(B,R,D){return[e.filter(B,R,D),e.filter(B,N=>!R(N),D)]}e.split=w;function x(B,R=!1,D=[],N){let E=D.slice(),$=B(H=>{E?E.push(H):q.fire(H)});N&&N.add($);let j=()=>{E?.forEach(H=>q.fire(H)),E=null},q=new ja({onWillAddFirstListener(){$||($=B(H=>q.fire(H)),N&&N.add($))},onDidAddFirstListener(){E&&(R?setTimeout(j):j())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return N&&N.add(q),q.event}e.buffer=x;function k(B,R){return(D,N,E)=>{let $=R(new P);return B(function(j){let q=$.evaluate(j);q!==O&&D.call(N,q)},void 0,E)}}e.chain=k;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(D=>(R(D),D)),this}filter(R){return this.steps.push(D=>R(D)?D:O),this}reduce(R,D){let N=D;return this.steps.push(E=>(N=R(N,E),N)),this}latch(R=(D,N)=>D===N){let D=!0,N;return this.steps.push(E=>{let $=D||!R(E,N);return D=!1,N=E,$?E:O}),this}evaluate(R){for(let D of this.steps)if(R=D(R),R===O)break;return R}}function F(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.on(R,N),$=()=>B.removeListener(R,N),j=new ja({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromNodeEventEmitter=F;function T(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.addEventListener(R,N),$=()=>B.removeEventListener(R,N),j=new ja({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromDOMEventEmitter=T;function L(B){return new Promise(R=>n(B)(R))}e.toPromise=L;function M(B){let R=new ja;return B.then(D=>{R.fire(D)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=M;function z(B,R){return B(D=>R.fire(D))}e.forward=z;function U(B,R,D){return R(D),B(N=>R(N))}e.runAndSubscribe=U;class Z{constructor(R,D){this._observable=R,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new ja(N),D&&D.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,D){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,R){return new Z(B,R).emitter.event}e.fromObservable=Q;function G(B){return(R,D,N)=>{let E=0,$=!1,j={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),$&&($=!1,R.call(D)))},handlePossibleChange(){},handleChange(){$=!0}};B.addObserver(j),B.reportChanges();let q={dispose(){B.removeObserver(j)}};return N instanceof A0?N.add(q):Array.isArray(N)&&N.push(q),q}}e.fromObservableLight=G})(B7||={});var dy=class fy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${fy._idPool++}`,fy.all.add(this)}start(t){this._stopWatch=new I7,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}}};dy.all=new Set,dy._idPool=0;var $7=dy,P7=-1,vA=class yA{constructor(t,n,i=(yA._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,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let f=new F7(d,o);this._errorHandler(f)}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}};vA._idPool=1;var z7=vA,H7=class bA{constructor(t){this.value=t}static create(){let t=new Error;return new bA(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
+
`).slice(2).join(`
|
|
17
|
+
`))}},F7=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},U7=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},W7=0,C_=class{constructor(t){this.value=t,this.id=W7++}},q7=2,G7,ja=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new z7(t?.onListenerError??x_,this._options?.leakWarningThreshold??P7):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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new U7(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||x_)(p),sp.None}if(this._disposed)return sp.None;n&&(t=t.bind(n));let r=new C_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=H7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof C_?(this._deliveryQueue??=new K7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=pA(()=>{o?.(),this._removeListener(r)});return i instanceof A0?i.add(u):Array.isArray(i)&&i.push(u),u},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*q7<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]: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||x_;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 C_)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}},K7=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}},rp=class Af{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ja,this.onChange=this._onChange.event;let t=new T7;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 u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let p=t.charCodeAt(o);56320<=p&&p<=57343?u=(u-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(u,i),f=Af.extractWidth(d);Af.extractShouldJoin(d)&&(f-=Af.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},k_=[[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]],V7=[[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]],E_=[[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]],Y7=[[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]],zr;function nk(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 X7=class{constructor(){if(this.version="11",!zr){zr=new Uint8Array(65536),zr.fill(1),zr[0]=0,zr.fill(0,1,32),zr.fill(0,127,160);for(let t=0;t<k_.length;++t)zr.fill(0,k_[t][0],k_[t][1]+1);for(let t=0;t<E_.length;++t)zr.fill(2,E_[t][0],E_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?zr[t]:nk(t,V7)?0:nk(t,Y7)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=rp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return rp.createPropertyValue(0,i,r)}},Z7=class{activate(t){t.unicode.register(new X7)}dispose(){}};var J7=(e,t,n,i)=>{for(var r=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=u(r)||r);return r},Q7=(e,t)=>(n,i)=>t(n,i,e),eB=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ik.isErrorNoTelemetry(e)?new ik(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)}},tB=new eB;function T_(e){nB(e)||tB.onUnexpectedError(e)}var py="Canceled";function nB(e){return e instanceof iB?!0:e instanceof Error&&e.name===py&&e.message===py}var iB=class extends Error{constructor(){super(py),this.name=this.message}},ik=class my extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof my)return t;let n=new my;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},sB;(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})(sB||={});function rB(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var SA;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function u(T){return T||n}e.from=u;function*d(T){for(let L=T.length-1;L>=0;L--)yield T[L]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function m(T,L){let M=0;for(let z of T)if(L(z,M++))return!0;return!1}e.some=m;function _(T,L){for(let M of T)if(L(M))return M}e.find=_;function*b(T,L){for(let M of T)L(M)&&(yield M)}e.filter=b;function*S(T,L){let M=0;for(let z of T)yield L(z,M++)}e.map=S;function*w(T,L){let M=0;for(let z of T)yield*L(z,M++)}e.flatMap=w;function*x(...T){for(let L of T)yield*L}e.concat=x;function k(T,L,M){let z=M;for(let U of T)z=L(z,U);return z}e.reduce=k;function*O(T,L,M=T.length){for(L<0&&(L+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);L<M;L++)yield T[L]}e.slice=O;function P(T,L=Number.POSITIVE_INFINITY){let M=[];if(L===0)return[M,T];let z=T[Symbol.iterator]();for(let U=0;U<L;U++){let Z=z.next();if(Z.done)return[M,e.empty()];M.push(Z.value)}return[M,{[Symbol.iterator](){return z}}]}e.consume=P;async function F(T){let L=[];for await(let M of T)L.push(M);return Promise.resolve(L)}e.asyncToArray=F})(SA||={});function wA(e){if(SA.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 xA(...e){return Ri(()=>wA(e))}function Ri(e){return{dispose:rB(()=>{e()})}}var CA=class kA{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{wA(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?kA.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)}};CA.DISABLE_DISPOSED_WARNING=!1;var Zl=CA,Js=class{constructor(){this._store=new Zl,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)}};Js.None=Object.freeze({dispose(){}});var mu=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}},R0=typeof process<"u"&&"title"in process,Hp=R0?"node":navigator.userAgent,aB=R0?"node":navigator.platform,oB=Hp.includes("Firefox"),lB=Hp.includes("Edge"),EA=/^((?!chrome|android).)*safari/i.test(Hp);function cB(){if(!EA)return 0;let e=Hp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}aB.indexOf("Linux")>=0;var uB="",ri=0,ai=0,oi=0,Ln=0,Ns={css:"#00000000",rgba:0},Oi;(e=>{function t(r,o,u,d){return d!==void 0?`#${yo(r)}${yo(o)}${yo(u)}${yo(d)}`:`#${yo(r)}${yo(o)}${yo(u)}`}e.toCss=t;function n(r,o,u,d=255){return(r<<24|o<<16|u<<8|d)>>>0}e.toRgba=n;function i(r,o,u,d){return{css:e.toCss(r,o,u,d),rgba:e.toRgba(r,o,u,d)}}e.toColor=i})(Oi||={});var Pu;(e=>{function t(f,p){if(Ln=(p.rgba&255)/255,Ln===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,_=p.rgba>>16&255,b=p.rgba>>8&255,S=f.rgba>>24&255,w=f.rgba>>16&255,x=f.rgba>>8&255;ri=S+Math.round((m-S)*Ln),ai=w+Math.round((_-w)*Ln),oi=x+Math.round((b-x)*Ln);let k=Oi.toCss(ri,ai,oi),O=Oi.toRgba(ri,ai,oi);return{css:k,rgba:O}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let _=Oo.ensureContrastRatio(f.rgba,p.rgba,m);if(_)return Oi.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(f){let p=(f.rgba|255)>>>0;return[ri,ai,oi]=Oo.toChannels(p),{css:Oi.toCss(ri,ai,oi),rgba:p}}e.opaque=r;function o(f,p){return Ln=Math.round(p*255),[ri,ai,oi]=Oo.toChannels(f.rgba),{css:Oi.toCss(ri,ai,oi,Ln),rgba:Oi.toRgba(ri,ai,oi,Ln)}}e.opacity=o;function u(f,p){return Ln=f.rgba&255,o(f,Ln*p/255)}e.multiplyOpacity=u;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(Pu||={});var hB;(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 ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Oi.toColor(ri,ai,oi);case 5:return ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Ln=parseInt(r.slice(4,5).repeat(2),16),Oi.toColor(ri,ai,oi,Ln);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 ri=parseInt(o[1]),ai=parseInt(o[2]),oi=parseInt(o[3]),Ln=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Oi.toColor(ri,ai,oi,Ln);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),[ri,ai,oi,Ln]=t.getImageData(0,0,1,1).data,Ln!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Oi.toRgba(ri,ai,oi,Ln),css:r}}e.toColor=i})(hB||={});var Li;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,d=r/255,f=o/255,p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),_=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+m*.7152+_*.0722}e.relativeLuminance2=n})(Li||={});var Oo;(e=>{function t(u,d){if(Ln=(d&255)/255,Ln===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return ri=_+Math.round((f-_)*Ln),ai=b+Math.round((p-b)*Ln),oi=S+Math.round((m-S)*Ln),Oi.toRgba(ri,ai,oi)}e.blend=t;function n(u,d,f){let p=Li.relativeLuminance(u>>8),m=Li.relativeLuminance(d>>8);if(Hr(p,m)<f){if(m<p){let S=i(u,d,f),w=Hr(p,Li.relativeLuminance(S>>8));if(w<f){let x=r(u,d,f),k=Hr(p,Li.relativeLuminance(x>>8));return w>k?S:x}return S}let _=r(u,d,f),b=Hr(p,Li.relativeLuminance(_>>8));if(b<f){let S=i(u,d,f),w=Hr(p,Li.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,d,f){let p=u>>24&255,m=u>>16&255,_=u>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Hr(Li.relativeLuminance2(b,S,w),Li.relativeLuminance2(p,m,_));for(;x<f&&(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=Hr(Li.relativeLuminance2(b,S,w),Li.relativeLuminance2(p,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,d,f){let p=u>>24&255,m=u>>16&255,_=u>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Hr(Li.relativeLuminance2(b,S,w),Li.relativeLuminance2(p,m,_));for(;x<f&&(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=Hr(Li.relativeLuminance2(b,S,w),Li.relativeLuminance2(p,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(Oo||={});function yo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Hr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function qn(e){if(!e)throw new Error("value must not be falsy");return e}function N0(e){return 57508<=e&&e<=57558}function dB(e){return 57520<=e&&e<=57527}function fB(e){return 57344<=e&&e<=63743}function pB(e){return 9472<=e&&e<=9631}function mB(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 gB(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!mB(e)&&!N0(e)&&!fB(e)}function TA(e){return N0(e)||pB(e)}function _B(){return{css:{canvas:Kd(),cell:Kd()},device:{canvas:Kd(),cell:Kd(),char:{width:0,height:0,left:0,top:0}}}}function Kd(){return{width:0,height:0}}function vB(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var bi=0,ii=0,rr=!1,Fr=!1,Vd=!1,Yi,A_=0,yB=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,ii=0,bi=0,Fr=!1,rr=!1,Vd=!1,Yi=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&&(ii=r.backgroundColorRGB.rgba>>8&16777215,Fr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,rr=!0)}),Vd=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Vd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ii=(this.result.fg&16777215)<<8|255;break;default:ii=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ii=(this.result.bg&16777215)<<8|255;break}ii=Oo.blend(ii,(this._coreBrowserService.isFocused?Yi.selectionBackgroundOpaque:Yi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ii=(this._coreBrowserService.isFocused?Yi.selectionBackgroundOpaque:Yi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Fr=!0,Yi.selectionForeground&&(bi=Yi.selectionForeground.rgba>>8&16777215,rr=!0),TA(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)bi=(this._coreBrowserService.isFocused?Yi.selectionBackgroundOpaque:Yi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:bi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:bi=(this.result.fg&16777215)<<8|255;break;default:bi=this._themeService.colors.foreground.rgba}bi=Oo.blend(bi,(this._coreBrowserService.isFocused?Yi.selectionBackgroundOpaque:Yi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}rr=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(ii=r.backgroundColorRGB.rgba>>8&16777215,Fr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,rr=!0)}),Fr&&(Vd?ii=e.bg&-16777216&-134217729|ii|50331648:ii=e.bg&-16777216|ii|50331648),rr&&(bi=e.fg&-16777216&-67108865|bi|50331648),this.result.fg&67108864&&(Fr&&!rr&&((this.result.bg&50331648)===0?bi=this.result.fg&-134217728|Yi.background.rgba>>8&16777215&16777215|50331648:bi=this.result.fg&-134217728|this.result.bg&67108863,rr=!0),!Fr&&rr&&((this.result.fg&50331648)===0?ii=this.result.bg&-67108864|Yi.foreground.rgba>>8&16777215&16777215|50331648:ii=this.result.bg&-67108864|this.result.fg&67108863,Fr=!0)),Yi=void 0,this.result.bg=Fr?ii:this.result.bg,this.result.fg=rr?bi:this.result.fg,this.result.ext&=536870911,this.result.ext|=A_<<29&3758096384}},bB=.5,AA=oB||lB?"bottom":"ideographic",SB={"▀":[{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}]},wB={"░":[[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]]},xB={"─":{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`}},oh={"":{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}};oh[""]=oh[""];oh[""]=oh[""];function CB(e,t,n,i,r,o,u,d){let f=SB[t];if(f)return kB(e,f,n,i,r,o),!0;let p=wB[t];if(p)return EB(e,p,n,i,r,o),!0;let m=xB[t];if(m)return TB(e,m,n,i,r,o,d),!0;let _=oh[t];return _?(AB(e,_,n,i,r,o,u,d),!0):!1}function kB(e,t,n,i,r,o){for(let u=0;u<t.length;u++){let d=t[u],f=r/8,p=o/8;e.fillRect(n+d.x*f,i+d.y*p,d.w*f,d.h*p)}}var sk=new Map;function EB(e,t,n,i,r,o){let u=sk.get(t);u||(u=new Map,sk.set(t,u));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let f=u.get(d);if(!f){let p=t[0].length,m=t.length,_=e.canvas.ownerDocument.createElement("canvas");_.width=p,_.height=m;let b=qn(_.getContext("2d")),S=new ImageData(p,m),w,x,k,O;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),O=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,k,O]=d.substring(5,d.length-1).split(",").map(P=>parseFloat(P));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let P=0;P<m;P++)for(let F=0;F<p;F++)S.data[(P*p+F)*4]=w,S.data[(P*p+F)*4+1]=x,S.data[(P*p+F)*4+2]=k,S.data[(P*p+F)*4+3]=t[P][F]*(O*255);b.putImageData(S,0,0),f=qn(e.createPattern(_,null)),u.set(d,f)}e.fillStyle=f,e.fillRect(n,i,r,o)}function TB(e,t,n,i,r,o,u){e.strokeStyle=e.fillStyle;for(let[d,f]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(d);let p;if(typeof f=="function"){let m=.15/o*r;p=f(.15,m)}else p=f;for(let m of p.split(" ")){let _=m[0],b=RA[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=m.substring(1).split(",");!S[0]||!S[1]||b(e,NA(S,r,o,n,i,!0,u))}e.stroke(),e.closePath()}}function AB(e,t,n,i,r,o,u,d){let f=new Path2D;f.rect(n,i,r,o),e.clip(f),e.beginPath();let p=u/12;e.lineWidth=d*p;for(let m of t.d.split(" ")){let _=m[0],b=RA[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=m.substring(1).split(",");!S[0]||!S[1]||b(e,NA(S,r,o,n,i,!1,d,(t.leftPadding??0)*(p/2),(t.rightPadding??0)*(p/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function rk(e,t,n=0){return Math.max(Math.min(e,t),n)}var RA={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 NA(e,t,n,i,r,o,u,d=0,f=0){let p=e.map(m=>parseFloat(m)||parseInt(m));if(p.length<2)throw new Error("Too few arguments for instruction");for(let m=0;m<p.length;m+=2)p[m]*=t-d*u-f*u,o&&p[m]!==0&&(p[m]=rk(Math.round(p[m]+.5)-.5,t,0)),p[m]+=i+d*u;for(let m=1;m<p.length;m+=2)p[m]*=n,o&&p[m]!==0&&(p[m]=rk(Math.round(p[m]+.5)-.5,n,0)),p[m]+=r;return p}var ak=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={}}},ok=class{constructor(){this._data=new ak}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new ak),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()}},LA=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()}},RB=class extends LA{_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())}}},NB=class extends LA{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},LB=!R0&&"requestIdleCallback"in window?NB:RB,Ul=class MA{constructor(){this.fg=0,this.bg=0,this.extended=new jA}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 MA;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}},jA=class OA{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 OA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},MB=globalThis.performance&&typeof globalThis.performance.now=="function",jB=class DA{static create(t){return new DA(t)}constructor(t){this._now=MB&&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}},Vr;(e=>{e.None=()=>Js.None;function t(B,R){return _(B,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function n(B){return(R,D=null,N)=>{let E=!1,$;return $=B(j=>{if(!E)return $?$.dispose():E=!0,R.call(D,j)},null,N),E&&$.dispose(),$}}e.once=n;function i(B,R,D){return p((N,E=null,$)=>B(j=>N.call(E,R(j)),null,$),D)}e.map=i;function r(B,R,D){return p((N,E=null,$)=>B(j=>{R(j),N.call(E,j)},null,$),D)}e.forEach=r;function o(B,R,D){return p((N,E=null,$)=>B(j=>R(j)&&N.call(E,j),null,$),D)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(R,D=null,N)=>{let E=xA(...B.map($=>$(j=>R.call(D,j))));return m(E,N)}}e.any=d;function f(B,R,D,N){let E=D;return i(B,$=>(E=R(E,$),E),N)}e.reduce=f;function p(B,R){let D,N={onWillAddFirstListener(){D=B(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new _n(N);return R?.add(E),E.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function _(B,R,D=100,N=!1,E=!1,$,j){let q,H,A,Y=0,J,he={leakWarningThreshold:$,onWillAddFirstListener(){q=B(ae=>{Y++,H=R(H,ae),N&&!A&&(de.fire(H),H=void 0),J=()=>{let we=H;H=void 0,A=void 0,(!N||Y>1)&&de.fire(we),Y=0},typeof D=="number"?(clearTimeout(A),A=setTimeout(J,D)):A===void 0&&(A=0,queueMicrotask(J))})},onWillRemoveListener(){E&&Y>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},de=new _n(he);return j?.add(de),de.event}e.debounce=_;function b(B,R=0,D){return e.debounce(B,(N,E)=>N?(N.push(E),N):[E],R,void 0,!0,void 0,D)}e.accumulate=b;function S(B,R=(N,E)=>N===E,D){let N=!0,E;return o(B,$=>{let j=N||!R($,E);return N=!1,E=$,j},D)}e.latch=S;function w(B,R,D){return[e.filter(B,R,D),e.filter(B,N=>!R(N),D)]}e.split=w;function x(B,R=!1,D=[],N){let E=D.slice(),$=B(H=>{E?E.push(H):q.fire(H)});N&&N.add($);let j=()=>{E?.forEach(H=>q.fire(H)),E=null},q=new _n({onWillAddFirstListener(){$||($=B(H=>q.fire(H)),N&&N.add($))},onDidAddFirstListener(){E&&(R?setTimeout(j):j())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return N&&N.add(q),q.event}e.buffer=x;function k(B,R){return(D,N,E)=>{let $=R(new P);return B(function(j){let q=$.evaluate(j);q!==O&&D.call(N,q)},void 0,E)}}e.chain=k;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(D=>(R(D),D)),this}filter(R){return this.steps.push(D=>R(D)?D:O),this}reduce(R,D){let N=D;return this.steps.push(E=>(N=R(N,E),N)),this}latch(R=(D,N)=>D===N){let D=!0,N;return this.steps.push(E=>{let $=D||!R(E,N);return D=!1,N=E,$?E:O}),this}evaluate(R){for(let D of this.steps)if(R=D(R),R===O)break;return R}}function F(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.on(R,N),$=()=>B.removeListener(R,N),j=new _n({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromNodeEventEmitter=F;function T(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.addEventListener(R,N),$=()=>B.removeEventListener(R,N),j=new _n({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromDOMEventEmitter=T;function L(B){return new Promise(R=>n(B)(R))}e.toPromise=L;function M(B){let R=new _n;return B.then(D=>{R.fire(D)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=M;function z(B,R){return B(D=>R.fire(D))}e.forward=z;function U(B,R,D){return R(D),B(N=>R(N))}e.runAndSubscribe=U;class Z{constructor(R,D){this._observable=R,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new _n(N),D&&D.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,D){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,R){return new Z(B,R).emitter.event}e.fromObservable=Q;function G(B){return(R,D,N)=>{let E=0,$=!1,j={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),$&&($=!1,R.call(D)))},handlePossibleChange(){},handleChange(){$=!0}};B.addObserver(j),B.reportChanges();let q={dispose(){B.removeObserver(j)}};return N instanceof Zl?N.add(q):Array.isArray(N)&&N.push(q),q}}e.fromObservableLight=G})(Vr||={});var gy=class _y{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${_y._idPool++}`,_y.all.add(this)}start(t){this._stopWatch=new jB,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}}};gy.all=new Set,gy._idPool=0;var OB=gy,DB=-1,IA=class BA{constructor(t,n,i=(BA._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,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let f=new $B(d,o);this._errorHandler(f)}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}};IA._idPool=1;var IB=IA,BB=class $A{constructor(t){this.value=t}static create(){let t=new Error;return new $A(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
+
`).slice(2).join(`
|
|
23
|
+
`))}},$B=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},PB=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},zB=0,R_=class{constructor(t){this.value=t,this.id=zB++}},HB=2,FB,_n=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new IB(t?.onListenerError??T_,this._options?.leakWarningThreshold??DB):void 0,this._perfMon=this._options?._profName?new OB(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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new PB(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||T_)(p),Js.None}if(this._disposed)return Js.None;n&&(t=t.bind(n));let r=new R_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=BB.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof R_?(this._deliveryQueue??=new UB,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=Ri(()=>{o?.(),this._removeListener(r)});return i instanceof Zl?i.add(u):Array.isArray(i)&&i.push(u),u},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*HB<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]: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 R_)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}},UB=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}},lk={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}},gu=2,_u,Oa=class Il{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new ok,this._cacheMapCombined=new ok,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ul,this._textureSize=512,this._onAddTextureAtlasCanvas=new _n,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _n,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=PA(t,this._config.deviceCellWidth*4+gu*2,this._config.deviceCellHeight+gu*2),this._tmpCtx=qn(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 LB;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(Il.maxAtlasPages&&this._pages.length>=Math.max(4,Il.maxAtlasPages)){let n=this._pages.filter(p=>p.canvas.width*2<=(Il.maxTextureSize||4096)).sort((p,m)=>m.canvas.width!==p.canvas.width?m.canvas.width-p.canvas.width:m.percentageUsed-p.percentageUsed),i=-1,r=0;for(let p=0;p<n.length;p++)if(n[p].canvas.width!==r)i=p,r=n[p].canvas.width;else if(p-i===3)break;let o=n.slice(i,i+4),u=o.map(p=>p.glyphs[0].texturePage).sort((p,m)=>p>m?1:-1),d=this.pages.length-o.length,f=this._mergePages(o,d);f.version++;for(let p=u.length-1;p>=0;p--)this._deletePage(u[p]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new N_(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 N_(this._document,i,t);for(let[o,u]of t.entries()){let d=o*u.canvas.width%i,f=Math.floor(o/2)*u.canvas.height;r.ctx.drawImage(u.canvas,d,f);for(let m of u.glyphs)m.texturePage=n,m.sizeClipSpace.x=m.size.x/i,m.sizeClipSpace.y=m.size.y/i,m.texturePosition.x+=d,m.texturePosition.y+=f,m.texturePositionClipSpace.x=m.texturePosition.x/i,m.texturePositionClipSpace.y=m.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let p=this._activePages.indexOf(u);p!==-1&&this._activePages.splice(p,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,u){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,u)}getRasterizedGlyph(t,n,i,r,o,u){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,u)}_getFromCacheMap(t,n,i,r,o,u,d){return _u=t.get(n,i,r,o),_u||(_u=this._drawToCache(n,i,r,o,u,d),t.set(n,i,r,o,_u)),_u}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Ns;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let u=Ul.toColorRGB(n);o=Oi.toColor(u[0],u[1],u[2]);break;default:i?o=Pu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Pu.opaque(o)),o}_getForegroundColor(t,n,i,r,o,u,d,f,p,m){let _=this._getMinimumContrastColor(t,n,i,r,o,u,d,p,f,m);if(_)return _;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&u<8&&(u+=8),b=this._getColorFromAnsiIndex(u);break;case 50331648:let S=Ul.toColorRGB(u);b=Oi.toColor(S[0],S[1],S[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=Pu.opaque(b)),f&&(b=Pu.multiplyOpacity(b,bB)),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,u,d,f,p,m){if(this._config.minimumContrastRatio===1||m)return;let _=this._getContrastCache(p),b=_.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,d),w=this._resolveForegroundRgba(o,u,d,f),x=Oo.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(p?2:1));if(!x){_.setColor(t,r,null);return}let k=Oi.toColor(x>>24&255,x>>16&255,x>>8&255);return _.setColor(t,r,k),k}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,u){let d=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+gu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let p=Math.min(this._config.deviceCellHeight+gu*4,this._textureSize);if(this._tmpCanvas.height<p&&(this._tmpCanvas.height=p),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return lk;let m=!!this._workAttributeData.isBold(),_=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),O=this._workAttributeData.getFgColor(),P=this._workAttributeData.getFgColorMode(),F=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(_){let H=O;O=F,F=H;let A=P;P=T,T=A}let L=this._getBackgroundColor(T,F,_,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let M=m?this._config.fontWeightBold:this._config.fontWeight,z=S?"italic":"";this._tmpCtx.font=`${z} ${M} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=AA;let U=d.length===1&&N0(d.charCodeAt(0)),Z=d.length===1&&dB(d.charCodeAt(0)),Q=this._getForegroundColor(n,T,F,i,P,O,_,b,m,TA(d.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;let G=Z?0:gu*2,B=!1;this._config.customGlyphs!==!1&&(B=CB(this._tmpCtx,d,G,G,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let R=!U,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),A=H%2===1?.5:0;if(this._tmpCtx.lineWidth=H,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())R=!1,this._tmpCtx.strokeStyle=`rgb(${Ul.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{R=!1;let we=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&we<8&&(we+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(we).css}this._tmpCtx.beginPath();let Y=G,J=Math.ceil(G+this._config.deviceCharHeight)-A-(o?H*2:0),he=J+H,de=J+H*2,ae=this._workAttributeData.getUnderlineVariantOffset();for(let we=0;we<D;we++){this._tmpCtx.save();let je=Y+we*this._config.deviceCellWidth,De=Y+(we+1)*this._config.deviceCellWidth,We=je+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(je,J),this._tmpCtx.lineTo(De,J),this._tmpCtx.moveTo(je,de),this._tmpCtx.lineTo(De,de);break;case 3:let ke=H<=1?de:Math.ceil(G+this._config.deviceCharHeight-H/2)-A,Le=H<=1?J:Math.ceil(G+this._config.deviceCharHeight+H/2)-A,Ae=new Path2D;Ae.rect(je,J,this._config.deviceCellWidth,de-J),this._tmpCtx.clip(Ae),this._tmpCtx.moveTo(je-this._config.deviceCellWidth/2,he),this._tmpCtx.bezierCurveTo(je-this._config.deviceCellWidth/2,Le,je,Le,je,he),this._tmpCtx.bezierCurveTo(je,ke,We,ke,We,he),this._tmpCtx.bezierCurveTo(We,Le,De,Le,De,he),this._tmpCtx.bezierCurveTo(De,ke,De+this._config.deviceCellWidth/2,ke,De+this._config.deviceCellWidth/2,he);break;case 4:let Me=ae===0?0:ae>=H?H*2-ae:H-ae;ae>=H||Me===0?(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(je+Me,J),this._tmpCtx.lineTo(De,J)):(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(je,J),this._tmpCtx.lineTo(je+Me,J),this._tmpCtx.moveTo(je+Me+H,J),this._tmpCtx.lineTo(De,J)),ae=vB(De-je,H,ae);break;case 5:let et=.6,dt=.3,Je=De-je,oe=Math.floor(et*Je),qe=Math.floor(dt*Je),Ye=Je-oe-qe;this._tmpCtx.setLineDash([oe,qe,Ye]),this._tmpCtx.moveTo(je,J),this._tmpCtx.lineTo(De,J);break;default:this._tmpCtx.moveTo(je,J),this._tmpCtx.lineTo(De,J);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!B&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let we=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in we&&we.actualBoundingBoxDescent>0){this._tmpCtx.save();let je=new Path2D;je.rect(Y,J-Math.ceil(H/2),this._config.deviceCellWidth*D,de-J+Math.ceil(H/2)),this._tmpCtx.clip(je),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(d,G,G+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),A=H%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+A),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*D,G+A),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,G,G+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let H=L_(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,R);if(H)for(let A=1;A<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,G,G+this._config.deviceCharHeight-A),H=L_(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,R),!!H);A++);}if(x){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),A=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+Math.floor(this._config.deviceCharHeight/2)-A),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*D,G+Math.floor(this._config.deviceCharHeight/2)-A),this._tmpCtx.stroke()}this._tmpCtx.restore();let N=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),E;if(this._config.allowTransparency?E=WB(N):E=L_(N,L,Q,R),E)return lk;let $=this._findGlyphBoundingBox(N,this._workBoundingBox,f,Z,B,G),j,q;for(;;){if(this._activePages.length===0){let H=this._createNewPage();j=H,q=H.currentRow,q.height=$.size.y;break}j=this._activePages[this._activePages.length-1],q=j.currentRow;for(let H of this._activePages)$.size.y<=H.currentRow.height&&(j=H,q=H.currentRow);for(let H=this._activePages.length-1;H>=0;H--)for(let A of this._activePages[H].fixedRows)A.height<=q.height&&$.size.y<=A.height&&(j=this._activePages[H],q=A);if($.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new N_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),j=this._overflowSizePage,q=this._overflowSizePage.currentRow,q.x+$.size.x>=j.canvas.width&&(q.x=0,q.y+=q.height,q.height=0);break}if(q.y+$.size.y>=j.canvas.height||q.height>$.size.y+2){let H=!1;if(j.currentRow.y+j.currentRow.height+$.size.y>=j.canvas.height){let A;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+$.size.y<Y.canvas.height){A=Y;break}if(A)j=A;else if(Il.maxAtlasPages&&this._pages.length>=Il.maxAtlasPages&&q.y+$.size.y<=j.canvas.height&&q.height>=$.size.y&&q.x+$.size.x<=j.canvas.width)H=!0;else{let Y=this._createNewPage();j=Y,q=Y.currentRow,q.height=$.size.y,H=!0}}H||(j.currentRow.height>0&&j.fixedRows.push(j.currentRow),q={x:0,y:j.currentRow.y+j.currentRow.height,height:$.size.y},j.fixedRows.push(q),j.currentRow={x:0,y:q.y+q.height,height:0})}if(q.x+$.size.x<=j.canvas.width)break;q===j.currentRow?(q.x=0,q.y+=q.height,q.height=0):j.fixedRows.splice(j.fixedRows.indexOf(q),1)}return $.texturePage=this._pages.indexOf(j),$.texturePosition.x=q.x,$.texturePosition.y=q.y,$.texturePositionClipSpace.x=q.x/j.canvas.width,$.texturePositionClipSpace.y=q.y/j.canvas.height,$.sizeClipSpace.x/=j.canvas.width,$.sizeClipSpace.y/=j.canvas.height,q.height=Math.max(q.height,$.size.y),q.x+=$.size.x,j.ctx.putImageData(N,$.texturePosition.x-this._workBoundingBox.left,$.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,$.size.x,$.size.y),j.addGlyph($),j.version++,$}_findGlyphBoundingBox(t,n,i,r,o,u){n.top=0;let d=r?this._config.deviceCellHeight:this._tmpCanvas.height,f=r?this._config.deviceCellWidth:i,p=!1;for(let m=0;m<d;m++){for(let _=0;_<f;_++){let b=m*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.top=m,p=!0;break}}if(p)break}n.left=0,p=!1;for(let m=0;m<u+f;m++){for(let _=0;_<d;_++){let b=_*this._tmpCanvas.width*4+m*4+3;if(t.data[b]!==0){n.left=m,p=!0;break}}if(p)break}n.right=f,p=!1;for(let m=u+f-1;m>=u;m--){for(let _=0;_<d;_++){let b=_*this._tmpCanvas.width*4+m*4+3;if(t.data[b]!==0){n.right=m,p=!0;break}}if(p)break}n.bottom=d,p=!1;for(let m=d-1;m>=0;m--){for(let _=0;_<f;_++){let b=m*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.bottom=m,p=!0;break}}if(p)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+u+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+u+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},N_=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=PA(t,n,n),this.ctx=qn(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 L_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,d=n.rgba>>>24,f=n.rgba>>>16&255,p=n.rgba>>>8&255,m=Math.floor((Math.abs(r-d)+Math.abs(o-f)+Math.abs(u-p))/12),_=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===u||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-u)<m?e.data[b+3]=0:_=!1;return _}function WB(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function PA(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function qB(e,t,n,i,r,o,u,d){let f={foreground:o.foreground,background:o.background,cursor:Ns,cursorAccent:Ns,selectionForeground:Ns,selectionBackgroundTransparent:Ns,selectionBackgroundOpaque:Ns,selectionInactiveBackgroundTransparent:Ns,selectionInactiveBackgroundOpaque:Ns,overviewRulerBorder:Ns,scrollbarSliderBackground:Ns,scrollbarSliderHoverBackground:Ns,scrollbarSliderActiveBackground:Ns,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:u,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:f}}function ck(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 GB(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ds=[];function zA(e,t,n,i,r,o,u,d,f){let p=qB(i,r,o,u,t,n,d,f);for(let b=0;b<Ds.length;b++){let S=Ds[b],w=S.ownedBy.indexOf(e);if(w>=0){if(ck(S.config,p))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Ds.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<Ds.length;b++){let S=Ds[b];if(ck(S.config,p))return S.ownedBy.push(e),S.atlas}let m=e._core,_={atlas:new Oa(document,p,m.unicodeService),config:p,ownedBy:[e]};return Ds.push(_),_.atlas}function uk(e){for(let t=0;t<Ds.length;t++){let n=Ds[t].ownedBy.indexOf(e);if(n!==-1){Ds[t].ownedBy.length===1?(Ds[t].atlas.dispose(),Ds.splice(t,1)):Ds[t].ownedBy.splice(n,1);break}}}var Yd=600,KB=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=Yd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Yd-(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=Yd-(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})},Yd)},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 hk(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(f=>f.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let u=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;u>0&&d>0&&n(u,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ri(()=>i?.disconnect())}function VB(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var dk=class HA extends Ul{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new jA,this.combinedData=""}static fromCharData(t){let n=new HA;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?VB(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()]}},FA=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function UA(e,t,n){let i=qn(e.createProgram());if(e.attachShader(i,qn(fk(e,e.VERTEX_SHADER,t))),e.attachShader(i,qn(fk(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 fk(e,t,n){let i=qn(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 YB(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 XB=class{constructor(t){this.texture=t,this.version=-1}},ZB=`#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 JB(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 Da=11,Tl=Da*Float32Array.BYTES_PER_ELEMENT,QB=2,An=0,mn,M_=0,vu=0,e$=class extends Js{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;Oa.maxAtlasPages===void 0&&(Oa.maxAtlasPages=Math.min(32,qn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Oa.maxTextureSize=qn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=qn(UA(o,ZB,JB(Oa.maxAtlasPages))),this._register(Ri(()=>o.deleteProgram(this._program))),this._projectionLocation=qn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=qn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=qn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(p))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p),o.bufferData(o.ELEMENT_ARRAY_BUFFER,f,o.STATIC_DRAW),this._attributesBuffer=qn(o.createBuffer()),this._register(Ri(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Tl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Tl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Tl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Tl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Tl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Tl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let m=new Int32Array(Oa.maxAtlasPages);for(let _=0;_<Oa.maxAtlasPages;_++)m[_]=_;o.uniform1iv(this._textureLocation,m),o.uniformMatrix4fv(this._projectionLocation,!1,FA),this._atlasTextures=[];for(let _=0;_<Oa.maxAtlasPages;_++){let b=new XB(qn(o.createTexture()));this._register(Ri(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+_),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,u,d,f,p){this._updateCell(this._vertices.attributes,t,n,i,r,o,u,d,f,p)}_updateCell(t,n,i,r,o,u,d,f,p,m){if(An=(i*this._terminal.cols+n)*Da,r===0||r===void 0){t.fill(0,An,An+Da-1-QB);return}this._atlas&&(f&&f.length>1?mn=this._atlas.getRasterizedGlyphCombinedChar(f,o,u,d,!1,this._terminal.element):mn=this._atlas.getRasterizedGlyph(r,o,u,d,!1,this._terminal.element),M_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==m&&mn.offset.x>M_?(vu=mn.offset.x-M_,t[An]=-(mn.offset.x-vu)+this._dimensions.device.char.left,t[An+1]=-mn.offset.y+this._dimensions.device.char.top,t[An+2]=(mn.size.x-vu)/this._dimensions.device.canvas.width,t[An+3]=mn.size.y/this._dimensions.device.canvas.height,t[An+4]=mn.texturePage,t[An+5]=mn.texturePositionClipSpace.x+vu/this._atlas.pages[mn.texturePage].canvas.width,t[An+6]=mn.texturePositionClipSpace.y,t[An+7]=mn.sizeClipSpace.x-vu/this._atlas.pages[mn.texturePage].canvas.width,t[An+8]=mn.sizeClipSpace.y):(t[An]=-mn.offset.x+this._dimensions.device.char.left,t[An+1]=-mn.offset.y+this._dimensions.device.char.top,t[An+2]=mn.size.x/this._dimensions.device.canvas.width,t[An+3]=mn.size.y/this._dimensions.device.canvas.height,t[An+4]=mn.texturePage,t[An+5]=mn.texturePositionClipSpace.x,t[An+6]=mn.texturePositionClipSpace.y,t[An+7]=mn.sizeClipSpace.x,t[An+8]=mn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&gB(r,p,mn.size.x,this._dimensions.device.cell.width)&&(t[An+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*Da;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+=Da}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 u=o*this._terminal.cols*Da,d=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*Da);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/Da)}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}},t$=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,u=n[1]-o,d=i[1]-o,f=Math.max(u,0),p=Math.min(d,t.rows-1);if(f>=t.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=u,this.viewportEndRow=d,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,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 n$(){return new t$}var ap=4,Rf=1,Nf=2,j_=3,i$=2147483648,s$=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=n$()}resize(t,n){let i=t*n*ap;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)}},r$=`#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
|
+
}`,a$=`#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
|
+
}`,Kr=8,O_=Kr*Float32Array.BYTES_PER_ELEMENT,o$=20*Kr,pk=class{constructor(){this.attributes=new Float32Array(o$),this.count=0}},Ur=0,mk=0,gk=0,_k=0,vk=0,yk=0,bk=0,l$=class extends Js{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new pk,this._verticesCursor=new pk;let r=this._gl;this._program=qn(UA(r,r$,a$)),this._register(Ri(()=>r.deleteProgram(this._program))),this._projectionLocation=qn(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]),u=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(u))),r.bindBuffer(r.ARRAY_BUFFER,u),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]),f=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(f))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,f),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=qn(r.createBuffer()),this._register(Ri(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,O_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,O_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,O_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(p=>{this._updateCachedColors(p),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,FA),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,u,d,f,p,m,_,b,S,w;for(r=0;r<t.rows;r++){for(u=-1,d=0,f=0,p=!1,o=0;o<t.cols;o++)m=(r*t.cols+o)*ap,_=e.cells[m+Rf],b=e.cells[m+Nf],S=!!(b&67108864),(_!==d||b!==f&&(p||S))&&((d!==0||p&&f!==0)&&(w=i++*Kr,this._updateRectangle(n,w,f,d,u,o,r)),u=o,d=_,f=b,p=S);(d!==0||p&&f!==0)&&(w=i++*Kr,this._updateRectangle(n,w,f,d,u,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++*Kr,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++*Kr,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++*Kr,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++*Kr,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,u){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Ur=(n&16777215)<<8;break;default:Ur=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Ur=(i&16777215)<<8;break;default:Ur=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=YB(e.attributes,this._terminal.rows*this._terminal.cols*Kr)),mk=r*this._dimensions.device.cell.width,gk=u*this._dimensions.device.cell.height,_k=(Ur>>24&255)/255,vk=(Ur>>16&255)/255,yk=(Ur>>8&255)/255,bk=1,this._addRectangle(e.attributes,t,mk,gk,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,_k,vk,yk,bk)}_addRectangle(e,t,n,i,r,o,u,d,f,p){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]=u,e[t+5]=d,e[t+6]=f,e[t+7]=p}_addRectangleFloat(e,t,n,i,r,o,u){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]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[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])}},c$=class extends Js{constructor(t,n,i,r,o,u,d,f){super(),this._container=n,this._alpha=o,this._coreBrowserService=u,this._optionsService=d,this._themeService=f,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(p=>{this._refreshCharAtlas(t,p),this.reset(t)})),this._register(Ri(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=qn(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=zA(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=AA,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}`}},u$=class extends c${constructor(t,n,i,r,o,u,d){super(i,t,"link",n,!0,o,u,d),this._register(r.onShowLinkUnderline(f=>this._handleShowLinkUnderline(f))),this._register(r.onHideLinkUnderline(f=>this._handleHideLinkUnderline(f)))}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&&GB(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()}},To=typeof window=="object"?window:globalThis,vy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _n,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _n,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}};vy.INSTANCE=new vy;var WA=vy;function h$(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}WA.INSTANCE.onDidChangeZoomLevel;WA.INSTANCE.onDidChangeFullscreen;var mc=typeof navigator=="object"?navigator.userAgent:"";mc.indexOf("Firefox")>=0;mc.indexOf("AppleWebKit")>=0;var d$=mc.indexOf("Chrome")>=0;!d$&&mc.indexOf("Safari")>=0;mc.indexOf("Electron/")>=0;mc.indexOf("Android")>=0;var D_=!1;if(typeof To.matchMedia=="function"){let e=To.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=To.matchMedia("(display-mode: fullscreen)");D_=e.matches,h$(To,e,({matches:n})=>{D_&&t.matches||(D_=n)})}var Wl="en",I_=!1,qA=!1,Xd,Lf=Wl,Sk=Wl,f$,qr,Do=globalThis,hs;typeof Do.vscode<"u"&&typeof Do.vscode.process<"u"?hs=Do.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(hs=process);var p$=typeof hs?.versions?.electron=="string",m$=p$&&hs?.type==="renderer";if(typeof hs=="object"){hs.platform,hs.platform,I_=hs.platform==="linux",I_&&hs.env.SNAP&&hs.env.SNAP_REVISION,hs.env.CI||hs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xd=Wl,Lf=Wl;let e=hs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Xd=t.userLocale,Sk=t.osLocale,Lf=t.resolvedLanguage||Wl,f$=t.languagePack?.translationsConfigFile}catch{}qA=!0}else typeof navigator=="object"&&!m$?(qr=navigator.userAgent,qr.indexOf("Windows")>=0,qr.indexOf("Macintosh")>=0,(qr.indexOf("Macintosh")>=0||qr.indexOf("iPad")>=0||qr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,I_=qr.indexOf("Linux")>=0,qr?.indexOf("Mobi")>=0,Lf=globalThis._VSCODE_NLS_LANGUAGE||Wl,Xd=navigator.language.toLowerCase(),Sk=Xd):console.error("Unable to resolve platform.");var wk=qA,gr=qr,Aa=Lf,g$;(e=>{function t(){return Aa}e.value=t;function n(){return Aa.length===2?Aa==="en":Aa.length>=3?Aa[0]==="e"&&Aa[1]==="n"&&Aa[2]==="-":!1}e.isDefaultVariant=n;function i(){return Aa==="en"}e.isDefault=i})(g$||={});var _$=typeof Do.postMessage=="function"&&!Do.importScripts;(()=>{if(_$){let e=[];Do.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}),Do.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var v$=!!(gr&&gr.indexOf("Chrome")>=0);gr&&gr.indexOf("Firefox")>=0;!v$&&gr&&gr.indexOf("Safari")>=0;gr&&gr.indexOf("Edg/")>=0;gr&&gr.indexOf("Android")>=0;var Al=typeof navigator=="object"?navigator:{};wk||document.queryCommandSupported&&document.queryCommandSupported("copy")||Al&&Al.clipboard&&Al.clipboard.writeText,wk||Al&&Al.clipboard&&Al.clipboard.readText;var L0=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 L0,xk=new L0,Ck=new L0;new Array(230);var y$;(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 xk.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return Ck.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return xk.strToKeyCode(d)||Ck.strToKeyCode(d)}e.fromUserSettings=o;function u(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=u})(y$||={});var GA=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),b$;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof S$?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:GA})})(b$||={});var S$=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?GA:(this._emitter||(this._emitter=new _n),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},w$;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.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(u){o(u)}})}e.withAsyncBody=n})(w$||={});var kk=class Ls{static fromArray(t){return new Ls(n=>{n.emitMany(t)})}static fromPromise(t){return new Ls(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ls(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ls(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new _n,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 Vr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ls(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ls.map(this,t)}static filter(t,n){return new Ls(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ls.filter(this,t)}static coalesce(t){return Ls.filter(t,n=>!!n)}coalesce(){return Ls.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ls.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};kk.EMPTY=kk.fromArray([]);var{getWindow:x$}=(function(){let e=new Map,t={window:To,disposables:new Zl};e.set(To.vscodeWindowId,t);let n=new _n,i=new _n,r=new _n;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Js.None;let d=new Zl,f={window:u,disposables:d.add(new Zl)};return e.set(u.vscodeWindowId,f),d.add(Ri(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(yy(u,k$.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let d=u;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=u;return f?.view?f.view.window:To},getDocument(u){return x$(u).document}}})(),C$=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 yy(e,t,n,i){return new C$(e,t,n,i)}var k$={BEFORE_UNLOAD:"beforeunload"},E$=class extends Js{constructor(t,n,i,r,o,u,d,f,p){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=u,this._optionsService=d,this._themeService=f,this._cursorBlinkStateManager=new mu,this._charAtlasDisposable=this._register(new mu),this._observerDisposable=this._register(new mu),this._model=new s$,this._workCell=new dk,this._workCell2=new dk,this._rectangleRenderer=this._register(new mu),this._glyphRenderer=this._register(new mu),this._onChangeTextureAtlas=this._register(new _n),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new _n),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new _n),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new _n),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new _n),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let m={antialias:!1,depth:!1,preserveDrawingBuffer:p};if(this._gl=this._canvas.getContext("webgl2",m),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new yB(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new u$(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=_B(),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(yy(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(yy(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,uk(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=hk(this._canvas,this._coreBrowserService.window,(_,b)=>this._setCanvasDevicePixelDimensions(_,b)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=hk(this._canvas,_,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ri(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),uk(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 l$(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new e$(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=zA(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=xA(Vr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Vr.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 KB(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,u,d,f,p,m,_=0,b=!0,S,w,x,k,O,P,F,T,L;t=Ek(t,i.rows-1,0),n=Ek(n,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,U=z-i.buffer.ydisp,Z=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Q=-1,G=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(u=t;u<=n;u++)for(d=u+i.buffer.ydisp,f=i.buffer.lines.get(d),this._model.lineLengths[u]=0,x=z===d,_=0,p=this._characterJoinerService.getJoinedCharacters(d),T=0;T<i.cols;T++){if(o=this._cellColorResolver.result.bg,f.loadCell(T,r),T===0&&(o=this._cellColorResolver.result.bg),m=!1,b=T>=_,S=T,p.length>0&&T===p[0][0]&&b){w=p.shift();let R=this._model.selection.isCellSelected(this._terminal,w[0],d);for(F=w[0]+1;F<w[1];F++)b&&=R===this._model.selection.isCellSelected(this._terminal,F,d);b&&=!x||Z<w[0]||Z>=w[1],b?(m=!0,r=new T$(r,f.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):_=w[1]}if(k=r.getChars(),O=r.getCode(),F=(u*i.cols+T)*ap,this._cellColorResolver.resolve(r,T,d,this.dimensions.device.cell.width),G&&d===z&&(T===Z&&(this._model.cursor={x:Z,y:U,width:r.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Q=Z+r.getWidth()-1),T>=Z&&T<=Q&&(this._coreBrowserService.isFocused&&M==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),O!==0&&(this._model.lineLengths[u]=T+1),!(this._model.cells[F]===O&&this._model.cells[F+Rf]===this._cellColorResolver.result.bg&&this._model.cells[F+Nf]===this._cellColorResolver.result.fg&&this._model.cells[F+j_]===this._cellColorResolver.result.ext)&&(B=!0,k.length>1&&(O|=i$),this._model.cells[F]=O,this._model.cells[F+Rf]=this._cellColorResolver.result.bg,this._model.cells[F+Nf]=this._cellColorResolver.result.fg,this._model.cells[F+j_]=this._cellColorResolver.result.ext,P=r.getWidth(),this._glyphRenderer.value.updateCell(T,u,O,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,P,o),m)){for(r=this._workCell,T++;T<=S;T++)L=(u*i.cols+T)*ap,this._glyphRenderer.value.updateCell(T,u,0,0,0,0,uB,0,0),this._model.cells[L]=0,this._model.cells[L+Rf]=this._cellColorResolver.result.bg,this._model.cells[L+Nf]=this._cellColorResolver.result.fg,this._model.cells[L+j_]=this._cellColorResolver.result.ext;T--}}B&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},T$=class extends Ul{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 Ek(e,t,n=0){return Math.max(Math.min(e,t),n)}var Tk="di$target",Ak="di$dependencies",$_=new Map;function Sr(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");A$(t,n,r)};return t._id=e,$_.set(e,t),t}function A$(e,t,n){t[Tk]===t?t[Ak].push({id:e,index:n}):(t[Ak]=[{id:e,index:n}],t[Tk]=t)}Sr("BufferService");Sr("CoreMouseService");Sr("CoreService");Sr("CharsetService");Sr("InstantiationService");Sr("LogService");var R$=Sr("OptionsService");Sr("OscLinkService");Sr("UnicodeService");Sr("DecorationService");var N$={trace:0,debug:1,info:2,warn:3,error:4,off:5},L$="xterm.js: ",Rk=class extends Js{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=N$[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?"":L$)+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)}};Rk=J7([Q7(0,R$)],Rk);var M$=class extends Js{constructor(t){if(EA&&cB()<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 _n),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new _n),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new _n),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new _n),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,u=o._renderService,d=o._characterJoinerService,f=o._charSizeService,p=o._coreBrowserService,m=o._decorationService;o._logService;let _=o._themeService;this._renderer=this._register(new E$(t,d,f,p,i,m,r,_,this._preserveDrawingBuffer)),this._register(Vr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Vr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Vr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Vr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Ri(()=>{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 KA=Object.defineProperty,j$=Object.getOwnPropertyDescriptor,O$=(e,t)=>{for(var n in t)KA(e,n,{get:t[n],enumerable:!0})},jn=(e,t,n,i)=>{for(var r=i>1?void 0:i?j$(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=(i?u(t,n,r):u(r))||r);return i&&r&&KA(t,n,r),r},Pe=(e,t)=>(n,i)=>t(n,i,e),Nk="Terminal input",by={get:()=>Nk,set:e=>Nk=e},Lk="Too much output to announce, navigate to rows manually to read",Sy={get:()=>Lk,set:e=>Lk=e};function D$(e){return e.replace(/\r?\n/g,"\r")}function I$(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function B$(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function $$(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");VA(r,t,n,i)}}function VA(e,t,n,i){e=D$(e),e=I$(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function YA(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 Mk(e,t,n,i,r){YA(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Ba(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Fp(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 P$=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 u=e.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=n)return this._interim=u,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(u-55296)*1024+d-56320+65536:(t[i++]=u,t[i++]=d);continue}u!==65279&&(t[i++]=u)}return i}},z$=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,u,d,f=0,p=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,x;for(;(x=this.interim[++w]&63)&&w<4;)S<<=6,S|=x;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,O=k-w;for(;p<O;){if(p>=n)return 0;if(x=e[p++],(x&192)!==128){p--,b=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}b||(k===2?S<128?p--:t[i++]=S:k===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let m=n-4,_=p;for(;_<n;){for(;_<m&&!((r=e[_])&128)&&!((o=e[_+1])&128)&&!((u=e[_+2])&128)&&!((d=e[_+3])&128);)t[i++]=r,t[i++]=o,t[i++]=u,t[i++]=d,_+=4;if(r=e[_++],r<128)t[i++]=r;else if((r&224)===192){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(f=(r&31)<<6|o&63,f<128){_--;continue}t[i++]=f}else if((r&240)===224){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(f=(r&15)<<12|(o&63)<<6|u&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[i++]=f}else if((r&248)===240){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=u,i;if(d=e[_++],(d&192)!==128){_--;continue}if(f=(r&7)<<18|(o&63)<<12|(u&63)<<6|d&63,f<65536||f>1114111)continue;t[i++]=f}}return i}},XA="",Ha=" ",Eh=class ZA{constructor(){this.fg=0,this.bg=0,this.extended=new op}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 ZA;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}},op=class JA{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 JA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Is=class QA extends Eh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new op,this.combinedData=""}static fromCharData(t){let n=new QA;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?Ba(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()]}},jk="di$target",wy="di$dependencies",P_=new Map;function H$(e){return e[wy]||[]}function fi(e){if(P_.has(e))return P_.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");F$(t,n,r)};return t._id=e,P_.set(e,t),t}function F$(e,t,n){t[jk]===t?t[wy].push({id:e,index:n}):(t[wy]=[{id:e,index:n}],t[jk]=t)}var Pi=fi("BufferService"),eR=fi("CoreMouseService"),Go=fi("CoreService"),U$=fi("CharsetService"),M0=fi("InstantiationService"),tR=fi("LogService"),zi=fi("OptionsService"),nR=fi("OscLinkService"),W$=fi("UnicodeService"),Th=fi("DecorationService"),xy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Is,u=n.getTrimmedLength(),d=-1,f=-1,p=!1;for(let m=0;m<u;m++)if(!(f===-1&&!n.hasContent(m))){if(n.loadCell(m,o),o.hasExtendedAttrs()&&o.extended.urlId)if(f===-1){f=m,d=o.extended.urlId;continue}else p=o.extended.urlId!==d;else f!==-1&&(p=!0);if(p||f!==-1&&m===u-1){let _=this._oscLinkService.getLinkData(d)?.uri;if(_){let b={start:{x:f+1,y:e},end:{x:m+(!p&&m===u-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(_);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:_,range:b,activate:(w,x)=>r?r.activate(w,x,b):q$(w,x),hover:(w,x)=>r?.hover?.(w,x,b),leave:(w,x)=>r?.leave?.(w,x,b)})}p=!1,o.hasExtendedAttrs()&&o.extended.urlId?(f=m,d=o.extended.urlId):(f=-1,d=-1)}}t(i)}};xy=jn([Pe(0,Pi),Pe(1,zi),Pe(2,nR)],xy);function q$(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 Up=fi("CharSizeService"),Qr=fi("CoreBrowserService"),j0=fi("MouseService"),ea=fi("RenderService"),G$=fi("SelectionService"),iR=fi("CharacterJoinerService"),gc=fi("ThemeService"),sR=fi("LinkProviderService"),K$=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ok.isErrorNoTelemetry(e)?new Ok(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)}},V$=new K$;function Mf(e){Y$(e)||V$.onUnexpectedError(e)}var Cy="Canceled";function Y$(e){return e instanceof X$?!0:e instanceof Error&&e.name===Cy&&e.message===Cy}var X$=class extends Error{constructor(){super(Cy),this.name=this.message}};function Z$(e){return new Error(`Illegal argument: ${e}`)}var Ok=class ky extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ky)return t;let n=new ky;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ey=class rR extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,rR.prototype)}};function cs(e,t=0){return e[e.length-(1+t)]}var J$;(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})(J$||={});function Q$(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var aR;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function u(T){return T||n}e.from=u;function*d(T){for(let L=T.length-1;L>=0;L--)yield T[L]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function m(T,L){let M=0;for(let z of T)if(L(z,M++))return!0;return!1}e.some=m;function _(T,L){for(let M of T)if(L(M))return M}e.find=_;function*b(T,L){for(let M of T)L(M)&&(yield M)}e.filter=b;function*S(T,L){let M=0;for(let z of T)yield L(z,M++)}e.map=S;function*w(T,L){let M=0;for(let z of T)yield*L(z,M++)}e.flatMap=w;function*x(...T){for(let L of T)yield*L}e.concat=x;function k(T,L,M){let z=M;for(let U of T)z=L(z,U);return z}e.reduce=k;function*O(T,L,M=T.length){for(L<0&&(L+=T.length),M<0?M+=T.length:M>T.length&&(M=T.length);L<M;L++)yield T[L]}e.slice=O;function P(T,L=Number.POSITIVE_INFINITY){let M=[];if(L===0)return[M,T];let z=T[Symbol.iterator]();for(let U=0;U<L;U++){let Z=z.next();if(Z.done)return[M,e.empty()];M.push(Z.value)}return[M,{[Symbol.iterator](){return z}}]}e.consume=P;async function F(T){let L=[];for await(let M of T)L.push(M);return Promise.resolve(L)}e.asyncToArray=F})(aR||={});function Ho(e){if(aR.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 eP(...e){return wn(()=>Ho(e))}function wn(e){return{dispose:Q$(()=>{e()})}}var oR=class lR{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{Ho(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?lR.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)}};oR.DISABLE_DISPOSED_WARNING=!1;var Wa=oR,xt=class{constructor(){this._store=new Wa,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)}};xt.None=Object.freeze({dispose(){}});var lc=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}},Yr=typeof window=="object"?window:globalThis,Ty=class Ay{constructor(t){this.element=t,this.next=Ay.Undefined,this.prev=Ay.Undefined}};Ty.Undefined=new Ty(void 0);var Cn=Ty,Dk=class{constructor(){this._first=Cn.Undefined,this._last=Cn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Cn.Undefined}clear(){let e=this._first;for(;e!==Cn.Undefined;){let t=e.next;e.prev=Cn.Undefined,e.next=Cn.Undefined,e=t}this._first=Cn.Undefined,this._last=Cn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Cn(e);if(this._first===Cn.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!==Cn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Cn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Cn.Undefined&&e.next!==Cn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Cn.Undefined&&e.next===Cn.Undefined?(this._first=Cn.Undefined,this._last=Cn.Undefined):e.next===Cn.Undefined?(this._last=this._last.prev,this._last.next=Cn.Undefined):e.prev===Cn.Undefined&&(this._first=this._first.next,this._first.prev=Cn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Cn.Undefined;)yield e.element,e=e.next}},tP=globalThis.performance&&typeof globalThis.performance.now=="function",nP=class cR{static create(t){return new cR(t)}constructor(t){this._now=tP&&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}},wi;(e=>{e.None=()=>xt.None;function t(B,R){return _(B,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function n(B){return(R,D=null,N)=>{let E=!1,$;return $=B(j=>{if(!E)return $?$.dispose():E=!0,R.call(D,j)},null,N),E&&$.dispose(),$}}e.once=n;function i(B,R,D){return p((N,E=null,$)=>B(j=>N.call(E,R(j)),null,$),D)}e.map=i;function r(B,R,D){return p((N,E=null,$)=>B(j=>{R(j),N.call(E,j)},null,$),D)}e.forEach=r;function o(B,R,D){return p((N,E=null,$)=>B(j=>R(j)&&N.call(E,j),null,$),D)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(R,D=null,N)=>{let E=eP(...B.map($=>$(j=>R.call(D,j))));return m(E,N)}}e.any=d;function f(B,R,D,N){let E=D;return i(B,$=>(E=R(E,$),E),N)}e.reduce=f;function p(B,R){let D,N={onWillAddFirstListener(){D=B(E.fire,E)},onDidRemoveLastListener(){D?.dispose()}},E=new Te(N);return R?.add(E),E.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function _(B,R,D=100,N=!1,E=!1,$,j){let q,H,A,Y=0,J,he={leakWarningThreshold:$,onWillAddFirstListener(){q=B(ae=>{Y++,H=R(H,ae),N&&!A&&(de.fire(H),H=void 0),J=()=>{let we=H;H=void 0,A=void 0,(!N||Y>1)&&de.fire(we),Y=0},typeof D=="number"?(clearTimeout(A),A=setTimeout(J,D)):A===void 0&&(A=0,queueMicrotask(J))})},onWillRemoveListener(){E&&Y>0&&J?.()},onDidRemoveLastListener(){J=void 0,q.dispose()}},de=new Te(he);return j?.add(de),de.event}e.debounce=_;function b(B,R=0,D){return e.debounce(B,(N,E)=>N?(N.push(E),N):[E],R,void 0,!0,void 0,D)}e.accumulate=b;function S(B,R=(N,E)=>N===E,D){let N=!0,E;return o(B,$=>{let j=N||!R($,E);return N=!1,E=$,j},D)}e.latch=S;function w(B,R,D){return[e.filter(B,R,D),e.filter(B,N=>!R(N),D)]}e.split=w;function x(B,R=!1,D=[],N){let E=D.slice(),$=B(H=>{E?E.push(H):q.fire(H)});N&&N.add($);let j=()=>{E?.forEach(H=>q.fire(H)),E=null},q=new Te({onWillAddFirstListener(){$||($=B(H=>q.fire(H)),N&&N.add($))},onDidAddFirstListener(){E&&(R?setTimeout(j):j())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return N&&N.add(q),q.event}e.buffer=x;function k(B,R){return(D,N,E)=>{let $=R(new P);return B(function(j){let q=$.evaluate(j);q!==O&&D.call(N,q)},void 0,E)}}e.chain=k;let O=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(D=>(R(D),D)),this}filter(R){return this.steps.push(D=>R(D)?D:O),this}reduce(R,D){let N=D;return this.steps.push(E=>(N=R(N,E),N)),this}latch(R=(D,N)=>D===N){let D=!0,N;return this.steps.push(E=>{let $=D||!R(E,N);return D=!1,N=E,$?E:O}),this}evaluate(R){for(let D of this.steps)if(R=D(R),R===O)break;return R}}function F(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.on(R,N),$=()=>B.removeListener(R,N),j=new Te({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromNodeEventEmitter=F;function T(B,R,D=N=>N){let N=(...q)=>j.fire(D(...q)),E=()=>B.addEventListener(R,N),$=()=>B.removeEventListener(R,N),j=new Te({onWillAddFirstListener:E,onDidRemoveLastListener:$});return j.event}e.fromDOMEventEmitter=T;function L(B){return new Promise(R=>n(B)(R))}e.toPromise=L;function M(B){let R=new Te;return B.then(D=>{R.fire(D)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=M;function z(B,R){return B(D=>R.fire(D))}e.forward=z;function U(B,R,D){return R(D),B(N=>R(N))}e.runAndSubscribe=U;class Z{constructor(R,D){this._observable=R,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new Te(N),D&&D.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,D){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,R){return new Z(B,R).emitter.event}e.fromObservable=Q;function G(B){return(R,D,N)=>{let E=0,$=!1,j={beginUpdate(){E++},endUpdate(){E--,E===0&&(B.reportChanges(),$&&($=!1,R.call(D)))},handlePossibleChange(){},handleChange(){$=!0}};B.addObserver(j),B.reportChanges();let q={dispose(){B.removeObserver(j)}};return N instanceof Wa?N.add(q):Array.isArray(N)&&N.push(q),q}}e.fromObservableLight=G})(wi||={});var Ry=class Ny{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ny._idPool++}`,Ny.all.add(this)}start(t){this._stopWatch=new nP,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}}};Ry.all=new Set,Ry._idPool=0;var iP=Ry,sP=-1,uR=class hR{constructor(t,n,i=(hR._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,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let f=new oP(d,o);this._errorHandler(f)}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}};uR._idPool=1;var rP=uR,aP=class dR{constructor(t){this.value=t}static create(){let t=new Error;return new dR(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
+
`).slice(2).join(`
|
|
88
|
+
`))}},oP=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},lP=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},cP=0,z_=class{constructor(e){this.value=e,this.id=cP++}},uP=2,hP,Te=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new rP(t?.onListenerError??Mf,this._options?.leakWarningThreshold??sP):void 0,this._perfMon=this._options?._profName?new iP(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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new lP(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Mf)(p),xt.None}if(this._disposed)return xt.None;n&&(t=t.bind(n));let r=new z_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=aP.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof z_?(this._deliveryQueue??=new dP,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=wn(()=>{o?.(),this._removeListener(r)});return i instanceof Wa?i.add(u):Array.isArray(i)&&i.push(u),u},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*uP<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]: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||Mf;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 z_)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}},dP=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}},Ly=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Te,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}};Ly.INSTANCE=new Ly;var O0=Ly;function fP(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}O0.INSTANCE.onDidChangeZoomLevel;function pP(e){return O0.INSTANCE.getZoomFactor(e)}O0.INSTANCE.onDidChangeFullscreen;var _c=typeof navigator=="object"?navigator.userAgent:"",My=_c.indexOf("Firefox")>=0,mP=_c.indexOf("AppleWebKit")>=0,D0=_c.indexOf("Chrome")>=0,gP=!D0&&_c.indexOf("Safari")>=0;_c.indexOf("Electron/")>=0;_c.indexOf("Android")>=0;var H_=!1;if(typeof Yr.matchMedia=="function"){let e=Yr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Yr.matchMedia("(display-mode: fullscreen)");H_=e.matches,fP(Yr,e,({matches:n})=>{H_&&t.matches||(H_=n)})}var ql="en",jy=!1,Oy=!1,jf=!1,fR=!1,Zd,Of=ql,Ik=ql,_P,Gr,Io=globalThis,ds;typeof Io.vscode<"u"&&typeof Io.vscode.process<"u"?ds=Io.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ds=process);var vP=typeof ds?.versions?.electron=="string",yP=vP&&ds?.type==="renderer";if(typeof ds=="object"){jy=ds.platform==="win32",Oy=ds.platform==="darwin",jf=ds.platform==="linux",jf&&ds.env.SNAP&&ds.env.SNAP_REVISION,ds.env.CI||ds.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zd=ql,Of=ql;let e=ds.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zd=t.userLocale,Ik=t.osLocale,Of=t.resolvedLanguage||ql,_P=t.languagePack?.translationsConfigFile}catch{}fR=!0}else typeof navigator=="object"&&!yP?(Gr=navigator.userAgent,jy=Gr.indexOf("Windows")>=0,Oy=Gr.indexOf("Macintosh")>=0,(Gr.indexOf("Macintosh")>=0||Gr.indexOf("iPad")>=0||Gr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,jf=Gr.indexOf("Linux")>=0,Gr?.indexOf("Mobi")>=0,Of=globalThis._VSCODE_NLS_LANGUAGE||ql,Zd=navigator.language.toLowerCase(),Ik=Zd):console.error("Unable to resolve platform.");var pR=jy,fr=Oy,bP=jf,Bk=fR,_r=Gr,Ra=Of,SP;(e=>{function t(){return Ra}e.value=t;function n(){return Ra.length===2?Ra==="en":Ra.length>=3?Ra[0]==="e"&&Ra[1]==="n"&&Ra[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ra==="en"}e.isDefault=i})(SP||={});var wP=typeof Io.postMessage=="function"&&!Io.importScripts;(()=>{if(wP){let e=[];Io.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}),Io.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var xP=!!(_r&&_r.indexOf("Chrome")>=0);_r&&_r.indexOf("Firefox")>=0;!xP&&_r&&_r.indexOf("Safari")>=0;_r&&_r.indexOf("Edg/")>=0;_r&&_r.indexOf("Android")>=0;var Rl=typeof navigator=="object"?navigator:{};Bk||document.queryCommandSupported&&document.queryCommandSupported("copy")||Rl&&Rl.clipboard&&Rl.clipboard.writeText,Bk||Rl&&Rl.clipboard&&Rl.clipboard.readText;var I0=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}},F_=new I0,$k=new I0,Pk=new I0,CP=new Array(230),mR;(e=>{function t(d){return F_.keyCodeToStr(d)}e.toString=t;function n(d){return F_.strToKeyCode(d)}e.fromString=n;function i(d){return $k.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return Pk.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return $k.strToKeyCode(d)||Pk.strToKeyCode(d)}e.fromUserSettings=o;function u(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 F_.keyCodeToStr(d)}e.toElectronAccelerator=u})(mR||={});var kP=class gR{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 gR&&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 EP([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},EP=class{constructor(e){if(e.length===0)throw Z$("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 TP(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return mR.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(My)switch(t){case 59:return 85;case 60:if(bP)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fr)return 57;break}else if(mP&&(fr&&t===93||!fr&&t===92))return 57;return CP[t]||0}var AP=fr?256:2048,RP=512,NP=1024,LP=fr?2048:256,zk=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=TP(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|=AP),this.altKey&&(t|=RP),this.shiftKey&&(t|=NP),this.metaKey&&(t|=LP),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new kP(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Hk=new WeakMap;function MP(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 jP=class{static getSameOriginWindowChain(e){let t=Hk.get(e);if(!t){t=[],Hk.set(e,t);let n=e,i;do i=MP(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 u=o.window.deref();if(n+=u?.scrollY??0,i+=u?.scrollX??0,u===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();n+=d.top,i+=d.left}return{top:n,left:i}}},Jd=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=jP.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Fk=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(D0){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,u=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*u):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?My&&!fr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")gP&&pR?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*u):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?My&&!fr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},_R=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),OP;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof DP?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_R})})(OP||={});var DP=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?_R:(this._emitter||(this._emitter=new Te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},B0=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 Ey("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Ey("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},IP=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 Ey("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=wn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},BP;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.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(u){o(u)}})}e.withAsyncBody=n})(BP||={});var Uk=class Ms{static fromArray(t){return new Ms(n=>{n.emitMany(t)})}static fromPromise(t){return new Ms(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ms(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ms(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Te,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 wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ms(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ms.map(this,t)}static filter(t,n){return new Ms(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ms.filter(this,t)}static coalesce(t){return Ms.filter(t,n=>!!n)}coalesce(){return Ms.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ms.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Uk.EMPTY=Uk.fromArray([]);var{getWindow:dr,getWindowId:$P,onDidRegisterWindow:PP}=(function(){let e=new Map,t={window:Yr,disposables:new Wa};e.set(Yr.vscodeWindowId,t);let n=new Te,i=new Te,r=new Te;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return xt.None;let d=new Wa,f={window:u,disposables:d.add(new Wa)};return e.set(u.vscodeWindowId,f),d.add(wn(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(ht(u,si.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let d=u;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=u;return f?.view?f.view.window:Yr},getDocument(u){return dr(u).document}}})(),zP=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 ht(e,t,n,i){return new zP(e,t,n,i)}var Wk=function(e,t,n,i){return ht(e,t,n,i)},$0,HP=class extends IP{constructor(e){super(),this.defaultTarget=e&&dr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},qk=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){Mf(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 u=e.get(o)??[];for(t.set(o,u),e.set(o,[]),i.set(o,!0);u.length>0;)u.sort(qk.sort),u.shift().execute();i.set(o,!1)};$0=(o,u,d=0)=>{let f=$P(o),p=new qk(u,d),m=e.get(f);return m||(m=[],e.set(f,m)),m.push(p),n.get(f)||(n.set(f,!0),o.requestAnimationFrame(()=>r(f))),p}})();function FP(e){let t=e.getBoundingClientRect(),n=dr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var si={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"},UP=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=Xi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Xi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Xi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Xi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Xi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Xi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Xi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Xi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Xi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Xi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Xi(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=Xi(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=Xi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Xi(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 Xi(e){return typeof e=="number"?`${e}px`:e}function eh(e){return new UP(e)}var vR=class{constructor(){this._hooks=new Wa,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(wn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=dr(e)}this._hooks.add(ht(o,si.POINTER_MOVE,u=>{if(u.buttons!==n){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(ht(o,si.POINTER_UP,u=>this.stopMonitoring(!0)))}};function WP(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(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,u)}),this[o]}}var lr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(lr||={});var zu=class Ti extends xt{constructor(){super(),this.dispatched=!1,this.targets=new Dk,this.ignoreTargets=new Dk,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(wi.runAndSubscribe(PP,({window:t,disposables:n})=>{n.add(ht(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(ht(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(ht(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Yr,disposables:this._store}))}static addTarget(t){if(!Ti.isTouchDevice())return xt.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.targets.push(t);return wn(n)}static ignoreTarget(t){if(!Ti.isTouchDevice())return xt.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.ignoreTargets.push(t);return wn(n)}static isTouchDevice(){return"ontouchstart"in Yr||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 u=this.newGestureEvent(lr.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}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,u=n.changedTouches.length;o<u;o++){let d=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let f=this.activeTouches[d.identifier],p=Date.now()-f.initialTimeStamp;if(p<Ti.HOLD_DELAY&&Math.abs(f.initialPageX-cs(f.rollingPageX))<30&&Math.abs(f.initialPageY-cs(f.rollingPageY))<30){let m=this.newGestureEvent(lr.Tap,f.initialTarget);m.pageX=cs(f.rollingPageX),m.pageY=cs(f.rollingPageY),this.dispatchEvent(m)}else if(p>=Ti.HOLD_DELAY&&Math.abs(f.initialPageX-cs(f.rollingPageX))<30&&Math.abs(f.initialPageY-cs(f.rollingPageY))<30){let m=this.newGestureEvent(lr.Contextmenu,f.initialTarget);m.pageX=cs(f.rollingPageX),m.pageY=cs(f.rollingPageY),this.dispatchEvent(m)}else if(r===1){let m=cs(f.rollingPageX),_=cs(f.rollingPageY),b=cs(f.rollingTimestamps)-f.rollingTimestamps[0],S=m-f.rollingPageX[0],w=_-f.rollingPageY[0],x=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,m,Math.abs(w)/b,w>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(lr.End,f.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===lr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ti.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===lr.Change||t.type===lr.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,u,d,f,p){this.handle=$0(t,()=>{let m=Date.now(),_=m-i,b=0,S=0,w=!0;r+=Ti.SCROLL_FRICTION*_,d+=Ti.SCROLL_FRICTION*_,r>0&&(w=!1,b=o*r*_),d>0&&(w=!1,S=f*d*_);let x=this.newGestureEvent(lr.Change);x.translationX=b,x.translationY=S,n.forEach(k=>k.dispatchEvent(x)),w||this.inertia(t,n,m,r,o,u+b,d,f,p+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 u=this.activeTouches[o.identifier],d=this.newGestureEvent(lr.Change,u.initialTarget);d.translationX=o.pageX-cs(u.rollingPageX),d.translationY=o.pageY-cs(u.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(o.pageX),u.rollingPageY.push(o.pageY),u.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};zu.SCROLL_FRICTION=-.005,zu.HOLD_DELAY=700,zu.CLEAR_TAP_COUNT_TIME=400,jn([WP],zu,"isTouchDevice",1);var qP=zu,P0=class extends xt{onclick(e,t){this._register(ht(e,si.CLICK,n=>t(new Jd(dr(e),n))))}onmousedown(e,t){this._register(ht(e,si.MOUSE_DOWN,n=>t(new Jd(dr(e),n))))}onmouseover(e,t){this._register(ht(e,si.MOUSE_OVER,n=>t(new Jd(dr(e),n))))}onmouseleave(e,t){this._register(ht(e,si.MOUSE_LEAVE,n=>t(new Jd(dr(e),n))))}onkeydown(e,t){this._register(ht(e,si.KEY_DOWN,n=>t(new zk(n))))}onkeyup(e,t){this._register(ht(e,si.KEY_UP,n=>t(new zk(n))))}oninput(e,t){this._register(ht(e,si.INPUT,t))}onblur(e,t){this._register(ht(e,si.BLUR,t))}onfocus(e,t){this._register(ht(e,si.FOCUS,t))}onchange(e,t){this._register(ht(e,si.CHANGE,t))}ignoreGesture(e){return qP.ignoreTarget(e)}},Gk=11,GP=class extends P0{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=Gk+"px",this.domNode.style.height=Gk+"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 vR),this._register(Wk(this.bgDomNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Wk(this.domNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new HP),this._pointerdownScheduleRepeatTimer=this._register(new B0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,dr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},KP=class Dy{constructor(t,n,i,r,o,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,u=u|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>u&&(d=u-o),d<0&&(d=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=u,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 Dy(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 Dy(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,u=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,f=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:u,scrollHeightChanged:d,scrollTopChanged:f}}},VP=class extends xt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new KP(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 Vk(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=Vk.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)))}},Kk=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function U_(e,t){let n=t-e;return function(i){return e+n*ZP(i)}}function YP(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var Vk=class Iy{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),YP(U_(t,r),U_(o,n),.33)}return U_(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 Kk(i,r,!1)}return new Kk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return Iy.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new Iy(t,n,r,i)}};function XP(e){return Math.pow(e,3)}function ZP(e){return 1-XP(1-e)}var JP=class extends xt{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 B0)}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":"")))}},QP=140,yR=class extends P0{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 JP(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new vR),this._shouldRender=!0,this.domNode=eh(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(ht(this.domNode.domNode,si.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new GP(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=eh(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(ht(this.slider.domNode,si.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=FP(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),u=Math.abs(o-n);if(pR&&u>QP){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()}},bR=class By{constructor(t,n,i,r,o,u){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new By(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 u=Math.max(0,i-t),d=Math.max(0,u-2*n),f=r>0&&r>i;if(!f)return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(i*d/r))),m=(d-p)/(r-i),_=o*m;return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(p),computedSliderRatio:m,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=By._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)}},e9=class extends yR{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bR(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}},t9=class extends yR{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bR(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}},n9=500,Yk=50,i9=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},$y=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(D0){let n=dr(t.browserEvent),i=pP(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 i9(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),u=Math.abs(n.deltaX),d=Math.abs(n.deltaY),f=Math.max(Math.min(r,u),1),p=Math.max(Math.min(o,d),1),m=Math.max(r,u),_=Math.max(o,d);m%f===0&&_%p===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};$y.INSTANCE=new $y;var s9=$y,r9=class extends P0{constructor(e,t,n){super(),this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Te),this.onWillScroll=this._onWillScroll.event,this._options=o9(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 t9(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new e9(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=eh(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=eh(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=eh(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 B0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ho(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,fr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Fk(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ho(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Fk(n))};this._mouseWheelToDispose.push(ht(this._listenOnDomNode,si.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=s9.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 u=!fr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!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(),f={};if(r){let p=Yk*r,m=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,m)}if(o){let p=Yk*o,m=d.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(f,m)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),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(),n9)}},a9=class extends r9{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 o9(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,fr&&(t.className+=" mac"),t}var Py=class extends xt{constructor(e,t,n,i,r,o,u,d){super(),this._bufferService=n,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new Te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new VP({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>$0(i.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new a9(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(wi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(wn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(wn(()=>this._styleElement.remove())),this._register(wi.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(p=>this._handleScroll(p)))}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}};Py=jn([Pe(2,Pi),Pe(3,Qr),Pe(4,eR),Pe(5,gc),Pe(6,zi),Pe(7,ea)],Py);var zy=class extends xt{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(wn(()=>{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()}};zy=jn([Pe(1,Pi),Pe(2,Qr),Pe(3,Th),Pe(4,ea)],zy);var l9=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)}},ar={full:0,left:0,center:0,right:0},Na={full:0,left:0,center:0,right:0},yu={full:0,left:0,center:0,right:0},lp=class extends xt{constructor(e,t,n,i,r,o,u,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new l9,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(wn(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;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);Na.full=this._canvas.width,Na.left=e,Na.center=t,Na.right=e,this._refreshDrawHeightConstants(),yu.full=1,yu.left=1,yu.center=1+Na.left,yu.right=1+Na.left+Na.center}_refreshDrawHeightConstants(){ar.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);ar.left=t,ar.center=t,ar.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ar.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ar.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ar.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ar.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(yu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ar[e.position||"full"]/2),Na[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ar[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}))}};lp=jn([Pe(2,Pi),Pe(3,Th),Pe(4,ea),Pe(5,zi),Pe(6,gc),Pe(7,Qr)],lp);var ve;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
90
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ve||={});var Df;(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=""))(Df||={});var SR;(e=>e.ST=`${ve.ESC}\\`)(SR||={});var Hy=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Hy=jn([Pe(2,Pi),Pe(3,zi),Pe(4,Go),Pe(5,ea)],Hy);var li=0,ci=0,ui=0,Mn=0,Xk={css:"#00000000",rgba:0},Gn;(e=>{function t(r,o,u,d){return d!==void 0?`#${bo(r)}${bo(o)}${bo(u)}${bo(d)}`:`#${bo(r)}${bo(o)}${bo(u)}`}e.toCss=t;function n(r,o,u,d=255){return(r<<24|o<<16|u<<8|d)>>>0}e.toRgba=n;function i(r,o,u,d){return{css:e.toCss(r,o,u,d),rgba:e.toRgba(r,o,u,d)}}e.toColor=i})(Gn||={});var gn;(e=>{function t(f,p){if(Mn=(p.rgba&255)/255,Mn===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,_=p.rgba>>16&255,b=p.rgba>>8&255,S=f.rgba>>24&255,w=f.rgba>>16&255,x=f.rgba>>8&255;li=S+Math.round((m-S)*Mn),ci=w+Math.round((_-w)*Mn),ui=x+Math.round((b-x)*Mn);let k=Gn.toCss(li,ci,ui),O=Gn.toRgba(li,ci,ui);return{css:k,rgba:O}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let _=If.ensureContrastRatio(f.rgba,p.rgba,m);if(_)return Gn.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(f){let p=(f.rgba|255)>>>0;return[li,ci,ui]=If.toChannels(p),{css:Gn.toCss(li,ci,ui),rgba:p}}e.opaque=r;function o(f,p){return Mn=Math.round(p*255),[li,ci,ui]=If.toChannels(f.rgba),{css:Gn.toCss(li,ci,ui,Mn),rgba:Gn.toRgba(li,ci,ui,Mn)}}e.opacity=o;function u(f,p){return Mn=f.rgba&255,o(f,Mn*p/255)}e.multiplyOpacity=u;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(gn||={});var kn;(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 li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),Gn.toColor(li,ci,ui);case 5:return li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),Mn=parseInt(r.slice(4,5).repeat(2),16),Gn.toColor(li,ci,ui,Mn);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 li=parseInt(o[1]),ci=parseInt(o[2]),ui=parseInt(o[3]),Mn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Gn.toColor(li,ci,ui,Mn);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),[li,ci,ui,Mn]=t.getImageData(0,0,1,1).data,Mn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gn.toRgba(li,ci,ui,Mn),css:r}}e.toColor=i})(kn||={});var Mi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,d=r/255,f=o/255,p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),_=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+m*.7152+_*.0722}e.relativeLuminance2=n})(Mi||={});var If;(e=>{function t(u,d){if(Mn=(d&255)/255,Mn===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return li=_+Math.round((f-_)*Mn),ci=b+Math.round((p-b)*Mn),ui=S+Math.round((m-S)*Mn),Gn.toRgba(li,ci,ui)}e.blend=t;function n(u,d,f){let p=Mi.relativeLuminance(u>>8),m=Mi.relativeLuminance(d>>8);if(Wr(p,m)<f){if(m<p){let S=i(u,d,f),w=Wr(p,Mi.relativeLuminance(S>>8));if(w<f){let x=r(u,d,f),k=Wr(p,Mi.relativeLuminance(x>>8));return w>k?S:x}return S}let _=r(u,d,f),b=Wr(p,Mi.relativeLuminance(_>>8));if(b<f){let S=i(u,d,f),w=Wr(p,Mi.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,d,f){let p=u>>24&255,m=u>>16&255,_=u>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Wr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(p,m,_));for(;x<f&&(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=Wr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(p,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,d,f){let p=u>>24&255,m=u>>16&255,_=u>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Wr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(p,m,_));for(;x<f&&(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=Wr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(p,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(If||={});function bo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Wr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var c9=class extends Eh{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()]}},cp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Is}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),r=0,o=0,u=0,d=t.getFg(0),f=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==f){if(p-r>1){let m=this._getJoinedRanges(i,u,o,t,r);for(let _=0;_<m.length;_++)n.push(m[_])}r=p,u=o,d=this._workCell.fg,f=this._workCell.bg}o+=this._workCell.getChars().length||Ha.length}if(this._bufferService.cols-r>1){let p=this._getJoinedRanges(i,u,o,t,r);for(let m=0;m<p.length;m++)n.push(p[m])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),u=[];try{u=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let f=this._characterJoiners[d].handler(o);for(let p=0;p<f.length;p++)cp._mergeRanges(u,f[p])}catch(f){console.error(f)}return this._stringRangesToCellRanges(u,i,r),u}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,u=e[i];if(u){for(let d=n;d<this._bufferService.cols;d++){let f=t.getWidth(d),p=t.getString(d).length||Ha.length;if(f!==0){if(!r&&u[0]<=o&&(u[0]=d,r=!0),u[1]<=o){if(u[1]=d,u=e[++i],!u)break;u[0]<=o?(u[0]=d,r=!0):r=!1}o+=p}}u&&(u[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}};cp=jn([Pe(0,Pi)],cp);function u9(e){return 57508<=e&&e<=57558}function h9(e){return 9472<=e&&e<=9631}function d9(e){return u9(e)||h9(e)}function f9(){return{css:{canvas:Qd(),cell:Qd()},device:{canvas:Qd(),cell:Qd(),char:{width:0,height:0,left:0,top:0}}}}function Qd(){return{width:0,height:0}}var Fy=class{constructor(e,t,n,i,r,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=u,this._workCell=new Is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,u,d,f,p,m){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,k=0,O="",P=0,F=0,T=0,L=0,M=!1,z=0,U=!1,Z=0,Q=0,G=[],B=p!==-1&&m!==-1;for(let R=0;R<w;R++){e.loadCell(R,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let N=!1,E=R>=Q,$=R,j=this._workCell;if(b.length>0&&R===b[0][0]&&E){let Ae=b.shift(),Me=this._isCellInSelection(Ae[0],t);for(P=Ae[0]+1;P<Ae[1];P++)E&&=Me===this._isCellInSelection(P,t);E&&=!n||o<Ae[0]||o>=Ae[1],E?(N=!0,j=new c9(this._workCell,e.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),$=Ae[1]-1,D=j.getWidth()):Q=Ae[1]}let q=this._isCellInSelection(R,t),H=n&&R===o,A=B&&R>=p&&R<=m,Y=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,Ae=>{Y=!0});let J=j.getChars()||Ha;if(J===" "&&(j.isUnderline()||j.isOverline())&&(J=" "),Z=D*d-f.get(J,j.isBold(),j.isItalic()),!x)x=this._document.createElement("span");else if(k&&(q&&U||!q&&!U&&j.bg===F)&&(q&&U&&S.selectionForeground||j.fg===T)&&j.extended.ext===L&&A===M&&Z===z&&!H&&!N&&!Y&&E){j.isInvisible()?O+=Ha:O+=J,k++;continue}else k&&(x.textContent=O),x=this._document.createElement("span"),k=0,O="";if(F=j.bg,T=j.fg,L=j.extended.ext,M=A,z=Z,U=q,N&&o>=R&&o<=$&&(o=R),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&G.push("xterm-cursor-blink"),G.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(j.isBold()&&G.push("xterm-bold"),j.isItalic()&&G.push("xterm-italic"),j.isDim()&&G.push("xterm-dim"),j.isInvisible()?O=Ha:O=j.getChars()||Ha,j.isUnderline()&&(G.push(`xterm-underline-${j.extended.underlineStyle}`),O===" "&&(O=" "),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Eh.toColorRGB(j.getUnderlineColor()).join(",")})`;else{let Ae=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&Ae<8&&(Ae+=8),x.style.textDecorationColor=S.ansi[Ae].css}j.isOverline()&&(G.push("xterm-overline"),O===" "&&(O=" ")),j.isStrikethrough()&&G.push("xterm-strikethrough"),A&&(x.style.textDecoration="underline");let he=j.getFgColor(),de=j.getFgColorMode(),ae=j.getBgColor(),we=j.getBgColorMode(),je=!!j.isInverse();if(je){let Ae=he;he=ae,ae=Ae;let Me=de;de=we,we=Me}let De,We,ke=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,Ae=>{Ae.options.layer!=="top"&&ke||(Ae.backgroundColorRGB&&(we=50331648,ae=Ae.backgroundColorRGB.rgba>>8&16777215,De=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(de=50331648,he=Ae.foregroundColorRGB.rgba>>8&16777215,We=Ae.foregroundColorRGB),ke=Ae.options.layer==="top")}),!ke&&q&&(De=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ae=De.rgba>>8&16777215,we=50331648,ke=!0,S.selectionForeground&&(de=50331648,he=S.selectionForeground.rgba>>8&16777215,We=S.selectionForeground)),ke&&G.push("xterm-decoration-top");let Le;switch(we){case 16777216:case 33554432:Le=S.ansi[ae],G.push(`xterm-bg-${ae}`);break;case 50331648:Le=Gn.toColor(ae>>16,ae>>8&255,ae&255),this._addStyle(x,`background-color:#${Zk((ae>>>0).toString(16),"0",6)}`);break;default:je?(Le=S.foreground,G.push("xterm-bg-257")):Le=S.background}switch(De||j.isDim()&&(De=gn.multiplyOpacity(Le,.5)),de){case 16777216:case 33554432:j.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(x,Le,S.ansi[he],j,De,void 0)||G.push(`xterm-fg-${he}`);break;case 50331648:let Ae=Gn.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(x,Le,Ae,j,De,We)||this._addStyle(x,`color:#${Zk(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Le,S.foreground,j,De,We)||je&&G.push("xterm-fg-257")}G.length&&(x.className=G.join(" "),G.length=0),!H&&!N&&!Y&&E?k++:x.textContent=O,Z!==this.defaultSpacing&&(x.style.letterSpacing=`${Z}px`),_.push(x),R=$}return x&&k&&(x.textContent=O),_}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||d9(i.getCode()))return!1;let u=this._getContrastCache(i),d;if(!r&&!o&&(d=u.getColor(t.rgba,n.rgba)),d===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=gn.ensureContrastRatio(r||t,o||n,f),u.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]}};Fy=jn([Pe(1,iR),Pe(2,zi),Pe(3,Qr),Pe(4,Go),Pe(5,Th),Pe(6,gc)],Fy);function Zk(e,t,n){for(;e.length<n;)e=t+e;return e}var p9=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 u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let u=0;t&&(u|=1),n&&(u|=2),o=this._measure(e,u),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}},m9=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,u=n[1]-r,d=Math.max(o,0),f=Math.min(u,e.rows-1);if(d>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=u,this.viewportCappedStartRow=d,this.viewportCappedEndRow=f,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 g9(){return new m9}var W_="xterm-dom-renderer-owner-",As="xterm-rows",ef="xterm-fg-",Jk="xterm-bg-",bu="xterm-focus",tf="xterm-selection",_9=1,Uy=class extends xt{constructor(e,t,n,i,r,o,u,d,f,p,m,_,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=u,this._charSizeService=f,this._optionsService=p,this._bufferService=m,this._coreService=_,this._coreBrowserService=b,this._themeService=S,this._terminalClass=_9++,this._rowElements=[],this._selectionRenderModel=g9(),this.onRequestRedraw=this._register(new Te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(As),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(tf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=f9(),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(Fy,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(wn(()=>{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 p9(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${As} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${As} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${As} .xterm-dim { color: ${gn.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${As}.${bu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${As}.${bu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${As}.${bu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${tf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${tf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${tf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ef}${o} { color: ${u.css}; }${this._terminalSelector} .${ef}${o}.xterm-dim { color: ${gn.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${Jk}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ef}257 { color: ${gn.opaque(e.background).css}; }${this._terminalSelector} .${ef}257.xterm-dim { color: ${gn.multiplyOpacity(gn.opaque(e.background),.5).css}; }${this._terminalSelector} .${Jk}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(bu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(bu),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,u=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(n){let f=e[0]>t[0];d.appendChild(this._createSelectionElement(o,f?t[0]:e[0],f?e[0]:t[0],u-o+1))}else{let f=i===o?e[0]:0,p=o===r?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,f,p));let m=u-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==u){let _=r===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,_))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(n-t);return o+u>this.dimensions.css.canvas.width&&(u=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=`${u}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,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let p=f+n.ydisp,m=this._rowElements[f],_=n.lines.get(p);if(!m||!_)break;m.replaceChildren(...this._rowFactory.createRow(_,p,p===i,u,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 u=this._bufferService.rows-1;n=Math.max(Math.min(n,u),0),i=Math.max(Math.min(i,u),0),r=Math.min(r,this._bufferService.cols);let d=this._bufferService.buffer,f=d.ybase+d.y,p=Math.min(d.x,r-1),m=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+d.ydisp,x=this._rowElements[S],k=d.lines.get(w);if(!x||!k)break;x.replaceChildren(...this._rowFactory.createRow(k,w,w===f,_,b,p,m,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};Uy=jn([Pe(7,M0),Pe(8,Up),Pe(9,zi),Pe(10,Pi),Pe(11,Go),Pe(12,Qr),Pe(13,gc)],Uy);var Wy=class extends xt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new y9(this._optionsService))}catch{this._measureStrategy=this._register(new v9(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())}};Wy=jn([Pe(2,zi)],Wy);var wR=class extends xt{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)}},v9=class extends wR{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}},y9=class extends wR{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}},b9=class extends xt{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 S9(this._window)),this._onDprChange=this._register(new Te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(wi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ht(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ht(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}},S9=class extends xt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new lc),this._onDprChange=this._register(new Te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(wn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ht(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)}},w9=class extends xt{constructor(){super(),this.linkProviders=[],this._register(wn(()=>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 z0(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),u=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function x9(e,t,n,i,r,o,u,d,f){if(!o)return;let p=z0(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(f?u/2:0))/u),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),i+(f?1:0)),p[1]=Math.min(Math.max(p[1],1),r),p}var qy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return x9(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=z0(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])}}};qy=jn([Pe(0,ea),Pe(1,Up)],qy);var C9=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=[]}},xR={};O$(xR,{getSafariVersion:()=>E9,isChromeOS:()=>TR,isFirefox:()=>CR,isIpad:()=>T9,isIphone:()=>A9,isLegacyEdge:()=>k9,isLinux:()=>H0,isMac:()=>up,isNode:()=>Wp,isSafari:()=>kR,isWindows:()=>ER});var Wp=typeof process<"u"&&"title"in process,Ah=Wp?"node":navigator.userAgent,Rh=Wp?"node":navigator.platform,CR=Ah.includes("Firefox"),k9=Ah.includes("Edge"),kR=/^((?!chrome|android).)*safari/i.test(Ah);function E9(){if(!kR)return 0;let e=Ah.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var up=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Rh),T9=Rh==="iPad",A9=Rh==="iPhone",ER=["Windows","Win16","Win32","WinCE"].includes(Rh),H0=Rh.indexOf("Linux")>=0,TR=/\bCrOS\b/.test(Ah),AR=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()}},R9=class extends AR{_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())}}},N9=class extends AR{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},hp=!Wp&&"requestIdleCallback"in window?N9:R9,L9=class{constructor(){this._queue=new hp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Gy=class extends xt{constructor(e,t,n,i,r,o,u,d,f){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new lc),this._pausedResizeTask=new L9,this._observerDisposable=this._register(new lc),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 Te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new C9((p,m)=>this._renderRows(p,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new M9(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(wn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.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(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,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=wn(()=>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()}};Gy=jn([Pe(2,zi),Pe(3,Up),Pe(4,Go),Pe(5,Th),Pe(6,Pi),Pe(7,Qr),Pe(8,gc)],Gy);var M9=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 j9(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return I9(r,o,e,t,n,i)+qp(o,t,n,i)+B9(r,o,e,t,n,i);let u;if(o===t)return u=r>e?"D":"C",ch(Math.abs(r-e),lh(u,i));u=o>t?"D":"C";let d=Math.abs(o-t),f=D9(o>t?e:r,n)+(d-1)*n.cols+1+O9(o>t?r:e);return ch(f,lh(u,i))}function O9(e,t){return e-1}function D9(e,t){return t.cols-e}function I9(e,t,n,i,r,o){return qp(t,i,r,o).length===0?"":ch(NR(e,t,e,t-Fo(t,r),!1,r).length,lh("D",o))}function qp(e,t,n,i){let r=e-Fo(e,n),o=t-Fo(t,n),u=Math.abs(r-o)-$9(e,t,n);return ch(u,lh(RR(e,t),i))}function B9(e,t,n,i,r,o){let u;qp(t,i,r,o).length>0?u=i-Fo(i,r):u=t;let d=i,f=P9(e,t,n,i,r,o);return ch(NR(e,u,n,d,f==="C",r).length,lh(f,o))}function $9(e,t,n){let i=0,r=e-Fo(e,n),o=t-Fo(t,n);for(let u=0;u<Math.abs(r-o);u++){let d=RR(e,t)==="A"?-1:1;n.buffer.lines.get(r+d*u)?.isWrapped&&i++}return i}function Fo(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 P9(e,t,n,i,r,o){let u;return qp(n,i,r,o).length>0?u=i-Fo(i,r):u=t,e<n&&u<=i||e>=n&&u<i?"C":"D"}function RR(e,t){return e>t?"A":"B"}function NR(e,t,n,i,r,o){let u=e,d=t,f="";for(;(u!==n||d!==i)&&d>=0&&d<o.buffer.lines.length;)u+=r?1:-1,r&&u>o.cols-1?(f+=o.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!r&&u<0&&(f+=o.buffer.translateBufferLineToString(d,!1,0,e+1),u=o.cols-1,e=u,d--);return f+o.buffer.translateBufferLineToString(d,!1,e,u)}function lh(e,t){let n=t?"O":"[";return ve.ESC+n+e}function ch(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var z9=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 Qk(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 q_=50,H9=15,F9=50,U9=500,W9=" ",q9=new RegExp(W9,"g"),Ky=class extends xt{constructor(e,t,n,i,r,o,u,d,f){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=u,this._renderService=d,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new z9(this._bufferService),this._activeSelectionMode=0,this._register(wn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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 u=e[1];u<=t[1];u++){let d=n.translateBufferLineToString(u,!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 u=n.lines.get(o),d=n.translateBufferLineToString(o,!0);u?.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),u=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(r=>r.replace(q9," ")).join(ER?`\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())),H0&&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=Qk(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=z0(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,-q_),q_),t/=q_,t/Math.abs(t)+Math.round(t*(H9-1)))}shouldForceSelection(e){return up?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(),F9)}_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&&!(up&&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<U9&&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=j9(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 u=r.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),f=d,p=e[0]-d,m=0,_=0,b=0,S=0;if(u.charAt(d)===" "){for(;d>0&&u.charAt(d-1)===" ";)d--;for(;f<u.length&&u.charAt(f+1)===" ";)f++}else{let k=e[0],O=e[0];o.getWidth(k)===0&&(m++,k--),o.getWidth(O)===2&&(_++,O++);let P=o.getString(O).length;for(P>1&&(S+=P-1,f+=P-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,k--):F>1&&(b+=F-1,d-=F-1),d--,k--}for(;O<o.length&&f+1<u.length&&!this._isCharWordSeparator(o.loadCell(O+1,this._workCell));){o.loadCell(O+1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,O++):F>1&&(S+=F-1,f+=F-1),f++,O++}}f++;let w=d+p-m+b,x=Math.min(this._bufferService.cols,f-d+m+_-b-S);if(!(!t&&u.slice(d,f).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let k=r.lines.get(e[1]-1);if(k&&o.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let O=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(O){let P=this._bufferService.cols-O.start;w-=P,x+=P}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let k=r.lines.get(e[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let O=this._getWordAt([0,e[1]+1],!1,!1,!0);O&&(x+=O.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Qk(n,this._bufferService.cols)}};Ky=jn([Pe(3,Pi),Pe(4,Go),Pe(5,j0),Pe(6,zi),Pe(7,ea),Pe(8,Qr)],Ky);var e2=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={}}},t2=class{constructor(){this._color=new e2,this._css=new e2}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()}},Jn=Object.freeze((()=>{let e=[kn.toColor("#2e3436"),kn.toColor("#cc0000"),kn.toColor("#4e9a06"),kn.toColor("#c4a000"),kn.toColor("#3465a4"),kn.toColor("#75507b"),kn.toColor("#06989a"),kn.toColor("#d3d7cf"),kn.toColor("#555753"),kn.toColor("#ef2929"),kn.toColor("#8ae234"),kn.toColor("#fce94f"),kn.toColor("#729fcf"),kn.toColor("#ad7fa8"),kn.toColor("#34e2e2"),kn.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:Gn.toCss(i,r,o),rgba:Gn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:Gn.toCss(i,i,i),rgba:Gn.toRgba(i,i,i)})}return e})()),ko=kn.toColor("#ffffff"),Hu=kn.toColor("#000000"),n2=kn.toColor("#ffffff"),i2=Hu,Su={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},G9=ko,Vy=class extends xt{constructor(e){super(),this._optionsService=e,this._contrastCache=new t2,this._halfContrastCache=new t2,this._onChangeColors=this._register(new Te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ko,background:Hu,cursor:n2,cursorAccent:i2,selectionForeground:void 0,selectionBackgroundTransparent:Su,selectionBackgroundOpaque:gn.blend(Hu,Su),selectionInactiveBackgroundTransparent:Su,selectionInactiveBackgroundOpaque:gn.blend(Hu,Su),scrollbarSliderBackground:gn.opacity(ko,.2),scrollbarSliderHoverBackground:gn.opacity(ko,.4),scrollbarSliderActiveBackground:gn.opacity(ko,.5),overviewRulerBorder:ko,ansi:Jn.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=nn(e.foreground,ko),t.background=nn(e.background,Hu),t.cursor=gn.blend(t.background,nn(e.cursor,n2)),t.cursorAccent=gn.blend(t.background,nn(e.cursorAccent,i2)),t.selectionBackgroundTransparent=nn(e.selectionBackground,Su),t.selectionBackgroundOpaque=gn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=nn(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=gn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?nn(e.selectionForeground,Xk):void 0,t.selectionForeground===Xk&&(t.selectionForeground=void 0),gn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=gn.opacity(t.selectionBackgroundTransparent,.3)),gn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=gn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=nn(e.scrollbarSliderBackground,gn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=nn(e.scrollbarSliderHoverBackground,gn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=nn(e.scrollbarSliderActiveBackground,gn.opacity(t.foreground,.5)),t.overviewRulerBorder=nn(e.overviewRulerBorder,G9),t.ansi=Jn.slice(),t.ansi[0]=nn(e.black,Jn[0]),t.ansi[1]=nn(e.red,Jn[1]),t.ansi[2]=nn(e.green,Jn[2]),t.ansi[3]=nn(e.yellow,Jn[3]),t.ansi[4]=nn(e.blue,Jn[4]),t.ansi[5]=nn(e.magenta,Jn[5]),t.ansi[6]=nn(e.cyan,Jn[6]),t.ansi[7]=nn(e.white,Jn[7]),t.ansi[8]=nn(e.brightBlack,Jn[8]),t.ansi[9]=nn(e.brightRed,Jn[9]),t.ansi[10]=nn(e.brightGreen,Jn[10]),t.ansi[11]=nn(e.brightYellow,Jn[11]),t.ansi[12]=nn(e.brightBlue,Jn[12]),t.ansi[13]=nn(e.brightMagenta,Jn[13]),t.ansi[14]=nn(e.brightCyan,Jn[14]),t.ansi[15]=nn(e.brightWhite,Jn[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]=nn(e.extendedAnsi[i],Jn[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()}}};Vy=jn([Pe(0,zi)],Vy);function nn(e,t){if(e!==void 0)try{return kn.toColor(e)}catch{}return t}var K9=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)}},V9=class{constructor(){this._services=new K9,this._services.set(M0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=H$(e).sort((o,u)=>o.index-u.index),i=[];for(let o of n){let u=this._services.get(o.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(u)}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)}},Y9={trace:0,debug:1,info:2,warn:3,error:4,off:5},X9="xterm.js: ",Yy=class extends xt{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=Y9[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?"":X9)+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)}};Yy=jn([Pe(0,zi)],Yy);var s2=class extends xt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Te),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}},wt=3,Wn=Object.freeze(new Eh),nf=0,G_=2,Fu=class LR{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*wt);let r=n||Is.fromCharData([0,XA,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*wt+0],i=n&2097151;return[this._data[t*wt+1],n&2097152?this._combined[t]:i?Ba(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*wt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*wt+0]=t|2097152|n[2]<<22):this._data[t*wt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*wt+0]>>22}hasWidth(t){return this._data[t*wt+0]&12582912}getFg(t){return this._data[t*wt+1]}getBg(t){return this._data[t*wt+2]}hasContent(t){return this._data[t*wt+0]&4194303}getCodePoint(t){let n=this._data[t*wt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*wt+0]&2097152}getString(t){let n=this._data[t*wt+0];return n&2097152?this._combined[t]:n&2097151?Ba(n&2097151):""}isProtected(t){return this._data[t*wt+2]&536870912}loadCell(t,n){return nf=t*wt,n.content=this._data[nf+0],n.fg=this._data[nf+1],n.bg=this._data[nf+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*wt+0]=n.content,this._data[t*wt+1]=n.fg,this._data[t*wt+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*wt+0]=n|i<<22,this._data[t*wt+1]=r.fg,this._data[t*wt+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*wt+0];r&2097152?this._combined[t]+=Ba(n):r&2097151?(this._combined[t]=Ba(r&2097151)+Ba(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*wt+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new Is;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new Is;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*G_<this._data.buffer.byteLength;let i=t*wt;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 u=0;u<r.length;u++){let d=parseInt(r[u],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let u=0;u<o.length;u++){let d=parseInt(o[u],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*G_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*G_<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 LR(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*wt+0]&4194303)return t+(this._data[t*wt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*wt+0]&4194303||this._data[t*wt+2]&50331648)return t+(this._data[t*wt+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let u=t._data;if(o)for(let f=r-1;f>=0;f--){for(let p=0;p<wt;p++)this._data[(i+f)*wt+p]=u[(n+f)*wt+p];u[(n+f)*wt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}else for(let f=0;f<r;f++){for(let p=0;p<wt;p++)this._data[(i+f)*wt+p]=u[(n+f)*wt+p];u[(n+f)*wt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}let d=Object.keys(t._combined);for(let f=0;f<d.length;f++){let p=parseInt(d[f],10);p>=n&&(this._combined[p-n+i]=t._combined[p])}}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 u=this._data[n*wt+0],d=u&2097151,f=u&2097152?this._combined[n]:d?Ba(d):Ha;if(o+=f,r)for(let p=0;p<f.length;++p)r.push(n);n+=u>>22||1}return r&&r.push(n),o}};function Z9(e,t,n,i,r,o){let u=[];for(let d=0;d<e.length-1;d++){let f=d,p=e.get(++f);if(!p.isWrapped)continue;let m=[e.get(d)];for(;f<e.length&&p.isWrapped;)m.push(p),p=e.get(++f);if(!o&&i>=d&&i<f){d+=m.length-1;continue}let _=0,b=uh(m,_,t),S=1,w=0;for(;S<m.length;){let k=uh(m,S,t),O=k-w,P=n-b,F=Math.min(O,P);m[_].copyCellsFrom(m[S],w,b,F,!1),b+=F,b===n&&(_++,b=0),w+=F,w===k&&(S++,w=0),b===0&&_!==0&&m[_-1].getWidth(n-1)===2&&(m[_].copyCellsFrom(m[_-1],n-1,b++,1,!1),m[_-1].setCell(n-1,r))}m[_].replaceCells(b,n,r);let x=0;for(let k=m.length-1;k>0&&(k>_||m[k].getTrimmedLength()===0);k--)x++;x>0&&(u.push(d+m.length-x),u.push(x)),d+=m.length-1}return u}function J9(e,t){let n=[],i=0,r=t[i],o=0;for(let u=0;u<e.length;u++)if(r===u){let d=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:d}),u+=d-1,o+=d,r=t[++i]}else n.push(u);return{layout:n,countRemoved:o}}function Q9(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 ez(e,t,n){let i=[],r=e.map((f,p)=>uh(e,p,t)).reduce((f,p)=>f+p),o=0,u=0,d=0;for(;d<r;){if(r-d<n){i.push(r-d);break}o+=n;let f=uh(e,u,t);o>f&&(o-=f,u++);let p=e[u].getWidth(o-1)===2;p&&o--;let m=p?n-1:n;i.push(m),d+=m}return i}function uh(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 MR=class jR{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=jR._nextId++,this._onDispose=this.register(new Te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ho(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};MR._nextId=1;var tz=MR,ei={},Eo=ei.B;ei[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ei.A={"#":"£"};ei.B=void 0;ei[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ei.C=ei[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ei.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ei.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ei.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ei.E=ei[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ei.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ei.H=ei[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var r2=4294967295,a2=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=Wn.clone(),this.savedCharset=Eo,this.markers=[],this._nullCell=Is.fromCharData([0,XA,1,0]),this._whitespaceCell=Is.fromCharData([0,Ha,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new hp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s2(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 op),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 op),this._whitespaceCell}getBlankLine(e,t){return new Fu(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>r2?r2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Wn);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 s2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Wn),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 u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,n);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 Fu(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 Fu(e,n)));else for(let u=this._rows;u>t;u--)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 u=this.lines.length-r;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,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=Z9(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Wn),n);if(i.length>0){let r=J9(this.lines,i);Q9(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(Wn),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Fu(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(Wn),r=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let f=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),f.unshift(d);if(!n){let F=this.ybase+this.y;if(F>=u&&F<u+f.length)continue}let p=f[f.length-1].getTrimmedLength(),m=ez(f,this._cols,e),_=m.length-f.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let S=[];for(let F=0;F<_;F++){let T=this.getBlankLine(Wn,!0);S.push(T)}S.length>0&&(r.push({start:u+f.length+o,newLines:S}),o+=S.length),f.push(...S);let w=m.length-1,x=m[w];x===0&&(w--,x=m[w]);let k=f.length-_-1,O=p;for(;k>=0;){let F=Math.min(O,x);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[k],O-F,x-F,F,!0),x-=F,x===0&&(w--,x=m[w]),O-=F,O===0){k--;let T=Math.max(k,0);O=uh(f,T,this._cols)}}for(let F=0;F<f.length;F++)m[F]<e&&f[F].setCell(m[F],i);let P=_-b;for(;P-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(r.length>0){let u=[],d=[];for(let x=0;x<this.lines.length;x++)d.push(this.lines.get(x));let f=this.lines.length,p=f-1,m=0,_=r[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let x=Math.min(this.lines.maxLength-1,f+o-1);x>=0;x--)if(_&&_.start>p+b){for(let k=_.newLines.length-1;k>=0;k--)this.lines.set(x--,_.newLines[k]);x++,u.push({index:p+1,amount:_.newLines.length}),b+=_.newLines.length,_=r[++m]}else this.lines.set(x,d[p--]);let S=0;for(let x=u.length-1;x>=0;x--)u[x].index+=S,this.lines.onInsertEmitter.fire(u[x]),S+=u[x].amount;let w=Math.max(0,f+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 tz(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)}},nz=class extends xt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Te),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 a2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a2(!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)}},OR=2,DR=1,Xy=class extends xt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Te),this.onResize=this._onResize.event,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,OR),this.rows=Math.max(e.rawOptions.rows||0,DR),this.buffers=this._register(new nz(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 u=n.lines.isFull;o===n.lines.length-1?u?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),u?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let u=o-r+1;n.lines.shiftElements(r+1,u-1,-1),n.lines.set(o,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Xy=jn([Pe(0,zi)],Xy);var Nl={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:up,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},iz=["normal","bold","100","200","300","400","500","600","700","800","900"],sz=class extends xt{constructor(e){super(),this._onOptionChange=this._register(new Te),this.onOptionChange=this._onOptionChange.event;let t={...Nl};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(wn(()=>{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 Nl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in Nl))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=Nl[e]),!rz(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Nl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=iz.includes(t)?t:Nl[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 rz(e){return e==="block"||e==="underline"||e==="bar"}function Uu(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]&&Uu(e[i],t-1);return n}var o2=Object.freeze({insertMode:!1}),l2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Zy=class extends xt{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 Te),this.onData=this._onData.event,this._onUserInput=this._register(new Te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Uu(o2),this.decPrivateModes=Uu(l2)}reset(){this.modes=Uu(o2),this.decPrivateModes=Uu(l2)}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))}};Zy=jn([Pe(0,Pi),Pe(1,tR),Pe(2,zi)],Zy);var c2={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 V_=String.fromCharCode,u2={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${V_(t[0])}${V_(t[1])}${V_(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}`}},Jy=class extends xt{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 Te),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(c2))this.addProtocol(i,c2[i]);for(let i of Object.keys(u2))this.addEncoding(i,u2[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)}};Jy=jn([Pe(0,Pi),Pe(1,Go),Pe(2,zi)],Jy);var Y_=[[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]],az=[[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]],Qn;function oz(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 lz=class{constructor(){if(this.version="6",!Qn){Qn=new Uint8Array(65536),Qn.fill(1),Qn[0]=0,Qn.fill(0,1,32),Qn.fill(0,127,160),Qn.fill(2,4352,4448),Qn[9001]=2,Qn[9002]=2,Qn.fill(2,11904,42192),Qn[12351]=1,Qn.fill(2,44032,55204),Qn.fill(2,63744,64256),Qn.fill(2,65040,65050),Qn.fill(2,65072,65136),Qn.fill(2,65280,65377),Qn.fill(2,65504,65511);for(let e=0;e<Y_.length;++e)Qn.fill(0,Y_[e][0],Y_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Qn[e]:oz(e,az)?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=Ao.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return Ao.createPropertyValue(0,n,i)}},Ao=class Bf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Te,this.onChange=this._onChange.event;let t=new lz;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 u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let p=t.charCodeAt(o);56320<=p&&p<=57343?u=(u-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(u,i),f=Bf.extractWidth(d);Bf.extractShouldJoin(d)&&(f-=Bf.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},cz=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 h2(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 wu=2147483647,uz=256,IR=class Qy{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>uz)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 Qy;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 Qy(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>wu?wu: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>wu?wu: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,wu):t}},xu=[],hz=class{constructor(){this._state=0,this._active=xu,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=xu}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=xu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||xu,!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",Fp(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=xu,this._id=-1,this._state=0}}},us=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=Fp(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}},Cu=[],dz=class{constructor(){this._handlers=Object.create(null),this._active=Cu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Cu}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=Cu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Cu,!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",Fp(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=Cu,this._ident=0}},Wu=new IR;Wu.addParam(0);var d2=class{constructor(e){this._handler=e,this._data="",this._params=Wu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Wu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Fp(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=Wu,this._data="",this._hitLimit=!1,n));return this._params=Wu,this._data="",this._hitLimit=!1,t}},fz=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},Os=160,pz=(function(){let e=new fz(4095),t=Array.apply(null,Array(256)).map((d,f)=>f),n=(d,f)=>t.slice(d,f),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(n(128,144),u,3,0),e.addMany(n(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Os,0,2,0),e.add(Os,8,5,8),e.add(Os,6,0,6),e.add(Os,11,0,11),e.add(Os,13,13,13),e})(),mz=class extends xt{constructor(e=pz){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 IR,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(wn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new hz),this._dcsParser=this._register(new dz),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,u;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,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&f>-1){for(;f>=0&&(u=d[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 4:if(n===!1&&f>-1){for(;f>=0&&(u=d[f](),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,n),u)return u;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],u=this._oscParser.end(i!==24&&i!==26,n),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],r=this._transitions.table[this.currentState<<8|(i<160?i:Os)],r>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Os){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|i],p=f?f.length-1:-1;for(;p>=0&&(u=f[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(3,f,p,r,d),u;p<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 m=this._escHandlers[this._collect<<8|i],_=m?m.length-1:-1;for(;_>=0&&(u=m[_](),u!==!0);_--)if(u instanceof Promise)return this._preserveStack(4,m,_,r,d),u;_<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Os){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,r,d),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=d+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Os){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,r,d),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},gz=/^([\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})$/,_z=/^[\da-f]+$/;function f2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=gz.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),_z.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 X_(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 vz(e,t=16){let[n,i,r]=e;return`rgb:${X_(n,t)}/${X_(i,t)}/${X_(r,t)}`}var yz={"(":0,")":1,"*":2,"+":3,"-":1,".":2},La=131072,p2=10;function m2(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 g2=5e3,_2=0,bz=class extends xt{constructor(e,t,n,i,r,o,u,d,f=new mz){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=d,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new P$,this._utf8Decoder=new z$,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wn.clone(),this._eraseAttrDataInternal=Wn.clone(),this._onRequestBell=this._register(new Te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Te),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 eb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:m.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,m,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:m,data:_})}),this._parser.setDcsHandlerFallback((p,m,_)=>{m==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:m,payload:_})}),this._parser.setPrintHandler((p,m,_)=>this.print(p,m,_)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Df.IND,()=>this.index()),this._parser.setExecuteHandler(Df.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Df.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new us(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new us(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new us(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new us(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new us(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new us(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new us(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new us(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new us(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new us(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new us(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new us(p=>this.restoreCursorColor(p))),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 p in ei)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d2((p,m)=>this.requestStatusString(p,m)))}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"),g2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${g2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,u=this._parseStack.paused;if(u){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>La&&(o=this._parseStack.position+La)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<La&&(this._parseBuffer=new Uint32Array(Math.min(e.length,La))),u||this._dirtyRowTracker.clearRange(),e.length>La)for(let p=o;p<e.length;p+=La){let m=p+La<e.length?p+La:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(p,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,m),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,r,_,p),this._logSlowResolvingAsync(n),n}else if(!u){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,r,p,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),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,m=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let O=o[String.fromCharCode(i)];O&&(i=O.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=Ao.extractWidth(w);let x=Ao.extractShouldJoin(w),k=x?Ao.extractWidth(b):0;if(b=w,u&&this._onA11yChar.fire(Ba(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-k>d){if(f){let O=_,P=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&_ instanceof Fu&&_.copyCellsFrom(O,P,0,k,!1);P<d;)O.setCellFromCodepoint(P++,0,1,m)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let O=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-O,i,r);for(let P=r-k;--P>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(p&&(_.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(m)),_.getWidth(d-1)===2&&_.setCellFromCodepoint(d-1,0,1,m)),_.setCellFromCodepoint(this._activeBuffer.x++,i,r,m),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>m2(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new d2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new us(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Wn));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=Ao.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),u=new Uint32Array(o.length*n),d=0;for(let p=0;p<o.length;){let m=o.codePointAt(p)||0;u[d++]=m,p+=m>65535?2:1}let f=d;for(let p=1;p<n;++p)u.copyWithin(f,0,d),f+=d;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Eo),this._charsetService.setgCharset(1,Eo),this._charsetService.setgCharset(2,Eo),this._charsetService.setgCharset(3,Eo);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,u=this._coreService,{buffers:d,cols:f}=this._bufferService,{active:p,alt:m}=d,_=this._optionsService.rawOptions,b=(x,k)=>(u.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${x};${k}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(u.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(_.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,_.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(_.cursorBlink)):w===25?b(w,S(!u.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(p===m)):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|=Eh.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 u=e.getSubParams(t+o),d=0;do i[1]===5&&(r=1),i[o+d+1+r]=u[d];while(++d<u.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 u=2;u<i.length;++u)i[u]===-1&&(i[u]=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=Wn.fg,e.bg=Wn.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|=Wn.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=Wn.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|=Wn.fg&16777215,i.bg&=-67108864,i.bg|=Wn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Wn.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(!m2(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>p2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>p2&&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(v2(o))if(r==="?")t.push({type:0,index:o});else{let u=f2(r);u&&t.push({type:1,index:o,color:u})}}}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=f2(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]);v2(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,Eo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(yz[e[0]],ei[e[1]]||Eo),!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=Wn.clone(),this._eraseAttrDataInternal=Wn.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Is;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=u=>(this._coreService.triggerDataEvent(`${ve.ESC}${u}${ve.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},eb=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&&(_2=e,e=t,t=_2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};eb=jn([Pe(0,Pi)],eb);function v2(e){return 0<=e&&e<256}var Sz=5e7,y2=12,wz=50,xz=class extends xt{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 Te),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>Sz)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 u=d=>performance.now()-n>=y2?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(n,d);r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(u);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=y2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>wz&&(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()}},tb=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),f={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(f,d)),this._dataByLinkId.set(f.id,f),f.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),u={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.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)))}};tb=jn([Pe(0,Pi)],tb);var b2=!1,Cz=class extends xt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new lc),this._onBinary=this._register(new Te),this.onBinary=this._onBinary.event,this._onData=this._register(new Te),this.onData=this._onData.event,this._onLineFeed=this._register(new Te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Te),this._instantiationService=new V9,this.optionsService=this._register(new sz(e)),this._instantiationService.setService(zi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Xy)),this._instantiationService.setService(Pi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Yy)),this._instantiationService.setService(tR,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Zy)),this._instantiationService.setService(Go,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Jy)),this._instantiationService.setService(eR,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ao)),this._instantiationService.setService(W$,this.unicodeService),this._charsetService=this._instantiationService.createInstance(cz),this._instantiationService.setService(U$,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tb),this._instantiationService.setService(nR,this._oscLinkService),this._inputHandler=this._register(new bz(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(wi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(wi.forward(this._bufferService.onResize,this._onResize)),this._register(wi.forward(this.coreService.onData,this._onData)),this._register(wi.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 xz((t,n)=>this._inputHandler.parse(t,n))),this._register(wi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Te),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&&!b2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b2=!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,OR),t=Math.max(t,DR),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(h2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(h2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=wn(()=>{for(let t of e)t.dispose()})}}},kz={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 Ez(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(r.key=ve.ESC+r.key);break;case 9:if(e.shiftKey){r.key=ve.ESC+"[Z";break}r.key=ve.HT,r.cancel=!0;break;case 13:r.key=e.altKey?ve.ESC+ve.CR:ve.CR,r.cancel=!0;break;case 27:r.key=ve.ESC,e.altKey&&(r.key=ve.ESC+ve.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"D":t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"C":t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"A":t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"B":t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=ve.ESC+"[2~");break;case 46:o?r.key=ve.ESC+"[3;"+(o+1)+"~":r.key=ve.ESC+"[3~";break;case 36:o?r.key=ve.ESC+"[1;"+(o+1)+"H":t?r.key=ve.ESC+"OH":r.key=ve.ESC+"[H";break;case 35:o?r.key=ve.ESC+"[1;"+(o+1)+"F":t?r.key=ve.ESC+"OF":r.key=ve.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=ve.ESC+"[5;"+(o+1)+"~":r.key=ve.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=ve.ESC+"[6;"+(o+1)+"~":r.key=ve.ESC+"[6~";break;case 112:o?r.key=ve.ESC+"[1;"+(o+1)+"P":r.key=ve.ESC+"OP";break;case 113:o?r.key=ve.ESC+"[1;"+(o+1)+"Q":r.key=ve.ESC+"OQ";break;case 114:o?r.key=ve.ESC+"[1;"+(o+1)+"R":r.key=ve.ESC+"OR";break;case 115:o?r.key=ve.ESC+"[1;"+(o+1)+"S":r.key=ve.ESC+"OS";break;case 116:o?r.key=ve.ESC+"[15;"+(o+1)+"~":r.key=ve.ESC+"[15~";break;case 117:o?r.key=ve.ESC+"[17;"+(o+1)+"~":r.key=ve.ESC+"[17~";break;case 118:o?r.key=ve.ESC+"[18;"+(o+1)+"~":r.key=ve.ESC+"[18~";break;case 119:o?r.key=ve.ESC+"[19;"+(o+1)+"~":r.key=ve.ESC+"[19~";break;case 120:o?r.key=ve.ESC+"[20;"+(o+1)+"~":r.key=ve.ESC+"[20~";break;case 121:o?r.key=ve.ESC+"[21;"+(o+1)+"~":r.key=ve.ESC+"[21~";break;case 122:o?r.key=ve.ESC+"[23;"+(o+1)+"~":r.key=ve.ESC+"[23~";break;case 123:o?r.key=ve.ESC+"[24;"+(o+1)+"~":r.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=ve.DEL:e.keyCode===219?r.key=ve.ESC:e.keyCode===220?r.key=ve.FS:e.keyCode===221&&(r.key=ve.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let u=kz[e.keyCode]?.[e.shiftKey?1:0];if(u)r.key=ve.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(d);e.shiftKey&&(f=f.toUpperCase()),r.key=ve.ESC+f}else if(e.keyCode===32)r.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),r.key=ve.ESC+d,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=ve.US),e.key==="@"&&(r.key=ve.NUL));break}return r}var Bn=0,Tz=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new hp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new hp,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||(Bn=this._search(t),Bn===-1)||this._getKey(this._array[Bn])!==t)return!1;do if(this._array[Bn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Bn),!0;while(++Bn<this._array.length&&this._getKey(this._array[Bn])===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&&(Bn=this._search(e),!(Bn<0||Bn>=this._array.length)&&this._getKey(this._array[Bn])===e))do yield this._array[Bn];while(++Bn<this._array.length&&this._getKey(this._array[Bn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Bn=this._search(e),!(Bn<0||Bn>=this._array.length)&&this._getKey(this._array[Bn])===e))do t(this._array[Bn]);while(++Bn<this._array.length&&this._getKey(this._array[Bn])===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}},Z_=0,S2=0,Az=class extends xt{constructor(){super(),this._decorations=new Tz(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(wn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Rz(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=>{Z_=r.options.x??0,S2=Z_+(r.options.width??1),e>=Z_&&e<S2&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},Rz=class extends Wa{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Te),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=kn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=kn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Nz=1e3,Lz=class{constructor(e,t=Nz){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)}},w2=20,dp=class extends xt{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 Lz(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(ht(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(wn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<w2+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===w2+1&&(this._liveRegion.textContent+=Sy.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),u=[],d=o?.translateToString(!0,void 0,void 0,u)||"",f=(n.ydisp+r+1).toString(),p=this._rowElements[r];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,u)),p.setAttribute("aria-posinset",f),p.setAttribute("aria-setsize",i),this._alignRowWidth(p))}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 u,d;if(t===0?(u=n,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(u=this._rowElements.shift(),d=n,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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:f})=>{let p=d instanceof Text?d.parentNode:d,m=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(p);if(!_)return console.warn("columns is null. Race condition?"),null;let b=f<_.length?_[f]:_.slice(-1)[0]+1;return b>=this._terminal.cols&&(++m,b=0),{row:m,column:b}},o=r(t),u=r(n);if(!(!o||!u)){if(o.row>u.row||o.row===u.row&&o.column>=u.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(u.row-o.row)*this._terminal.cols-o.column+u.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})`}};dp=jn([Pe(1,M0),Pe(2,Qr),Pe(3,ea)],dp);var nb=class extends xt{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 Te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(wn(()=>{Ho(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(ht(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ht(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ht(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ht(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 u=o?.map(d=>({link:d}));this._activeProviderReplies?.set(i,u),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 u=r[o],d=u.link.range.start.y<e?0:u.link.range.start.x,f=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let p=d;p<=f;p++){if(n.has(p)){r.splice(o--,1);break}n.add(p)}}}}_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(u=>this._linkAtPosition(u.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 u=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(u){n=!0,this._handleNewLink(u);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&&Mz(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,Ho(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}}};nb=jn([Pe(1,j0),Pe(2,ea),Pe(3,Pi),Pe(4,sR)],nb);function Mz(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 jz=class extends Cz{constructor(e={}){super(e),this._linkifier=this._register(new lc),this.browser=xR,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new lc),this._onCursorMove=this._register(new Te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Te),this.onKey=this._onKey.event,this._onRender=this._register(new Te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Te),this.onBell=this._onBell.event,this._onFocus=this._register(new Te),this._onBlur=this._register(new Te),this._onA11yCharEmitter=this._register(new Te),this._onA11yTabEmitter=this._register(new Te),this._onWillOpen=this._register(new Te),this._setup(),this._decorationService=this._instantiationService.createInstance(Az),this._instantiationService.setService(Th,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(w9),this._instantiationService.setService(sR,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(xy)),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(wi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(wi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(wi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(wi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(wn(()=>{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=gn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ve.ESC}]${i};${vz(r)}${SR.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Gn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(u=>u[o]=Gn.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(dp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,u=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=u+"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(ht(this.element,"copy",t=>{this.hasSelection()&&B$(t,this._selectionService)}));let e=t=>$$(t,this.textarea,this.coreService,this.optionsService);this._register(ht(this.textarea,"paste",e)),this._register(ht(this.element,"paste",e)),CR?this._register(ht(this.element,"mousedown",t=>{t.button===2&&Mk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ht(this.element,"contextmenu",t=>{Mk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H0&&this._register(ht(this.element,"auxclick",t=>{t.button===1&&YA(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ht(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ht(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ht(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ht(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ht(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ht(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ht(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(ht(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",by.get()),TR||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(b9,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Qr,this._coreBrowserService),this._register(ht(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(ht(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wy,this._document,this._helperContainer),this._instantiationService.setService(Up,this._charSizeService),this._themeService=this._instantiationService.createInstance(Vy),this._instantiationService.setService(gc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cp),this._instantiationService.setService(iR,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Gy,this.rows,this.screenElement)),this._instantiationService.setService(ea,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(Hy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(qy),this._instantiationService.setService(j0,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(nb,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(Py,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(Ky,this.element,this.screenElement,i)),this._instantiationService.setService(G$,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(wi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(zy,this.screenElement)),this._register(ht(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(dp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(lp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(lp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Uy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let u=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!u)return!1;let d,f;switch(o.overrideType||o.type){case"mousemove":f=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":f=0,d=o.button<3?o.button:3;break;case"mousedown":f=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let p=o.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=p<0?0:1,d=4;break;default:return!1}return f===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:d,action:f,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(ht(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(ht(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 u=ve.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!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){VA(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=Ez(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ve.ETX||n.key===ve.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Oz(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(Wn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Oz(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Dz=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)}},Iz=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},x2=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 Iz(t)}getNullCell(){return new Is}},Bz=class extends xt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Te),this.onBufferChange=this._onBufferChange.event,this._normal=new x2(this._core.buffers.normal,"normal"),this._alternate=new x2(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)}},$z=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)}},Pz=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}},zz=["cols","rows"],or=0,Hz=class extends xt{constructor(e){super(),this._core=this._register(new jz(e)),this._addonManager=this._register(new Dz),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(zz.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 $z(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Pz(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 Bz(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 by.get()},set promptLabel(e){by.set(e)},get tooMuchOutput(){return Sy.get()},set tooMuchOutput(e){Sy.set(e)}}}_verifyIntegers(...e){for(or of e)if(or===1/0||isNaN(or)||or%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(or of e)if(or&&(or===1/0||isNaN(or)||or%1!==0||or<0))throw new Error("This API only accepts positive integers")}};function Fz(e){let t=!1,n=!1,i=!1,r=!1,o=null,u=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},f=()=>{u!==null&&(clearTimeout(u),u=null),n=!1},p=()=>{f(),n=!0,u=setTimeout(()=>{u=null,n=!1},0)},m=()=>{i=!1,o!==null&&clearTimeout(o),u!==null&&(clearTimeout(u),u=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},_=()=>{t=!1,o===null&&(f(),i=!1)},b=()=>{t=!1,r=!1,f(),d()},S=w=>{if(o===null){if(t||n||Wz(w)){i=!0,n&&!t?m():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,p(),i&&m()},onCompositionCancel:_,handleKeyEvent(w){return Uz(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 Uz(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function Wz(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function qz({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,u=!1;const d=()=>{o=!1,u=!1},f=b=>{C2(b)&&(o=!0,u=!1)},p=()=>{o&&(u=!0)},m=b=>{const S=o&&u&&C2(b);if(d(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},_=e.onSelectionChange(p);return t.addEventListener("mousedown",f,!0),n.addEventListener("mouseup",m),n.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),_.dispose(),t.removeEventListener("mousedown",f,!0),n.removeEventListener("mouseup",m),n.removeEventListener("blur",d))}}}function C2(e){return e.button===0}function Gz(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 Kz={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:Gz((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},Vz="Symbols Nerd Font Mono",sf=`ui-monospace, "SF Mono", Menlo, "${Vz}", monospace`,F0=14,BR=10,$R=22,Yz={min:BR,max:$R},Xz="cascadia",hh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${sf}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${sf}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${sf}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${sf}`,meta:"Variable · Adobe mono"}],Jl=hh[0];function Zz(e){return hh.find(t=>t.id===e)??Jl}function dh(){return{source:"curated",id:Xz,customName:"",family:Jl.family,size:F0}}function U0(e,t){const n=Zz(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:G0(t)}}function W0(e,t){const n=eH(e);return{source:"custom",id:null,customName:n,family:Qf(n,Jl.family),size:G0(t)}}function PR(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=G0(typeof t.size=="number"?t.size:F0);return t.source==="custom"&&typeof t.customName=="string"?W0(t.customName,n):typeof t.id=="string"&&Qz(t.id)?U0(t.id,n):null}function q0(e){if(!e)return dh();try{const t=PR(JSON.parse(e));if(t!==null)return t}catch{}return dh()}function Jz(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function G0(e){return Number.isFinite(e)?Math.min($R,Math.max(BR,Math.round(e))):F0}function Qz(e){return hh.some(t=>t.id===e)}function eH(e){return Bp(e)}const fp="fleet-plugin.terminal.renderer",Ql="fleet-plugin.terminal.font",k2="fleet-console.terminalRenderer",E2="fleet-console.terminalFont",ib=new Set;let qa=fH(),fh=null,Bo=0;function tH(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(fp)!==null||window.localStorage.getItem(Ql)!==null)return;const e=window.localStorage.getItem(k2),t=window.localStorage.getItem(E2),n=e==="webgl"||e==="dom"?e:"webgl",i=q0(t);window.localStorage.setItem(fp,n),window.localStorage.setItem(Ql,Jz(i)),window.localStorage.removeItem(k2),window.localStorage.removeItem(E2)}catch{}}function nH(e){Bo+=1,fh=e,oH()}function zR(){return y.useSyncExternalStore(dH,T2,T2)}function iH(e){uH(e),cc({renderer:e})}function sH(e){const t=U0(e,qa.font.size);Bo+=1,cc({font:t}),Gp(t)}function rH(e){const t=W0(e,qa.font.size);Bo+=1,cc({font:t}),Gp(t)}function aH(e){const t=qa.font.source==="custom"?W0(qa.font.customName,e):U0(qa.font.id,e);Bo+=1,cc({font:t}),Gp(t)}async function oH(){if(!fh)return;const e=Bo;try{const t=await fh.read("terminal");if(t!==null){const n=PR(t.font);if(n!==null){if(e!==Bo)return;cc({font:n});try{window.localStorage.removeItem(Ql)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Ql)}catch{}if(n!==null){const i=q0(n);if(e!==Bo)return;cc({font:i}),Gp(i);try{window.localStorage.removeItem(Ql)}catch{}}}}catch{}}async function Gp(e){if(fh)try{await fh.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function lH(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(fp);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function cH(){if(typeof window>"u")return dh();try{return q0(window.localStorage.getItem(Ql))}catch{return dh()}}function uH(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fp,e)}catch{}}function hH(){for(const e of ib)e()}function cc(e){qa={...qa,...e},hH()}function dH(e){return ib.add(e),()=>{ib.delete(e)}}function T2(){return qa}function fH(){return typeof window>"u"?{renderer:"webgl",font:dh()}:(tH(),{renderer:lH(),font:cH()})}function A2({baseY:e,viewportY:t}){return t>=e}function pH(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:p,viewportY:m}=e.getViewport();n=Math.max(0,p-m)},o=()=>{if(n===null)return;const{baseY:p}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(p,p-n)))},u=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{i===null&&(i=e.requestFrame(()=>{i=null,u()}))},f=()=>{t&&(u(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=A2(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,f()},preserveAfterGeometryChange:p=>{p(),u(),d()},restoreAfterOutputParsing:()=>{if(t){f();return}A2(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function mH({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!gH(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function gH(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 _H="Symbols Nerd Font Mono",vH=`1em "${_H}"`,yH=650;let rf=null;function HR(){return rf||(rf=SH(),rf)}async function bH(){await wH(HR(),yH)}async function SH(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(vH)}catch{}}async function wH(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 xH=80,CH=16,kH=250,EH=1024*1024,TH=120,AH={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)"},RH={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)"},NH={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 K0({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,keyboardFocusRequestId:u,zoom:d=1}){const f=i,{renderer:p,font:m}=zR(),_=y.useRef(null),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(null),k=y.useRef(null),O=y.useRef(null),[P,F]=y.useState(d),T=y.useRef(r);T.current=r;const L=y.useRef(o);L.current=o;const[M,z]=y.useState("connecting"),[U,Z]=y.useState(0),[Q,G]=y.useState(0);y.useEffect(()=>{const D=_.current;if(!D)return;let N=!1,E=null,$=null,j=null;return(async()=>{if(await bH(),N)return;const H=R2(f),A=new Hz({...Kz,fontFamily:m.family,fontSize:m.size*P,theme:H});b.current=A;const Y=new C7;O.current=Y,A.loadAddon(Y),A.open(D),N2(D,H);const J=qz({terminal:A,selectionTarget:D,windowTarget:window,clipboard:navigator.clipboard});A.loadAddon(new Z7),A.unicode.activeVersion="11";const he=Fz(()=>A.input(`
|
|
98
|
+
`)),de=D.querySelector("textarea.xterm-helper-textarea, textarea")??D;de.addEventListener("compositionstart",he.onCompositionStart),de.addEventListener("compositionend",he.onCompositionEnd),de.addEventListener("focusout",he.onCompositionCancel);const ae=mH({getPlatform:()=>navigator.platform,getSelection:()=>A.getSelection(),writeText:Me=>navigator.clipboard.writeText(Me)});A.attachCustomKeyEventHandler(Me=>ae.handleKeyEvent(Me)&&he.handleKeyEvent(Me));const we=pH({getViewport:()=>A.buffer.active,scrollToBottom:()=>LH(A),scrollToLine:Me=>MH(A,Me),requestFrame:Me=>window.requestAnimationFrame(Me),cancelFrame:Me=>window.cancelAnimationFrame(Me)});k.current=we;const je=jH(D,de,we.recordUserViewportChange),De=IH(A,L.current!==!1,we.restoreAfterOutputParsing);x.current=De;const We=_7({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:Me=>A.onData(et=>{we.resumeFollowing(),Me(et)}),write:De.write},onExit:()=>T.current?.(),onStatus:(Me,et)=>{z(et?`${Me}: ${et}`:Me)}});S.current=We;const ke=()=>{we.preserveAfterGeometryChange(()=>{Y.fit(),We.resize(A.cols,A.rows),A.refresh(0,A.rows-1)})},Le=()=>{$&&clearTimeout($),$=setTimeout(()=>{$=null,N||ke()},xH)},Ae=async()=>{await document.fonts?.ready,!N&&(ke(),We.start(),G(Me=>Me+1),L.current!==!1&&A.focus())};E=new ResizeObserver(Le),E.observe(D),Ae(),j=()=>{$&&clearTimeout($),de.removeEventListener("compositionstart",he.onCompositionStart),de.removeEventListener("compositionend",he.onCompositionEnd),de.removeEventListener("focusout",he.onCompositionCancel),he.dispose(),We.dispose(),J.dispose(),je.dispose(),De.dispose(),we.dispose(),b.current=null,S.current=null,x.current=null,k.current=null,O.current=null;try{A.dispose()}catch{}},Z(Me=>Me+1)})(),()=>{N=!0,E?.disconnect(),j?.()}},[e,t,n]),y.useEffect(()=>{x.current?.setActive(o!==!1),o&&(b.current?.focus(),k.current?.resumeFollowing())},[o,u,Q]),y.useEffect(()=>{const D=b.current;if(!D)return;let N=!1;if(p==="webgl")try{const E=new M$;w.current=E,E.onContextLoss(()=>{if(!N){try{E.dispose()}catch{}w.current===E&&(w.current=null)}}),D.loadAddon(E)}catch{try{w.current?.dispose()}catch{}w.current=null}return()=>{N=!0;const E=w.current;if(E){w.current=null;try{E.dispose()}catch{}}}},[p,e,U]),y.useEffect(()=>{const D=b.current,N=_.current;if(!D||!N)return;const E=R2(f);D.options.theme=E,N2(N,E)},[f,U]),y.useEffect(()=>{const D=b.current;D&&(D.options.fontFamily=m.family,L2(D,O.current,S.current,k.current))},[m.family,U]),y.useEffect(()=>{if(d===P)return;const D=setTimeout(()=>F(d),TH);return()=>clearTimeout(D)},[d,P]),y.useEffect(()=>{const D=b.current;D&&(D.options.fontSize=m.size*P,L2(D,O.current,S.current,k.current))},[P,m.size,U]);const B=M.startsWith("live"),R=P===1?void 0:{width:`${P*100}%`,height:`${P*100}%`,transform:`scale(${1/P})`,transformOrigin:"0 0"};return c.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:c.jsxs("div",{className:"terminal-shell",children:[B?null:c.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[c.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),M]}),c.jsx("div",{className:"terminal-viewport",children:c.jsx("div",{className:"terminal-canvas",ref:_,style:R})})]})})}function R2(e){return e==="carbon"?NH:e==="maritime"?RH:AH}function N2(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function LH(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function MH(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function jH(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const u=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},d=()=>u(),f=()=>{r=!0},p=S=>{r=OH(S,i)},m=()=>{r&&u()},_=()=>{const S=r;r=!1,S&&u()},b=S=>{DH(S)&&u()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",f,{capture:!0,passive:!0}),i.addEventListener("touchend",_),i.addEventListener("touchcancel",_),i.addEventListener("pointerdown",p,!0),i.addEventListener("scroll",m),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",f,!0),i.removeEventListener("touchend",_),i.removeEventListener("touchcancel",_),i.removeEventListener("pointerdown",p,!0),i.removeEventListener("scroll",m),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function OH(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function DH(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function IH(e,t,n){let i=t,r=!1,o=null,u=0,d=[];const f=()=>{o&&(clearTimeout(o),o=null)},p=()=>{if(f(),r||u===0)return;const _=BH(d,u);d=[],u=0,e.write(_,()=>{r||n()})},m=()=>{r||o||u===0||(o=setTimeout(p,i?CH:kH))};return{write:_=>{if(!(r||_.byteLength===0)){if(d.push(_),u+=_.byteLength,u>=EH){p();return}m()}},setActive:_=>{if(i!==_){if(i=_,f(),i){p();return}m()}},dispose:()=>{p(),r=!0,d=[],u=0,f()}}}function BH(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 L2(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 $H=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),PH=50*1024;function ph(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(ph):Object.entries(e).some(([t,n])=>$H.has(t.toLowerCase())||ph(n))}function zH(e){if(ph(e)||!Uo(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(UH);return t.every(n=>n!==null)?{clis:t}:null}function HH(e){return ph(e)||!Uo(e)||typeof e.type!="string"?null:e.type==="connected"?{type:"connected"}:(e.type==="chunk"||e.type==="thought")&&typeof e.text=="string"?{type:e.type,text:e.text}:e.type==="tool"&&typeof e.title=="string"&&typeof e.status=="string"?{type:"tool",title:e.title,status:e.status}:e.type==="complete"?{type:"complete"}:e.type==="error"&&FR(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&Uo(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&WH(e.artifact.html)<=PH?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function FH(e){return!ph(e)&&Uo(e)&&FR(e.error)?e.error:null}function UH(e){if(!Uo(e)||typeof e.cliId!="string"||typeof e.label!="string"||typeof e.available!="boolean"||!Array.isArray(e.models))return null;const t=e.models.map(n=>Uo(n)&&typeof n.id=="string"&&typeof n.label=="string"&&Array.isArray(n.effortLevels)&&n.effortLevels.every(i=>typeof i=="string")?{id:n.id,label:n.label,effortLevels:n.effortLevels,defaultEffort:typeof n.defaultEffort=="string"?n.defaultEffort:void 0}:null);return t.every(n=>n!==null)?{cliId:e.cliId,label:e.label,available:e.available,defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0,models:t}:null}function FR(e){return Uo(e)&&typeof e.code=="string"&&typeof e.message=="string"}function Uo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function WH(e){return new TextEncoder().encode(e).byteLength}class sb extends Error{constructor(t,n){super(n),this.code=t}code}const vc=e=>`analysis/${encodeURIComponent(e)}`;function qH(e,t,n,i){const r=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${r.toString()}`}async function GH(e){const t=await Kp(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=zH(n);if(i)return i;throw Vp(t.status,n)}async function UR(e,t){try{const n=await Kp(e,`${vc(t)}/ready`);if(!n.ok)return!1;const i=await n.json().catch(()=>null);return!!i&&typeof i=="object"&&!Array.isArray(i)&&i.ready===!0}catch{return!1}}async function KH(e,t,n,i){await V0(e,`${vc(t)}/start`,n,i)}async function VH(e,t,n){await V0(e,`${vc(t)}/message`,{text:n})}async function J_(e,t){await V0(e,`${vc(t)}/stop`,{})}async function WR(e,t){const n=await Kp(e,`${vc(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw Vp(n.status,await n.json().catch(()=>null))}function YH(e,t,n){return e.subscribe("terminal",`${vc(t)}/stream`,i=>{try{const r=HH(JSON.parse(i.data));r&&n(r)}catch{}})}async function V0(e,t,n,i){const r=await Kp(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!r.ok)throw Vp(r.status,await r.json().catch(()=>null))}async function Kp(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Ai?Vp(i.status,i.body):i}}function Vp(e,t){const n=FH(t);return new sb(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const XH=32,rb={catalog:null,cliId:"",model:"",effort:"",started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],artifactsAutoOpenArmed:!0,error:null};function ZH(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...M2(t.catalog)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),r=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:r?.id??"",effort:r?.defaultEffort??r?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(r=>r.cliId===e.cliId)?.models.find(r=>r.id===t.model);return{...e,model:t.model,effort:i?.defaultEffort??i?.effortLevels[0]??""}}if(t.type==="select-effort"&&!e.started)return{...e,effort:t.effort};if(t.type==="sending")return{...e,started:e.started||t.started,busy:!0,phase:"starting",latestActivity:{kind:"starting",connected:!t.started},runStartedAt:t.now,runEndedAt:null,error:null,tools:[],entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return ku(e,t.message,t.now);if(t.type==="session-lost")return{...ku(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...ku(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,error:null};if(t.type==="stop-failed")return{...ku(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...rb,catalog:i,...M2(i)}:rb}if(t.type==="clear-artifacts")return{...e,artifacts:[],artifactsAutoOpenArmed:!0};if(t.type==="artifacts-chip-disarm")return e.artifactsAutoOpenArmed?{...e,artifactsAutoOpenArmed:!1}:e;if(t.type==="artifacts-chip-rearm")return e.artifactsAutoOpenArmed?e:{...e,artifactsAutoOpenArmed:!0};if(t.type!=="event")return e;const n=t.event;return n.type==="connected"?e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e:n.type==="chunk"?{...e,phase:"writing",latestActivity:{kind:"writing"},entries:JH(e.entries,n.text)}:n.type==="thought"?{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}}:n.type==="tool"?{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(i=>i.title!==n.title),{title:n.title,status:n.status}]}:n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)].slice(0,XH)}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,error:null}:ku(e,n.error.message,t.now)}function M2(e){const t=e.clis.find(r=>r.cliId==="claude"&&r.available)??e.clis.find(r=>r.available)??e.clis[0],n=t?.models.find(r=>t.cliId==="claude"&&r.id==="sonnet")??t?.models.find(r=>r.id===t.defaultModel)??t?.models[0],i=n?.effortLevels.includes("medium")?"medium":n?.defaultEffort??n?.effortLevels[0]??"";return{cliId:t?.cliId??"",model:n?.id??"",effort:i}}function ku(e,t,n){return{...e,busy:!1,phase:"error",runEndedAt:n,error:t}}function JH(e,t){const n=e.at(-1);return n?.role==="analyst"?[...e.slice(0,-1),{role:"analyst",text:n.text+t}]:[...e,{role:"analyst",text:t}]}const mh=new Map,Eu=new Map;function qR(e){const t=QH(e.operationId,e.api);return{state:y.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function QH(e,t){const n=mh.get(e);if(n)return n;const i=sF(e,t);return mh.set(e,i),i}function eF(e){mh.get(e)?.dispose()}function tF(e){mh.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const nF=2e3,iF=12e4;function sF(e,t){let n=rb,i=!1,r=null,o=null,u=null,d=null,f=null,p=null,m=0,_=0;const b=new Set,S=L=>{if(i)return;const M=ZH(n,L);if(M!==n){n=M;for(const z of b)z()}},w=()=>{o!==null&&(clearTimeout(o),o=null)},x=()=>{w(),o=setTimeout(()=>{o=null,S({type:"error",message:"Analysis response timed out.",now:Date.now()})},iF)},k=()=>{w(),m+=1,_+=1;const L=r;r=null,L?.()},O=()=>{k(),S({type:"session-lost",now:Date.now()})},P=async()=>{if(r)return;const L=++m;let M=null;const z=new Promise(U=>{M=U});r=YH(t,e,U=>{if(!(L!==m||i)){if(U.type==="connected"){S({type:"event",event:U,now:Date.now()}),M?.(),M=null;return}if(U.type==="error"&&j2(U.error.code)){M?.(),M=null,O();return}(U.type==="complete"||U.type==="error")&&w(),S({type:"event",event:U,now:Date.now()})}}),await Promise.race([z,new Promise(U=>setTimeout(U,nF))])},T={getSnapshot:()=>n,subscribe:L=>(b.add(L),()=>b.delete(L)),dispatch:S,send:async L=>{const M=Eu.get(e);if(M&&await M,p)try{await p}catch{return}f&&await f;const z=L.trim();if(!z||n.busy||i)return;const U=!n.started,Z=++_,Q={cliId:n.cliId,model:n.model,effort:n.effort};if(S({type:"sending",started:U,text:z,now:Date.now()}),U){const G=new AbortController,B=KH(t,e,Q,G.signal);d=G,u=B;try{await B}catch(R){if(i||Z!==_)return;if(!(R instanceof sb&&R.code==="analysis_session_exists")){S({type:"start-failed",message:Tu(R),now:Date.now()});return}}finally{d===G&&(d=null),u===B&&(u=null)}if(i||Z!==_||!n.started||(await P(),Z!==_||!n.started))return}try{if(await VH(t,e,z),Z!==_||!n.busy||!n.started)return;x()}catch(G){if(i||Z!==_)return;G instanceof sb&&j2(G.code)?O():S({type:"error",message:Tu(G),now:Date.now()})}},stop:async()=>{if(p){await p.catch(()=>{});return}if(f)return f;if(i||!n.started)return;k(),S({type:"stopped",now:Date.now()});const L=J_(t,e).catch(M=>{S({type:"stop-failed",message:Tu(M),now:Date.now()})});f=L,await L,f===L&&(f=null)},reset:async()=>{if(p)return p;if(i)return;const L=n.started||n.phase!=="idle"||n.entries.length>0||n.artifacts.length>0;k();const M=(async()=>{f&&await f,u&&await u.catch(()=>{}),L&&await J_(t,e),await WR(t,e).catch(()=>{}),S({type:"reset"})})().catch(z=>{throw S({type:"error",message:`Reset failed: ${Tu(z)}`,now:Date.now()}),z});p=M;try{await M}finally{p===M&&(p=null)}},dispose:()=>{if(i)return;const L=Eu.get(e),M=p,z=f,U=u,Z=d;i=!0,mh.delete(e),k(),b.clear(),Z?.abort();const Q=(async()=>{L&&await L,U&&await U.catch(()=>{}),M&&await M.catch(()=>{}),z&&await z.catch(()=>{}),await J_(t,e)})().catch(()=>{});Eu.set(e,Q),Q.finally(()=>{Eu.get(e)===Q&&Eu.delete(e)})}};return GH(t).then(L=>S({type:"catalog",catalog:L})).catch(L=>S({type:"error",message:Tu(L),now:Date.now()})),T}function Tu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function j2(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function rF({context:e}){const{state:t,dispatch:n}=qR(e),i=y.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),r=t.artifacts[0]?.id??null,[o,u]=y.useState(null),[d,f]=y.useState(!1),p=y.useId(),m=y.useRef(null);y.useEffect(()=>{r&&u(r)},[r]);const _=i.find(S=>S.id===o)??i.at(-1)??null,b=i.length;return y.useEffect(()=>{if(!d)return;const S=x=>{x.target instanceof Node&&!m.current?.contains(x.target)&&f(!1)},w=x=>{x.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",w)}},[d]),y.useEffect(()=>{b||f(!1)},[b]),c.jsxs("section",{className:"session-analyst__artifacts","aria-label":"Artifacts",children:[c.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[c.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:"Artifacts"}),c.jsx("small",{children:"Visual outputs from this analysis"})]}),c.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:m,children:[c.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":d,"aria-controls":p,"aria-haspopup":"listbox","aria-label":`${d?"Hide":"Show"} artifacts (${b} ${b===1?"item":"items"})`,onClick:()=>f(S=>!S),disabled:!b,children:[c.jsx("strong",{children:b})," ",c.jsx("span",{children:b===1?"item":"items"}),c.jsx("i",{"aria-hidden":"true"})]}),d?c.jsx("div",{className:"session-analyst__artifact-menu",id:p,role:"listbox","aria-label":"Published artifacts",children:i.map(S=>{const w=S.id===_?.id;return c.jsxs("button",{type:"button",role:"option","aria-selected":w,className:w?"is-active":void 0,title:S.title,onClick:()=>{u(S.id),f(!1)},children:[c.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),c.jsx("strong",{children:S.title}),c.jsx(GR,{createdAt:S.createdAt})]},S.id)})}):null]}),c.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{f(!1),n({type:"clear-artifacts"}),WR(e.api,e.operationId).catch(()=>{})},disabled:!b,children:"Clear"})]}),b===0?c.jsxs("div",{className:"session-analyst__artifacts-empty",children:[c.jsx("strong",{children:"No artifacts yet"}),"Artifacts the analyst publishes will appear here."]}):c.jsx("div",{className:"session-analyst__artifact-content",children:_?c.jsx(aF,{artifact:_,theme:e.theme},_.id):null})]})}function aF({artifact:e,theme:t}){if(!e.id)return null;const n=getComputedStyle(document.documentElement),i=n.getPropertyValue("--ink-veil").trim()||"Canvas",r=n.getPropertyValue("--ink-pearl").trim()||"CanvasText";return c.jsxs("article",{"aria-label":"Selected artifact preview",children:[c.jsxs("header",{children:[c.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),c.jsx(GR,{createdAt:e.createdAt})]}),c.jsx("iframe",{title:e.title,src:qH(e.id,t,i,r),sandbox:"allow-scripts"})]})}function GR({createdAt:e}){const t=new Date(e),n=Number.isFinite(t.getTime());return c.jsx("time",{dateTime:n?t.toISOString():void 0,children:n?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Unknown time"})}function Y0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ko=Y0();function KR(e){Ko=e}var th={exec:()=>null};function Pt(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let u=typeof o=="string"?o:o.source;return u=u.replace(Bi.caret,"$1"),n=n.replace(r,u),i},getRegex:()=>new RegExp(n,t)};return i}var oF=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Bi={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")},lF=/^(?:[ \t]*(?:\n|$))+/,cF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,uF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,hF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,X0=/(?:[*+-]|\d{1,9}[.)])/,VR=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,YR=Pt(VR).replace(/bull/g,X0).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(),dF=Pt(VR).replace(/bull/g,X0).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(),Z0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fF=/^[^\n]+/,J0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pF=Pt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",J0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mF=Pt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,X0).getRegex(),Yp="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",Q0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gF=Pt("^ {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",Q0).replace("tag",Yp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),XR=Pt(Z0).replace("hr",Nh).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",Yp).getRegex(),_F=Pt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",XR).getRegex(),e1={blockquote:_F,code:cF,def:pF,fences:uF,heading:hF,hr:Nh,html:gF,lheading:YR,list:mF,newline:lF,paragraph:XR,table:th,text:fF},O2=Pt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nh).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",Yp).getRegex(),vF={...e1,lheading:dF,table:O2,paragraph:Pt(Z0).replace("hr",Nh).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",Yp).getRegex()},yF={...e1,html:Pt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q0).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:th,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Pt(Z0).replace("hr",Nh).replace("heading",` *#{1,6} *[^
|
|
99
|
+
]`).replace("lheading",YR).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,SF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ZR=/^( {2,}|\\)\n(?!\s*$)/,wF=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xp=/[\p{P}\p{S}]/u,t1=/[\s\p{P}\p{S}]/u,JR=/[^\s\p{P}\p{S}]/u,xF=Pt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,t1).getRegex(),QR=/(?!~)[\p{P}\p{S}]/u,CF=/(?!~)[\s\p{P}\p{S}]/u,kF=/(?:[^\s\p{P}\p{S}]|~)/u,EF=Pt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",oF?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),eN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,TF=Pt(eN,"u").replace(/punct/g,Xp).getRegex(),AF=Pt(eN,"u").replace(/punct/g,QR).getRegex(),tN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",RF=Pt(tN,"gu").replace(/notPunctSpace/g,JR).replace(/punctSpace/g,t1).replace(/punct/g,Xp).getRegex(),NF=Pt(tN,"gu").replace(/notPunctSpace/g,kF).replace(/punctSpace/g,CF).replace(/punct/g,QR).getRegex(),LF=Pt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,JR).replace(/punctSpace/g,t1).replace(/punct/g,Xp).getRegex(),MF=Pt(/\\(punct)/,"gu").replace(/punct/g,Xp).getRegex(),jF=Pt(/^<(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(),OF=Pt(Q0).replace("(?:-->|$)","-->").getRegex(),DF=Pt("^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",OF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,IF=Pt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nN=Pt(/^!?\[(label)\]\[(ref)\]/).replace("label",pp).replace("ref",J0).getRegex(),iN=Pt(/^!?\[(ref)\](?:\[\])?/).replace("ref",J0).getRegex(),BF=Pt("reflink|nolink(?!\\()","g").replace("reflink",nN).replace("nolink",iN).getRegex(),D2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,n1={_backpedal:th,anyPunctuation:MF,autolink:jF,blockSkip:EF,br:ZR,code:SF,del:th,emStrongLDelim:TF,emStrongRDelimAst:RF,emStrongRDelimUnd:LF,escape:bF,link:IF,nolink:iN,punctuation:xF,reflink:nN,reflinkSearch:BF,tag:DF,text:wF,url:th},$F={...n1,link:Pt(/^!?\[(label)\]\((.*?)\)/).replace("label",pp).getRegex(),reflink:Pt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pp).getRegex()},ab={...n1,emStrongRDelimAst:NF,emStrongLDelim:AF,url:Pt(/^((?: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:Pt(/^([`~]+|[^`~])(?:(?= {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()},PF={...ab,br:Pt(ZR).replace("{2,}","*").getRegex(),text:Pt(ab.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},af={normal:e1,gfm:vF,pedantic:yF},Au={normal:n1,gfm:ab,breaks:PF,pedantic:$F},zF={"&":"&","<":"<",">":">",'"':""","'":"'"},I2=e=>zF[e];function cr(e,t){if(t){if(Bi.escapeTest.test(e))return e.replace(Bi.escapeReplace,I2)}else if(Bi.escapeTestNoEncode.test(e))return e.replace(Bi.escapeReplaceNoEncode,I2);return e}function B2(e){try{e=encodeURI(e).replace(Bi.percentDecode,"%")}catch{return null}return e}function $2(e,t){let n=e.replace(Bi.findPipe,(o,u,d)=>{let f=!1,p=u;for(;--p>=0&&d[p]==="\\";)f=!f;return f?"|":" |"}),i=n.split(Bi.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(Bi.slashPipe,"|");return i}function Ru(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 HF(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,u=t.title||null,d=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:u,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,f}function FF(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
100
|
+
`).map(o=>{let u=o.match(n.other.beginningSpace);if(u===null)return o;let[d]=u;return d.length>=r.length?o.slice(r.length):o}).join(`
|
|
101
|
+
`)}var mp=class{options;rules;lexer;constructor(e){this.options=e||Ko}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:Ru(n,`
|
|
102
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=FF(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=Ru(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:Ru(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ru(t[0],`
|
|
104
|
+
`).split(`
|
|
105
|
+
`),i="",r="",o=[];for(;n.length>0;){let u=!1,d=[],f;for(f=0;f<n.length;f++)if(this.rules.other.blockquoteStart.test(n[f]))d.push(n[f]),u=!0;else if(!u)d.push(n[f]);else break;n=n.slice(f);let p=d.join(`
|
|
106
|
+
`),m=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
108
|
+
${p}`:p,r=r?`${r}
|
|
109
|
+
${m}`:m;let _=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=_,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
|
|
110
|
+
`+n.join(`
|
|
111
|
+
`),x=this.blockquote(w);o[o.length-1]=x,i=i.substring(0,i.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
|
|
112
|
+
`+n.join(`
|
|
113
|
+
`),x=this.list(w);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,n=w.substring(o.at(-1).raw.length).split(`
|
|
114
|
+
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),u=!1;for(;e;){let f=!1,p="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let _=t[2].split(`
|
|
115
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,O=>" ".repeat(3*O.length)),b=e.split(`
|
|
116
|
+
`,1)[0],S=!_.trim(),w=0;if(this.options.pedantic?(w=2,m=_.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,m=_.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(b)&&(p+=b+`
|
|
117
|
+
`,e=e.substring(b.length+1),f=!0),!f){let O=this.rules.other.nextBulletRegex(w),P=this.rules.other.hrRegex(w),F=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),L=this.rules.other.htmlBeginRegex(w);for(;e;){let M=e.split(`
|
|
118
|
+
`,1)[0],z;if(b=M,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),z=b):z=b.replace(this.rules.other.tabCharGlobal," "),F.test(b)||T.test(b)||L.test(b)||O.test(b)||P.test(b))break;if(z.search(this.rules.other.nonSpaceChar)>=w||!b.trim())m+=`
|
|
119
|
+
`+z.slice(w);else{if(S||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||F.test(_)||T.test(_)||P.test(_))break;m+=`
|
|
120
|
+
`+b}!S&&!b.trim()&&(S=!0),p+=M+`
|
|
121
|
+
`,e=e.substring(M.length+1),_=z.slice(w)}}r.loose||(u?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(u=!0));let x=null,k;this.options.gfm&&(x=this.rules.other.listIsTask.exec(m),x&&(k=x[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:p,task:!!x,checked:k,loose:!1,text:m,tokens:[]}),r.raw+=p}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 f=0;f<r.items.length;f++)if(this.lexer.state.top=!1,r.items[f].tokens=this.lexer.blockTokens(r.items[f].text,[]),!r.loose){let p=r.items[f].tokens.filter(_=>_.type==="space"),m=p.length>0&&p.some(_=>this.rules.other.anyLine.test(_.raw));r.loose=m}if(r.loose)for(let f=0;f<r.items.length;f++)r.items[f].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=$2(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
122
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?o.align.push("right"):this.rules.other.tableAlignCenter.test(u)?o.align.push("center"):this.rules.other.tableAlignLeft.test(u)?o.align.push("left"):o.align.push(null);for(let u=0;u<n.length;u++)o.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:o.align[u]});for(let u of r)o.rows.push($2(u,o.header.length).map((d,f)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[f]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
123
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Ru(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=HF(t[2],"()");if(o===-2)return;if(o>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,u).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,u,d=r,f=0,p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+r);(i=p.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(u=[...o].length,i[3]||i[4]){d+=u;continue}else if((i[5]||i[6])&&r%3&&!((r+u)%3)){f+=u;continue}if(d-=u,d>0)continue;u=Math.min(u,u+d+f);let m=[...i[0]][0].length,_=e.slice(0,r+i.index+m+u);if(Math.min(r,u)%2){let S=_.slice(1,-1);return{type:"em",raw:_,text:S,tokens:this.lexer.inlineTokens(S)}}let b=_.slice(2,-2);return{type:"strong",raw:_,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},qs=class ob{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ko,this.options.tokenizer=this.options.tokenizer||new mp,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:Bi,block:af.normal,inline:Au.normal};this.options.pedantic?(n.block=af.pedantic,n.inline=Au.pedantic):this.options.gfm&&(n.block=af.gfm,this.options.breaks?n.inline=Au.breaks:n.inline=Au.gfm),this.tokenizer.rules=n}static get rules(){return{block:af,inline:Au}}static lex(t,n){return new ob(n).lex(t)}static lexInline(t,n){return new ob(n).inlineTokens(t)}lex(t){t=t.replace(Bi.carriageReturn,`
|
|
124
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace(Bi.tabCharGlobal," ").replace(Bi.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(u=>(r=u.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 u=n.at(-1);r.raw.length===1&&u!==void 0?u.raw+=`
|
|
125
|
+
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
126
|
+
`)?"":`
|
|
127
|
+
`)+r.raw,u.text+=`
|
|
128
|
+
`+r.text,this.inlineQueue.at(-1).src=u.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 u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
129
|
+
`)?"":`
|
|
130
|
+
`)+r.raw,u.text+=`
|
|
131
|
+
`+r.raw,this.inlineQueue.at(-1).src=u.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 u=1/0,d=t.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(o=t.substring(0,u+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let u=n.at(-1);i&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
|
132
|
+
`)?"":`
|
|
133
|
+
`)+r.raw,u.text+=`
|
|
134
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.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 u=n.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
135
|
+
`)?"":`
|
|
136
|
+
`)+r.raw,u.text+=`
|
|
137
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(r);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}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 f=Object.keys(this.tokens.links);if(f.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)f.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 u=!1,d="";for(;t;){u||(d=""),u=!1;let f;if(this.options.extensions?.inline?.some(m=>(f=m.call({lexer:this},t,n))?(t=t.substring(f.raw.length),n.push(f),!0):!1))continue;if(f=this.tokenizer.escape(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.tag(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.link(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(f.raw.length);let m=n.at(-1);f.type==="text"&&m?.type==="text"?(m.raw+=f.raw,m.text+=f.text):n.push(f);continue}if(f=this.tokenizer.emStrong(t,i,d)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.codespan(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.br(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.del(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.autolink(t)){t=t.substring(f.raw.length),n.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(t))){t=t.substring(f.raw.length),n.push(f);continue}let p=t;if(this.options.extensions?.startInline){let m=1/0,_=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},_),typeof b=="number"&&b>=0&&(m=Math.min(m,b))}),m<1/0&&m>=0&&(p=t.substring(0,m+1))}if(f=this.tokenizer.inlineText(p)){t=t.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(d=f.raw.slice(-1)),u=!0;let m=n.at(-1);m?.type==="text"?(m.raw+=f.raw,m.text+=f.text):n.push(f);continue}if(t){let m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},gp=class{options;parser;constructor(e){this.options=e||Ko}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Bi.notSpaceStart)?.[0],r=e.replace(Bi.endingNewline,"")+`
|
|
138
|
+
`;return i?'<pre><code class="language-'+cr(i)+'">'+(n?r:cr(r,!0))+`</code></pre>
|
|
139
|
+
`:"<pre><code>"+(n?r:cr(r,!0))+`</code></pre>
|
|
140
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
141
|
+
${this.parser.parse(e)}</blockquote>
|
|
142
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
143
|
+
`}hr(e){return`<hr>
|
|
144
|
+
`}list(e){let t=e.ordered,n=e.start,i="";for(let u=0;u<e.items.length;u++){let d=e.items[u];i+=this.listitem(d)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
145
|
+
`+i+"</"+r+`>
|
|
146
|
+
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+cr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
147
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
148
|
+
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let u=0;u<o.length;u++)n+=this.tablecell(o[u]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
149
|
+
<thead>
|
|
150
|
+
`+t+`</thead>
|
|
151
|
+
`+i+`</table>
|
|
152
|
+
`}tablerow({text:e}){return`<tr>
|
|
153
|
+
${e}</tr>
|
|
154
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
155
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${cr(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=B2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+cr(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=B2(e);if(r===null)return cr(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${cr(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:cr(e.text)}},i1=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""}},Gs=class lb{options;renderer;textRenderer;constructor(t){this.options=t||Ko,this.options.renderer=this.options.renderer||new gp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new i1}static parse(t,n){return new lb(n).parse(t)}static parseInline(t,n){return new lb(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,f=this.options.extensions.renderers[d.type].call({parser:this},d);if(f!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){i+=f||"";continue}}let u=o;switch(u.type){case"space":{i+=this.renderer.space(u);continue}case"hr":{i+=this.renderer.hr(u);continue}case"heading":{i+=this.renderer.heading(u);continue}case"code":{i+=this.renderer.code(u);continue}case"table":{i+=this.renderer.table(u);continue}case"blockquote":{i+=this.renderer.blockquote(u);continue}case"list":{i+=this.renderer.list(u);continue}case"html":{i+=this.renderer.html(u);continue}case"def":{i+=this.renderer.def(u);continue}case"paragraph":{i+=this.renderer.paragraph(u);continue}case"text":{let d=u,f=this.renderer.text(d);for(;r+1<t.length&&t[r+1].type==="text";)d=t[++r],f+=`
|
|
156
|
+
`+this.renderer.text(d);n?i+=this.renderer.paragraph({type:"paragraph",raw:f,text:f,tokens:[{type:"text",raw:f,text:f,escaped:!0}]}):i+=f;continue}default:{let d='Token with "'+u.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 u=o;switch(u.type){case"escape":{i+=n.text(u);break}case"html":{i+=n.html(u);break}case"link":{i+=n.link(u);break}case"image":{i+=n.image(u);break}case"strong":{i+=n.strong(u);break}case"em":{i+=n.em(u);break}case"codespan":{i+=n.codespan(u);break}case"br":{i+=n.br(u);break}case"del":{i+=n.del(u);break}case"text":{i+=n.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},qu=class{options;block;constructor(e){this.options=e||Ko}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?qs.lex:qs.lexInline}provideParser(){return this.block?Gs.parse:Gs.parseInline}},sN=class{defaults=Y0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Gs;Renderer=gp;TextRenderer=i1;Lexer=qs;Tokenizer=mp;Hooks=qu;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 u of o)n=n.concat(this.walkTokens(u.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 u=r[o].flat(1/0);n=n.concat(this.walkTokens(u,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(...u){let d=r.renderer.apply(this,u);return d===!1&&(d=o.apply(this,u)),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 gp(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 u=o,d=n.renderer[u],f=r[u];r[u]=(...p)=>{let m=d.apply(r,p);return m===!1&&(m=f.apply(r,p)),m||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new mp(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 u=o,d=n.tokenizer[u],f=r[u];r[u]=(...p)=>{let m=d.apply(r,p);return m===!1&&(m=f.apply(r,p)),m}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new qu;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 u=o,d=n.hooks[u],f=r[u];qu.passThroughHooks.has(o)?r[u]=p=>{if(this.defaults.async&&qu.passThroughHooksRespectAsync.has(o))return(async()=>{let _=await d.call(r,p);return f.call(r,_)})();let m=d.call(r,p);return f.call(r,m)}:r[u]=(...p)=>{if(this.defaults.async)return(async()=>{let _=await d.apply(r,p);return _===!1&&(_=await f.apply(r,p)),_})();let m=d.apply(r,p);return m===!1&&(m=f.apply(r,p)),m}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(u){let d=[];return d.push(o.call(this,u)),r&&(d=d.concat(r.call(this,u))),d}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qs.lex(e,t??this.defaults)}parser(e,t){return Gs.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 u=r.hooks?await r.hooks.preprocess(t):t,d=await(r.hooks?await r.hooks.provideLexer():e?qs.lex:qs.lexInline)(u,r),f=r.hooks?await r.hooks.processAllTokens(d):d;r.walkTokens&&await Promise.all(this.walkTokens(f,r.walkTokens));let p=await(r.hooks?await r.hooks.provideParser():e?Gs.parse:Gs.parseInline)(f,r);return r.hooks?await r.hooks.postprocess(p):p})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let u=(r.hooks?r.hooks.provideLexer():e?qs.lex:qs.lexInline)(t,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let d=(r.hooks?r.hooks.provideParser():e?Gs.parse:Gs.parseInline)(u,r);return r.hooks&&(d=r.hooks.postprocess(d)),d}catch(u){return o(u)}}}onError(e,t){return n=>{if(n.message+=`
|
|
157
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+cr(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Wo=new sN;function sn(e,t){return Wo.parse(e,t)}sn.options=sn.setOptions=function(e){return Wo.setOptions(e),sn.defaults=Wo.defaults,KR(sn.defaults),sn};sn.getDefaults=Y0;sn.defaults=Ko;sn.use=function(...e){return Wo.use(...e),sn.defaults=Wo.defaults,KR(sn.defaults),sn};sn.walkTokens=function(e,t){return Wo.walkTokens(e,t)};sn.parseInline=Wo.parseInline;sn.Parser=Gs;sn.parser=Gs.parse;sn.Renderer=gp;sn.TextRenderer=i1;sn.Lexer=qs;sn.lexer=qs.lex;sn.Tokenizer=mp;sn.Hooks=qu;sn.parse=sn;sn.options;sn.setOptions;sn.use;sn.walkTokens;sn.parseInline;Gs.parse;qs.lex;const{entries:rN,setPrototypeOf:z2,isFrozen:UF,getPrototypeOf:WF,getOwnPropertyDescriptor:qF}=Object;let{freeze:$i,seal:$s,create:Bl}=Object,{apply:cb,construct:ub}=typeof Reflect<"u"&&Reflect;$i||($i=function(t){return t});$s||($s=function(t){return t});cb||(cb=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)});ub||(ub=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 Nu=Kn(Array.prototype.forEach),GF=Kn(Array.prototype.lastIndexOf),H2=Kn(Array.prototype.pop),Lu=Kn(Array.prototype.push),KF=Kn(Array.prototype.splice),ji=Array.isArray,Gu=Kn(String.prototype.toLowerCase),Q_=Kn(String.prototype.toString),F2=Kn(String.prototype.match),Ll=Kn(String.prototype.replace),U2=Kn(String.prototype.indexOf),VF=Kn(String.prototype.trim),YF=Kn(Number.prototype.toString),XF=Kn(Boolean.prototype.toString),W2=typeof BigInt>"u"?null:Kn(BigInt.prototype.toString),q2=typeof Symbol>"u"?null:Kn(Symbol.prototype.toString),Rn=Kn(Object.prototype.hasOwnProperty),Mu=Kn(Object.prototype.toString),Si=Kn(RegExp.prototype.test),of=ZF(TypeError);function Kn(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 cb(e,t,i)}}function ZF(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return ub(e,n)}}function yt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gu;if(z2&&z2(e,null),!ji(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(UF(t)||(t[i]=o),r=o)}e[r]=!0}return e}function JF(e){for(let t=0;t<e.length;t++)Rn(e,t)||(e[t]=null);return e}function Zi(e){const t=Bl(null);for(const[n,i]of rN(e))Rn(e,n)&&(ji(i)?t[n]=JF(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Zi(i):t[n]=i);return t}function QF(e){switch(typeof e){case"string":return e;case"number":return YF(e);case"boolean":return XF(e);case"bigint":return W2?W2(e):"0";case"symbol":return q2?q2(e):"Symbol()";case"undefined":return Mu(e);case"function":case"object":{if(e===null)return Mu(e);const t=e,n=$l(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:Mu(i)}return Mu(e)}default:return Mu(e)}}function $l(e,t){for(;e!==null;){const i=qF(e,t);if(i){if(i.get)return Kn(i.get);if(typeof i.value=="function")return Kn(i.value)}e=WF(e)}function n(){return null}return n}function eU(e){try{return Si(e,""),!0}catch{return!1}}const G2=$i(["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"]),ev=$i(["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"]),tv=$i(["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"]),tU=$i(["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"]),nv=$i(["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"]),nU=$i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),K2=$i(["#text"]),V2=$i(["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"]),iv=$i(["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"]),Y2=$i(["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"]),lf=$i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),iU=$s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sU=$s(/<%[\w\W]*|[\w\W]*%>/gm),rU=$s(/\$\{[\w\W]*/gm),aU=$s(/^data-[\-\w.\u00B7-\uFFFF]+$/),oU=$s(/^aria-[\-\w]+$/),aN=$s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lU=$s(/^(?:\w+script|data):/i),cU=$s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oN=$s(/^html$/i),uU=$s(/^[a-z][.\w]*(-[.\w]+)+$/i);var X2=Object.freeze({__proto__:null,ARIA_ATTR:oU,ATTR_WHITESPACE:cU,CUSTOM_ELEMENT:uU,DATA_ATTR:aU,DOCTYPE_NAME:oN,ERB_EXPR:sU,IS_ALLOWED_URI:aN,IS_SCRIPT_OR_DATA:lU,MUSTACHE_EXPR:iU,TMPLIT_EXPR:rU});const ju={element:1,text:3,progressingInstruction:7,comment:8,document:9},hU=function(){return typeof window>"u"?null:window},dU=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(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Z2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lN(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hU();const t=xe=>lN(xe);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==ju.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:u,Node:d,Element:f,NodeFilter:p,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:_,DOMParser:b,trustedTypes:S}=e,w=f.prototype,x=$l(w,"cloneNode"),k=$l(w,"remove"),O=$l(w,"nextSibling"),P=$l(w,"childNodes"),F=$l(w,"parentNode");if(typeof u=="function"){const xe=n.createElement("template");xe.content&&xe.content.ownerDocument&&(n=xe.content.ownerDocument)}let T,L="";const{implementation:M,createNodeIterator:z,createDocumentFragment:U,getElementsByTagName:Z}=n,{importNode:Q}=i;let G=Z2();t.isSupported=typeof rN=="function"&&typeof F=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:R,TMPLIT_EXPR:D,DATA_ATTR:N,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:q}=X2;let{IS_ALLOWED_URI:H}=X2,A=null;const Y=yt({},[...G2,...ev,...tv,...nv,...K2]);let J=null;const he=yt({},[...V2,...iv,...Y2,...lf]);let de=Object.seal(Bl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,we=null;const je=Object.seal(Bl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,We=!0,ke=!1,Le=!0,Ae=!1,Me=!0,et=!1,dt=!1,Je=!1,oe=!1,qe=!1,Ye=!1,Mt=!0,Wt=!1;const hn="user-content-";let ct=!0,Yt=!1,bt={},Se=null;const Qe=yt({},["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 Ne=null;const Ce=yt({},["audio","video","img","source","image","track"]);let ut=null;const dn=yt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",ne="http://www.w3.org/2000/svg",ce="http://www.w3.org/1999/xhtml";let $e=ce,Oe=!1,Ge=null;const Ht=yt({},[jt,ne,ce],Q_);let pi=yt({},["mi","mo","mn","ms","mtext"]),Ft=yt({},["annotation-xml"]);const On=yt({},["title","style","font","a","script"]);let yn=null;const K=["application/xhtml+xml","text/html"],pe="text/html";let be=null,Xe=null;const qt=n.createElement("form"),St=function(W){return W instanceof RegExp||W instanceof Function},Be=function(){let W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xe&&Xe===W)return;(!W||typeof W!="object")&&(W={}),W=Zi(W),yn=K.indexOf(W.PARSER_MEDIA_TYPE)===-1?pe:W.PARSER_MEDIA_TYPE,be=yn==="application/xhtml+xml"?Q_:Gu,A=Rn(W,"ALLOWED_TAGS")&&ji(W.ALLOWED_TAGS)?yt({},W.ALLOWED_TAGS,be):Y,J=Rn(W,"ALLOWED_ATTR")&&ji(W.ALLOWED_ATTR)?yt({},W.ALLOWED_ATTR,be):he,Ge=Rn(W,"ALLOWED_NAMESPACES")&&ji(W.ALLOWED_NAMESPACES)?yt({},W.ALLOWED_NAMESPACES,Q_):Ht,ut=Rn(W,"ADD_URI_SAFE_ATTR")&&ji(W.ADD_URI_SAFE_ATTR)?yt(Zi(dn),W.ADD_URI_SAFE_ATTR,be):dn,Ne=Rn(W,"ADD_DATA_URI_TAGS")&&ji(W.ADD_DATA_URI_TAGS)?yt(Zi(Ce),W.ADD_DATA_URI_TAGS,be):Ce,Se=Rn(W,"FORBID_CONTENTS")&&ji(W.FORBID_CONTENTS)?yt({},W.FORBID_CONTENTS,be):Qe,ae=Rn(W,"FORBID_TAGS")&&ji(W.FORBID_TAGS)?yt({},W.FORBID_TAGS,be):Zi({}),we=Rn(W,"FORBID_ATTR")&&ji(W.FORBID_ATTR)?yt({},W.FORBID_ATTR,be):Zi({}),bt=Rn(W,"USE_PROFILES")?W.USE_PROFILES&&typeof W.USE_PROFILES=="object"?Zi(W.USE_PROFILES):W.USE_PROFILES:!1,De=W.ALLOW_ARIA_ATTR!==!1,We=W.ALLOW_DATA_ATTR!==!1,ke=W.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=W.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ae=W.SAFE_FOR_TEMPLATES||!1,Me=W.SAFE_FOR_XML!==!1,et=W.WHOLE_DOCUMENT||!1,oe=W.RETURN_DOM||!1,qe=W.RETURN_DOM_FRAGMENT||!1,Ye=W.RETURN_TRUSTED_TYPE||!1,Je=W.FORCE_BODY||!1,Mt=W.SANITIZE_DOM!==!1,Wt=W.SANITIZE_NAMED_PROPS||!1,ct=W.KEEP_CONTENT!==!1,Yt=W.IN_PLACE||!1,H=eU(W.ALLOWED_URI_REGEXP)?W.ALLOWED_URI_REGEXP:aN,$e=typeof W.NAMESPACE=="string"?W.NAMESPACE:ce,pi=Rn(W,"MATHML_TEXT_INTEGRATION_POINTS")&&W.MATHML_TEXT_INTEGRATION_POINTS&&typeof W.MATHML_TEXT_INTEGRATION_POINTS=="object"?Zi(W.MATHML_TEXT_INTEGRATION_POINTS):yt({},["mi","mo","mn","ms","mtext"]),Ft=Rn(W,"HTML_INTEGRATION_POINTS")&&W.HTML_INTEGRATION_POINTS&&typeof W.HTML_INTEGRATION_POINTS=="object"?Zi(W.HTML_INTEGRATION_POINTS):yt({},["annotation-xml"]);const fe=Rn(W,"CUSTOM_ELEMENT_HANDLING")&&W.CUSTOM_ELEMENT_HANDLING&&typeof W.CUSTOM_ELEMENT_HANDLING=="object"?Zi(W.CUSTOM_ELEMENT_HANDLING):Bl(null);if(de=Bl(null),Rn(fe,"tagNameCheck")&&St(fe.tagNameCheck)&&(de.tagNameCheck=fe.tagNameCheck),Rn(fe,"attributeNameCheck")&&St(fe.attributeNameCheck)&&(de.attributeNameCheck=fe.attributeNameCheck),Rn(fe,"allowCustomizedBuiltInElements")&&typeof fe.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=fe.allowCustomizedBuiltInElements),Ae&&(We=!1),qe&&(oe=!0),bt&&(A=yt({},K2),J=Bl(null),bt.html===!0&&(yt(A,G2),yt(J,V2)),bt.svg===!0&&(yt(A,ev),yt(J,iv),yt(J,lf)),bt.svgFilters===!0&&(yt(A,tv),yt(J,iv),yt(J,lf)),bt.mathMl===!0&&(yt(A,nv),yt(J,Y2),yt(J,lf))),je.tagCheck=null,je.attributeCheck=null,Rn(W,"ADD_TAGS")&&(typeof W.ADD_TAGS=="function"?je.tagCheck=W.ADD_TAGS:ji(W.ADD_TAGS)&&(A===Y&&(A=Zi(A)),yt(A,W.ADD_TAGS,be))),Rn(W,"ADD_ATTR")&&(typeof W.ADD_ATTR=="function"?je.attributeCheck=W.ADD_ATTR:ji(W.ADD_ATTR)&&(J===he&&(J=Zi(J)),yt(J,W.ADD_ATTR,be))),Rn(W,"ADD_URI_SAFE_ATTR")&&ji(W.ADD_URI_SAFE_ATTR)&&yt(ut,W.ADD_URI_SAFE_ATTR,be),Rn(W,"FORBID_CONTENTS")&&ji(W.FORBID_CONTENTS)&&(Se===Qe&&(Se=Zi(Se)),yt(Se,W.FORBID_CONTENTS,be)),Rn(W,"ADD_FORBID_CONTENTS")&&ji(W.ADD_FORBID_CONTENTS)&&(Se===Qe&&(Se=Zi(Se)),yt(Se,W.ADD_FORBID_CONTENTS,be)),ct&&(A["#text"]=!0),et&&yt(A,["html","head","body"]),A.table&&(yt(A,["tbody"]),delete ae.tbody),W.TRUSTED_TYPES_POLICY){if(typeof W.TRUSTED_TYPES_POLICY.createHTML!="function")throw of('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof W.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw of('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=W.TRUSTED_TYPES_POLICY,L=T.createHTML("")}else T===void 0&&(T=dU(S,r)),T!==null&&typeof L=="string"&&(L=T.createHTML(""));$i&&$i(W),Xe=W},Ie=yt({},[...ev,...tv,...tU]),nt=yt({},[...nv,...nU]),ln=function(W){let fe=F(W);(!fe||!fe.tagName)&&(fe={namespaceURI:$e,tagName:"template"});const Ee=Gu(W.tagName),ot=Gu(fe.tagName);return Ge[W.namespaceURI]?W.namespaceURI===ne?fe.namespaceURI===ce?Ee==="svg":fe.namespaceURI===jt?Ee==="svg"&&(ot==="annotation-xml"||pi[ot]):!!Ie[Ee]:W.namespaceURI===jt?fe.namespaceURI===ce?Ee==="math":fe.namespaceURI===ne?Ee==="math"&&Ft[ot]:!!nt[Ee]:W.namespaceURI===ce?fe.namespaceURI===ne&&!Ft[ot]||fe.namespaceURI===jt&&!pi[ot]?!1:!nt[Ee]&&(On[Ee]||!Ie[Ee]):!!(yn==="application/xhtml+xml"&&Ge[W.namespaceURI]):!1},Ct=function(W){Lu(t.removed,{element:W});try{F(W).removeChild(W)}catch{k(W)}},Yn=function(W,fe){try{Lu(t.removed,{attribute:fe.getAttributeNode(W),from:fe})}catch{Lu(t.removed,{attribute:null,from:fe})}if(fe.removeAttribute(W),W==="is")if(oe||qe)try{Ct(fe)}catch{}else try{fe.setAttribute(W,"")}catch{}},vs=function(W){let fe=null,Ee=null;if(Je)W="<remove></remove>"+W;else{const He=F2(W,/^[\r\n\t ]+/);Ee=He&&He[0]}yn==="application/xhtml+xml"&&$e===ce&&(W='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+W+"</body></html>");const ot=T?T.createHTML(W):W;if($e===ce)try{fe=new b().parseFromString(ot,yn)}catch{}if(!fe||!fe.documentElement){fe=M.createDocument($e,"template",null);try{fe.documentElement.innerHTML=Oe?L:ot}catch{}}const ft=fe.body||fe.documentElement;return W&&Ee&&ft.insertBefore(n.createTextNode(Ee),ft.childNodes[0]||null),$e===ce?Z.call(fe,et?"html":"body")[0]:et?fe.documentElement:ft},Ps=function(W){return z.call(W.ownerDocument||W,W,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Ci=function(W){return W instanceof _&&(typeof W.nodeName!="string"||typeof W.textContent!="string"||typeof W.removeChild!="function"||!(W.attributes instanceof m)||typeof W.removeAttribute!="function"||typeof W.setAttribute!="function"||typeof W.namespaceURI!="string"||typeof W.insertBefore!="function"||typeof W.hasChildNodes!="function")},rn=function(W){return typeof d=="function"&&W instanceof d};function Ut(xe,W,fe){Nu(xe,Ee=>{Ee.call(t,W,fe,Xe)})}const Hi=function(W){let fe=null;if(Ut(G.beforeSanitizeElements,W,null),Ci(W))return Ct(W),!0;const Ee=be(W.nodeName);if(Ut(G.uponSanitizeElement,W,{tagName:Ee,allowedTags:A}),Me&&W.hasChildNodes()&&!rn(W.firstElementChild)&&Si(/<[/\w!]/g,W.innerHTML)&&Si(/<[/\w!]/g,W.textContent)||Me&&W.namespaceURI===ce&&Ee==="style"&&rn(W.firstElementChild)||W.nodeType===ju.progressingInstruction||Me&&W.nodeType===ju.comment&&Si(/<[/\w]/g,W.data))return Ct(W),!0;if(ae[Ee]||!(je.tagCheck instanceof Function&&je.tagCheck(Ee))&&!A[Ee]){if(!ae[Ee]&&le(Ee)&&(de.tagNameCheck instanceof RegExp&&Si(de.tagNameCheck,Ee)||de.tagNameCheck instanceof Function&&de.tagNameCheck(Ee)))return!1;if(ct&&!Se[Ee]){const ot=F(W)||W.parentNode,ft=P(W)||W.childNodes;if(ft&&ot){const He=ft.length;for(let Ot=He-1;Ot>=0;--Ot){const Dt=x(ft[Ot],!0);ot.insertBefore(Dt,O(W))}}}return Ct(W),!0}return W instanceof f&&!ln(W)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&Si(/<\/no(script|embed|frames)/i,W.innerHTML)?(Ct(W),!0):(Ae&&W.nodeType===ju.text&&(fe=W.textContent,Nu([B,R,D],ot=>{fe=Ll(fe,ot," ")}),W.textContent!==fe&&(Lu(t.removed,{element:W.cloneNode()}),W.textContent=fe)),Ut(G.afterSanitizeElements,W,null),!1)},zs=function(W,fe,Ee){if(we[fe]||Mt&&(fe==="id"||fe==="name")&&(Ee in n||Ee in qt))return!1;const ot=J[fe]||je.attributeCheck instanceof Function&&je.attributeCheck(fe,W);if(!(We&&!we[fe]&&Si(N,fe))){if(!(De&&Si(E,fe))){if(!ot||we[fe]){if(!(le(W)&&(de.tagNameCheck instanceof RegExp&&Si(de.tagNameCheck,W)||de.tagNameCheck instanceof Function&&de.tagNameCheck(W))&&(de.attributeNameCheck instanceof RegExp&&Si(de.attributeNameCheck,fe)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(fe,W))||fe==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&Si(de.tagNameCheck,Ee)||de.tagNameCheck instanceof Function&&de.tagNameCheck(Ee))))return!1}else if(!ut[fe]){if(!Si(H,Ll(Ee,j,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&W!=="script"&&U2(Ee,"data:")===0&&Ne[W])){if(!(ke&&!Si($,Ll(Ee,j,"")))){if(Ee)return!1}}}}}}return!0},wr=yt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),le=function(W){return!wr[Gu(W)]&&Si(q,W)},at=function(W){Ut(G.beforeSanitizeAttributes,W,null);const{attributes:fe}=W;if(!fe||Ci(W))return;const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let ot=fe.length;for(;ot--;){const ft=fe[ot],{name:He,namespaceURI:Ot,value:Dt}=ft,ye=be(He),ze=Dt;let Ue=He==="value"?ze:VF(ze);if(Ee.attrName=ye,Ee.attrValue=Ue,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,Ut(G.uponSanitizeAttribute,W,Ee),Ue=Ee.attrValue,Wt&&(ye==="id"||ye==="name")&&U2(Ue,hn)!==0&&(Yn(He,W),Ue=hn+Ue),Me&&Si(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ue)){Yn(He,W);continue}if(ye==="attributename"&&F2(Ue,"href")){Yn(He,W);continue}if(Ee.forceKeepAttr)continue;if(!Ee.keepAttr){Yn(He,W);continue}if(!Le&&Si(/\/>/i,Ue)){Yn(He,W);continue}Ae&&Nu([B,R,D],Zt=>{Ue=Ll(Ue,Zt," ")});const pt=be(W.nodeName);if(!zs(pt,ye,Ue)){Yn(He,W);continue}if(T&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!Ot)switch(S.getAttributeType(pt,ye)){case"TrustedHTML":{Ue=T.createHTML(Ue);break}case"TrustedScriptURL":{Ue=T.createScriptURL(Ue);break}}if(Ue!==ze)try{Ot?W.setAttributeNS(Ot,He,Ue):W.setAttribute(He,Ue),Ci(W)?Ct(W):H2(t.removed)}catch{Yn(He,W)}}Ut(G.afterSanitizeAttributes,W,null)},Xt=function(W){let fe=null;const Ee=Ps(W);for(Ut(G.beforeSanitizeShadowDOM,W,null);fe=Ee.nextNode();)Ut(G.uponSanitizeShadowNode,fe,null),Hi(fe),at(fe),fe.content instanceof o&&Xt(fe.content);Ut(G.afterSanitizeShadowDOM,W,null)};return t.sanitize=function(xe){let W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Ee=null,ot=null,ft=null;if(Oe=!xe,Oe&&(xe="<!-->"),typeof xe!="string"&&!rn(xe)&&(xe=QF(xe),typeof xe!="string"))throw of("dirty is not a string, aborting");if(!t.isSupported)return xe;if(dt||Be(W),t.removed=[],typeof xe=="string"&&(Yt=!1),Yt){const Dt=xe.nodeName;if(typeof Dt=="string"){const ye=be(Dt);if(!A[ye]||ae[ye])throw of("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof d)fe=vs("<!---->"),Ee=fe.ownerDocument.importNode(xe,!0),Ee.nodeType===ju.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?fe=Ee:fe.appendChild(Ee);else{if(!oe&&!Ae&&!et&&xe.indexOf("<")===-1)return T&&Ye?T.createHTML(xe):xe;if(fe=vs(xe),!fe)return oe?null:Ye?L:""}fe&&Je&&Ct(fe.firstChild);const He=Ps(Yt?xe:fe);for(;ot=He.nextNode();)Hi(ot),at(ot),ot.content instanceof o&&Xt(ot.content);if(Yt)return xe;if(oe){if(Ae){fe.normalize();let Dt=fe.innerHTML;Nu([B,R,D],ye=>{Dt=Ll(Dt,ye," ")}),fe.innerHTML=Dt}if(qe)for(ft=U.call(fe.ownerDocument);fe.firstChild;)ft.appendChild(fe.firstChild);else ft=fe;return(J.shadowroot||J.shadowrootmode)&&(ft=Q.call(i,ft,!0)),ft}let Ot=et?fe.outerHTML:fe.innerHTML;return et&&A["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&Si(oN,fe.ownerDocument.doctype.name)&&(Ot="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
|
|
158
|
+
`+Ot),Ae&&Nu([B,R,D],Dt=>{Ot=Ll(Ot,Dt," ")}),T&&Ye?T.createHTML(Ot):Ot},t.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Be(xe),dt=!0},t.clearConfig=function(){Xe=null,dt=!1},t.isValidAttribute=function(xe,W,fe){Xe||Be({});const Ee=be(xe),ot=be(W);return zs(Ee,ot,fe)},t.addHook=function(xe,W){typeof W=="function"&&Lu(G[xe],W)},t.removeHook=function(xe,W){if(W!==void 0){const fe=GF(G[xe],W);return fe===-1?void 0:KF(G[xe],fe,1)[0]}return H2(G[xe])},t.removeHooks=function(xe){G[xe]=[]},t.removeAllHooks=function(){G=Z2()},t}var nh=lN(),sv,J2;function fU(){if(J2)return sv;J2=1;function e(K){return K instanceof Map?K.clear=K.delete=K.set=function(){throw new Error("map is read-only")}:K instanceof Set&&(K.add=K.clear=K.delete=function(){throw new Error("set is read-only")}),Object.freeze(K),Object.getOwnPropertyNames(K).forEach(pe=>{const be=K[pe],Xe=typeof be;(Xe==="object"||Xe==="function")&&!Object.isFrozen(be)&&e(be)}),K}class t{constructor(pe){pe.data===void 0&&(pe.data={}),this.data=pe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(K){return K.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(K,...pe){const be=Object.create(null);for(const Xe in K)be[Xe]=K[Xe];return pe.forEach(function(Xe){for(const qt in Xe)be[qt]=Xe[qt]}),be}const r="</span>",o=K=>!!K.scope,u=(K,{prefix:pe})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const be=K.split(".");return[`${pe}${be.shift()}`,...be.map((Xe,qt)=>`${Xe}${"_".repeat(qt+1)}`)].join(" ")}return`${pe}${K}`};class d{constructor(pe,be){this.buffer="",this.classPrefix=be.classPrefix,pe.walk(this)}addText(pe){this.buffer+=n(pe)}openNode(pe){if(!o(pe))return;const be=u(pe.scope,{prefix:this.classPrefix});this.span(be)}closeNode(pe){o(pe)&&(this.buffer+=r)}value(){return this.buffer}span(pe){this.buffer+=`<span class="${pe}">`}}const f=(K={})=>{const pe={children:[]};return Object.assign(pe,K),pe};class p{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(pe){this.top.children.push(pe)}openNode(pe){const be=f({scope:pe});this.add(be),this.stack.push(be)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(pe){return this.constructor._walk(pe,this.rootNode)}static _walk(pe,be){return typeof be=="string"?pe.addText(be):be.children&&(pe.openNode(be),be.children.forEach(Xe=>this._walk(pe,Xe)),pe.closeNode(be)),pe}static _collapse(pe){typeof pe!="string"&&pe.children&&(pe.children.every(be=>typeof be=="string")?pe.children=[pe.children.join("")]:pe.children.forEach(be=>{p._collapse(be)}))}}class m extends p{constructor(pe){super(),this.options=pe}addText(pe){pe!==""&&this.add(pe)}startScope(pe){this.openNode(pe)}endScope(){this.closeNode()}__addSublanguage(pe,be){const Xe=pe.root;be&&(Xe.scope=`language:${be}`),this.add(Xe)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _(K){return K?typeof K=="string"?K:K.source:null}function b(K){return x("(?=",K,")")}function S(K){return x("(?:",K,")*")}function w(K){return x("(?:",K,")?")}function x(...K){return K.map(be=>_(be)).join("")}function k(K){const pe=K[K.length-1];return typeof pe=="object"&&pe.constructor===Object?(K.splice(K.length-1,1),pe):{}}function O(...K){return"("+(k(K).capture?"":"?:")+K.map(Xe=>_(Xe)).join("|")+")"}function P(K){return new RegExp(K.toString()+"|").exec("").length-1}function F(K,pe){const be=K&&K.exec(pe);return be&&be.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(K,{joinWith:pe}){let be=0;return K.map(Xe=>{be+=1;const qt=be;let St=_(Xe),Be="";for(;St.length>0;){const Ie=T.exec(St);if(!Ie){Be+=St;break}Be+=St.substring(0,Ie.index),St=St.substring(Ie.index+Ie[0].length),Ie[0][0]==="\\"&&Ie[1]?Be+="\\"+String(Number(Ie[1])+qt):(Be+=Ie[0],Ie[0]==="("&&be++)}return Be}).map(Xe=>`(${Xe})`).join(pe)}const M=/\b\B/,z="[a-zA-Z]\\w*",U="[a-zA-Z_]\\w*",Z="\\b\\d+(\\.\\d+)?",Q="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",R=(K={})=>{const pe=/^#![ ]*\//;return K.binary&&(K.begin=x(pe,/.*\b/,K.binary,/\b.*/)),i({scope:"meta",begin:pe,end:/$/,relevance:0,"on:begin":(be,Xe)=>{be.index!==0&&Xe.ignoreMatch()}},K)},D={begin:"\\\\[\\s\\S]",relevance:0},N={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},E={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},$={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/},j=function(K,pe,be={}){const Xe=i({scope:"comment",begin:K,end:pe,contains:[]},be);Xe.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 qt=O("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Xe.contains.push({begin:x(/[ ]+/,"(",qt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Xe},q=j("//","$"),H=j("/\\*","\\*/"),A=j("#","$"),Y={scope:"number",begin:Z,relevance:0},J={scope:"number",begin:Q,relevance:0},he={scope:"number",begin:G,relevance:0},de={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},ae={scope:"title",begin:z,relevance:0},we={scope:"title",begin:U,relevance:0},je={begin:"\\.\\s*"+U,relevance:0};var We=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:he,BINARY_NUMBER_RE:G,COMMENT:j,C_BLOCK_COMMENT_MODE:H,C_LINE_COMMENT_MODE:q,C_NUMBER_MODE:J,C_NUMBER_RE:Q,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(pe,be)=>{be.data._beginMatch=pe[1]},"on:end":(pe,be)=>{be.data._beginMatch!==pe[1]&&be.ignoreMatch()}})},HASH_COMMENT_MODE:A,IDENT_RE:z,MATCH_NOTHING_RE:M,METHOD_GUARD:je,NUMBER_MODE:Y,NUMBER_RE:Z,PHRASAL_WORDS_MODE:$,QUOTE_STRING_MODE:E,REGEXP_MODE:de,RE_STARTERS_RE:B,SHEBANG:R,TITLE_MODE:ae,UNDERSCORE_IDENT_RE:U,UNDERSCORE_TITLE_MODE:we});function ke(K,pe){K.input[K.index-1]==="."&&pe.ignoreMatch()}function Le(K,pe){K.className!==void 0&&(K.scope=K.className,delete K.className)}function Ae(K,pe){pe&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=ke,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function Me(K,pe){Array.isArray(K.illegal)&&(K.illegal=O(...K.illegal))}function et(K,pe){if(K.match){if(K.begin||K.end)throw new Error("begin & end are not supported with match");K.begin=K.match,delete K.match}}function dt(K,pe){K.relevance===void 0&&(K.relevance=1)}const Je=(K,pe)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const be=Object.assign({},K);Object.keys(K).forEach(Xe=>{delete K[Xe]}),K.keywords=be.keywords,K.begin=x(be.beforeMatch,b(be.begin)),K.starts={relevance:0,contains:[Object.assign(be,{endsParent:!0})]},K.relevance=0,delete be.beforeMatch},oe=["of","and","for","in","not","or","if","then","parent","list","value"],qe="keyword";function Ye(K,pe,be=qe){const Xe=Object.create(null);return typeof K=="string"?qt(be,K.split(" ")):Array.isArray(K)?qt(be,K):Object.keys(K).forEach(function(St){Object.assign(Xe,Ye(K[St],pe,St))}),Xe;function qt(St,Be){pe&&(Be=Be.map(Ie=>Ie.toLowerCase())),Be.forEach(function(Ie){const nt=Ie.split("|");Xe[nt[0]]=[St,Mt(nt[0],nt[1])]})}}function Mt(K,pe){return pe?Number(pe):Wt(K)?0:1}function Wt(K){return oe.includes(K.toLowerCase())}const hn={},ct=K=>{console.error(K)},Yt=(K,...pe)=>{console.log(`WARN: ${K}`,...pe)},bt=(K,pe)=>{hn[`${K}/${pe}`]||(console.log(`Deprecated as of ${K}. ${pe}`),hn[`${K}/${pe}`]=!0)},Se=new Error;function Qe(K,pe,{key:be}){let Xe=0;const qt=K[be],St={},Be={};for(let Ie=1;Ie<=pe.length;Ie++)Be[Ie+Xe]=qt[Ie],St[Ie+Xe]=!0,Xe+=P(pe[Ie-1]);K[be]=Be,K[be]._emit=St,K[be]._multi=!0}function Ne(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw ct("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Se;if(typeof K.beginScope!="object"||K.beginScope===null)throw ct("beginScope must be object"),Se;Qe(K,K.begin,{key:"beginScope"}),K.begin=L(K.begin,{joinWith:""})}}function Ce(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw ct("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Se;if(typeof K.endScope!="object"||K.endScope===null)throw ct("endScope must be object"),Se;Qe(K,K.end,{key:"endScope"}),K.end=L(K.end,{joinWith:""})}}function ut(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function dn(K){ut(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),Ne(K),Ce(K)}function jt(K){function pe(Be,Ie){return new RegExp(_(Be),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(Ie?"g":""))}class be{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ie,nt){nt.position=this.position++,this.matchIndexes[this.matchAt]=nt,this.regexes.push([nt,Ie]),this.matchAt+=P(Ie)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ie=this.regexes.map(nt=>nt[1]);this.matcherRe=pe(L(Ie,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ie){this.matcherRe.lastIndex=this.lastIndex;const nt=this.matcherRe.exec(Ie);if(!nt)return null;const ln=nt.findIndex((Yn,vs)=>vs>0&&Yn!==void 0),Ct=this.matchIndexes[ln];return nt.splice(0,ln),Object.assign(nt,Ct)}}class Xe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ie){if(this.multiRegexes[Ie])return this.multiRegexes[Ie];const nt=new be;return this.rules.slice(Ie).forEach(([ln,Ct])=>nt.addRule(ln,Ct)),nt.compile(),this.multiRegexes[Ie]=nt,nt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ie,nt){this.rules.push([Ie,nt]),nt.type==="begin"&&this.count++}exec(Ie){const nt=this.getMatcher(this.regexIndex);nt.lastIndex=this.lastIndex;let ln=nt.exec(Ie);if(this.resumingScanAtSamePosition()&&!(ln&&ln.index===this.lastIndex)){const Ct=this.getMatcher(0);Ct.lastIndex=this.lastIndex+1,ln=Ct.exec(Ie)}return ln&&(this.regexIndex+=ln.position+1,this.regexIndex===this.count&&this.considerAll()),ln}}function qt(Be){const Ie=new Xe;return Be.contains.forEach(nt=>Ie.addRule(nt.begin,{rule:nt,type:"begin"})),Be.terminatorEnd&&Ie.addRule(Be.terminatorEnd,{type:"end"}),Be.illegal&&Ie.addRule(Be.illegal,{type:"illegal"}),Ie}function St(Be,Ie){const nt=Be;if(Be.isCompiled)return nt;[Le,et,dn,Je].forEach(Ct=>Ct(Be,Ie)),K.compilerExtensions.forEach(Ct=>Ct(Be,Ie)),Be.__beforeBegin=null,[Ae,Me,dt].forEach(Ct=>Ct(Be,Ie)),Be.isCompiled=!0;let ln=null;return typeof Be.keywords=="object"&&Be.keywords.$pattern&&(Be.keywords=Object.assign({},Be.keywords),ln=Be.keywords.$pattern,delete Be.keywords.$pattern),ln=ln||/\w+/,Be.keywords&&(Be.keywords=Ye(Be.keywords,K.case_insensitive)),nt.keywordPatternRe=pe(ln,!0),Ie&&(Be.begin||(Be.begin=/\B|\b/),nt.beginRe=pe(nt.begin),!Be.end&&!Be.endsWithParent&&(Be.end=/\B|\b/),Be.end&&(nt.endRe=pe(nt.end)),nt.terminatorEnd=_(nt.end)||"",Be.endsWithParent&&Ie.terminatorEnd&&(nt.terminatorEnd+=(Be.end?"|":"")+Ie.terminatorEnd)),Be.illegal&&(nt.illegalRe=pe(Be.illegal)),Be.contains||(Be.contains=[]),Be.contains=[].concat(...Be.contains.map(function(Ct){return ce(Ct==="self"?Be:Ct)})),Be.contains.forEach(function(Ct){St(Ct,nt)}),Be.starts&&St(Be.starts,Ie),nt.matcher=qt(nt),nt}if(K.compilerExtensions||(K.compilerExtensions=[]),K.contains&&K.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return K.classNameAliases=i(K.classNameAliases||{}),St(K)}function ne(K){return K?K.endsWithParent||ne(K.starts):!1}function ce(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(pe){return i(K,{variants:null},pe)})),K.cachedVariants?K.cachedVariants:ne(K)?i(K,{starts:K.starts?i(K.starts):null}):Object.isFrozen(K)?i(K):K}var $e="11.11.1";class Oe extends Error{constructor(pe,be){super(pe),this.name="HTMLInjectionError",this.html=be}}const Ge=n,Ht=i,pi=Symbol("nomatch"),Ft=7,On=function(K){const pe=Object.create(null),be=Object.create(null),Xe=[];let qt=!0;const St="Could not find the language '{}', did you forget to load/include a language module?",Be={disableAutodetect:!0,name:"Plain text",contains:[]};let Ie={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:m};function nt(ye){return Ie.noHighlightRe.test(ye)}function ln(ye){let ze=ye.className+" ";ze+=ye.parentNode?ye.parentNode.className:"";const Ue=Ie.languageDetectRe.exec(ze);if(Ue){const pt=W(Ue[1]);return pt||(Yt(St.replace("{}",Ue[1])),Yt("Falling back to no-highlight mode for this block.",ye)),pt?Ue[1]:"no-highlight"}return ze.split(/\s+/).find(pt=>nt(pt)||W(pt))}function Ct(ye,ze,Ue){let pt="",Zt="";typeof ze=="object"?(pt=ye,Ue=ze.ignoreIllegals,Zt=ze.language):(bt("10.7.0","highlight(lang, code, ...args) has been deprecated."),bt("10.7.0",`Please use highlight(code, options) instead.
|
|
159
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Zt=ye,pt=ze),Ue===void 0&&(Ue=!0);const $n={code:pt,language:Zt};Ot("before:highlight",$n);const cn=$n.result?$n.result:Yn($n.language,$n.code,Ue);return cn.code=$n.code,Ot("after:highlight",cn),cn}function Yn(ye,ze,Ue,pt){const Zt=Object.create(null);function $n(Re,Ke){return Re.keywords[Ke]}function cn(){if(!rt.keywords){Pn.addText(Gt);return}let Re=0;rt.keywordPatternRe.lastIndex=0;let Ke=rt.keywordPatternRe.exec(Gt),gt="";for(;Ke;){gt+=Gt.substring(Re,Ke.index);const At=mi.case_insensitive?Ke[0].toLowerCase():Ke[0],xn=$n(rt,At);if(xn){const[ys,wc]=xn;if(Pn.addText(gt),gt="",Zt[At]=(Zt[At]||0)+1,Zt[At]<=Ft&&(ia+=wc),ys.startsWith("_"))gt+=Ke[0];else{const jh=mi.classNameAliases[ys]||ys;ki(Ke[0],jh)}}else gt+=Ke[0];Re=rt.keywordPatternRe.lastIndex,Ke=rt.keywordPatternRe.exec(Gt)}gt+=Gt.substring(Re),Pn.addText(gt)}function ti(){if(Gt==="")return;let Re=null;if(typeof rt.subLanguage=="string"){if(!pe[rt.subLanguage]){Pn.addText(Gt);return}Re=Yn(rt.subLanguage,Gt,!0,Mh[rt.subLanguage]),Mh[rt.subLanguage]=Re._top}else Re=Ps(Gt,rt.subLanguage.length?rt.subLanguage:null);rt.relevance>0&&(ia+=Re.relevance),Pn.__addSublanguage(Re._emitter,Re.language)}function Jt(){rt.subLanguage!=null?ti():cn(),Gt=""}function ki(Re,Ke){Re!==""&&(Pn.startScope(Ke),Pn.addText(Re),Pn.endScope())}function Vo(Re,Ke){let gt=1;const At=Ke.length-1;for(;gt<=At;){if(!Re._emit[gt]){gt++;continue}const xn=mi.classNameAliases[Re[gt]]||Re[gt],ys=Ke[gt];xn?ki(ys,xn):(Gt=ys,cn(),Gt=""),gt++}}function na(Re,Ke){return Re.scope&&typeof Re.scope=="string"&&Pn.openNode(mi.classNameAliases[Re.scope]||Re.scope),Re.beginScope&&(Re.beginScope._wrap?(ki(Gt,mi.classNameAliases[Re.beginScope._wrap]||Re.beginScope._wrap),Gt=""):Re.beginScope._multi&&(Vo(Re.beginScope,Ke),Gt="")),rt=Object.create(Re,{parent:{value:rt}}),rt}function Qa(Re,Ke,gt){let At=F(Re.endRe,gt);if(At){if(Re["on:end"]){const xn=new t(Re);Re["on:end"](Ke,xn),xn.isMatchIgnored&&(At=!1)}if(At){for(;Re.endsParent&&Re.parent;)Re=Re.parent;return Re}}if(Re.endsWithParent)return Qa(Re.parent,Ke,gt)}function Yo(Re){return rt.matcher.regexIndex===0?(Gt+=Re[0],1):(sa=!0,0)}function sm(Re){const Ke=Re[0],gt=Re.rule,At=new t(gt),xn=[gt.__beforeBegin,gt["on:begin"]];for(const ys of xn)if(ys&&(ys(Re,At),At.isMatchIgnored))return Yo(Ke);return gt.skip?Gt+=Ke:(gt.excludeBegin&&(Gt+=Ke),Jt(),!gt.returnBegin&&!gt.excludeBegin&&(Gt=Ke)),na(gt,Re),gt.returnBegin?0:Ke.length}function Fi(Re){const Ke=Re[0],gt=ze.substring(Re.index),At=Qa(rt,Re,gt);if(!At)return pi;const xn=rt;rt.endScope&&rt.endScope._wrap?(Jt(),ki(Ke,rt.endScope._wrap)):rt.endScope&&rt.endScope._multi?(Jt(),Vo(rt.endScope,Re)):xn.skip?Gt+=Ke:(xn.returnEnd||xn.excludeEnd||(Gt+=Ke),Jt(),xn.excludeEnd&&(Gt=Ke));do rt.scope&&Pn.closeNode(),!rt.skip&&!rt.subLanguage&&(ia+=rt.relevance),rt=rt.parent;while(rt!==At.parent);return At.starts&&na(At.starts,Re),xn.returnEnd?0:Ke.length}function bc(){const Re=[];for(let Ke=rt;Ke!==mi;Ke=Ke.parent)Ke.scope&&Re.unshift(Ke.scope);Re.forEach(Ke=>Pn.openNode(Ke))}let eo={};function Xo(Re,Ke){const gt=Ke&&Ke[0];if(Gt+=Re,gt==null)return Jt(),0;if(eo.type==="begin"&&Ke.type==="end"&&eo.index===Ke.index&>===""){if(Gt+=ze.slice(Ke.index,Ke.index+1),!qt){const At=new Error(`0 width match regex (${ye})`);throw At.languageName=ye,At.badRule=eo.rule,At}return 1}if(eo=Ke,Ke.type==="begin")return sm(Ke);if(Ke.type==="illegal"&&!Ue){const At=new Error('Illegal lexeme "'+gt+'" for mode "'+(rt.scope||"<unnamed>")+'"');throw At.mode=rt,At}else if(Ke.type==="end"){const At=Fi(Ke);if(At!==pi)return At}if(Ke.type==="illegal"&>==="")return Gt+=`
|
|
160
|
+
`,1;if(Sc>1e5&&Sc>Ke.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Gt+=gt,gt.length}const mi=W(ye);if(!mi)throw ct(St.replace("{}",ye)),new Error('Unknown language: "'+ye+'"');const Lh=jt(mi);let Zo="",rt=pt||Lh;const Mh={},Pn=new Ie.__emitter(Ie);bc();let Gt="",ia=0,xr=0,Sc=0,sa=!1;try{if(mi.__emitTokens)mi.__emitTokens(ze,Pn);else{for(rt.matcher.considerAll();;){Sc++,sa?sa=!1:rt.matcher.considerAll(),rt.matcher.lastIndex=xr;const Re=rt.matcher.exec(ze);if(!Re)break;const Ke=ze.substring(xr,Re.index),gt=Xo(Ke,Re);xr=Re.index+gt}Xo(ze.substring(xr))}return Pn.finalize(),Zo=Pn.toHTML(),{language:ye,value:Zo,relevance:ia,illegal:!1,_emitter:Pn,_top:rt}}catch(Re){if(Re.message&&Re.message.includes("Illegal"))return{language:ye,value:Ge(ze),illegal:!0,relevance:0,_illegalBy:{message:Re.message,index:xr,context:ze.slice(xr-100,xr+100),mode:Re.mode,resultSoFar:Zo},_emitter:Pn};if(qt)return{language:ye,value:Ge(ze),illegal:!1,relevance:0,errorRaised:Re,_emitter:Pn,_top:rt};throw Re}}function vs(ye){const ze={value:Ge(ye),illegal:!1,relevance:0,_top:Be,_emitter:new Ie.__emitter(Ie)};return ze._emitter.addText(ye),ze}function Ps(ye,ze){ze=ze||Ie.languages||Object.keys(pe);const Ue=vs(ye),pt=ze.filter(W).filter(Ee).map(Jt=>Yn(Jt,ye,!1));pt.unshift(Ue);const Zt=pt.sort((Jt,ki)=>{if(Jt.relevance!==ki.relevance)return ki.relevance-Jt.relevance;if(Jt.language&&ki.language){if(W(Jt.language).supersetOf===ki.language)return 1;if(W(ki.language).supersetOf===Jt.language)return-1}return 0}),[$n,cn]=Zt,ti=$n;return ti.secondBest=cn,ti}function Ci(ye,ze,Ue){const pt=ze&&be[ze]||Ue;ye.classList.add("hljs"),ye.classList.add(`language-${pt}`)}function rn(ye){let ze=null;const Ue=ln(ye);if(nt(Ue))return;if(Ot("before:highlightElement",{el:ye,language:Ue}),ye.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ye);return}if(ye.children.length>0&&(Ie.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(ye)),Ie.throwUnescapedHTML))throw new Oe("One of your code blocks includes unescaped HTML.",ye.innerHTML);ze=ye;const pt=ze.textContent,Zt=Ue?Ct(pt,{language:Ue,ignoreIllegals:!0}):Ps(pt);ye.innerHTML=Zt.value,ye.dataset.highlighted="yes",Ci(ye,Ue,Zt.language),ye.result={language:Zt.language,re:Zt.relevance,relevance:Zt.relevance},Zt.secondBest&&(ye.secondBest={language:Zt.secondBest.language,relevance:Zt.secondBest.relevance}),Ot("after:highlightElement",{el:ye,result:Zt,text:pt})}function Ut(ye){Ie=Ht(Ie,ye)}const Hi=()=>{le(),bt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function zs(){le(),bt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let wr=!1;function le(){function ye(){le()}if(document.readyState==="loading"){wr||window.addEventListener("DOMContentLoaded",ye,!1),wr=!0;return}document.querySelectorAll(Ie.cssSelector).forEach(rn)}function at(ye,ze){let Ue=null;try{Ue=ze(K)}catch(pt){if(ct("Language definition for '{}' could not be registered.".replace("{}",ye)),qt)ct(pt);else throw pt;Ue=Be}Ue.name||(Ue.name=ye),pe[ye]=Ue,Ue.rawDefinition=ze.bind(null,K),Ue.aliases&&fe(Ue.aliases,{languageName:ye})}function Xt(ye){delete pe[ye];for(const ze of Object.keys(be))be[ze]===ye&&delete be[ze]}function xe(){return Object.keys(pe)}function W(ye){return ye=(ye||"").toLowerCase(),pe[ye]||pe[be[ye]]}function fe(ye,{languageName:ze}){typeof ye=="string"&&(ye=[ye]),ye.forEach(Ue=>{be[Ue.toLowerCase()]=ze})}function Ee(ye){const ze=W(ye);return ze&&!ze.disableAutodetect}function ot(ye){ye["before:highlightBlock"]&&!ye["before:highlightElement"]&&(ye["before:highlightElement"]=ze=>{ye["before:highlightBlock"](Object.assign({block:ze.el},ze))}),ye["after:highlightBlock"]&&!ye["after:highlightElement"]&&(ye["after:highlightElement"]=ze=>{ye["after:highlightBlock"](Object.assign({block:ze.el},ze))})}function ft(ye){ot(ye),Xe.push(ye)}function He(ye){const ze=Xe.indexOf(ye);ze!==-1&&Xe.splice(ze,1)}function Ot(ye,ze){const Ue=ye;Xe.forEach(function(pt){pt[Ue]&&pt[Ue](ze)})}function Dt(ye){return bt("10.7.0","highlightBlock will be removed entirely in v12.0"),bt("10.7.0","Please use highlightElement now."),rn(ye)}Object.assign(K,{highlight:Ct,highlightAuto:Ps,highlightAll:le,highlightElement:rn,highlightBlock:Dt,configure:Ut,initHighlighting:Hi,initHighlightingOnLoad:zs,registerLanguage:at,unregisterLanguage:Xt,listLanguages:xe,getLanguage:W,registerAliases:fe,autoDetection:Ee,inherit:Ht,addPlugin:ft,removePlugin:He}),K.debugMode=function(){qt=!1},K.safeMode=function(){qt=!0},K.versionString=$e,K.regex={concat:x,lookahead:b,either:O,optional:w,anyNumberOfTimes:S};for(const ye in We)typeof We[ye]=="object"&&e(We[ye]);return Object.assign(K,We),K},yn=On({});return yn.newInstance=()=>On({}),sv=yn,yn.HighlightJS=yn,yn.default=yn,sv}var pU=fU();const Rs=Wb(pU);function Q2(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"}}),u={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 f={match:/\\"/},p={className:"string",begin:/'/,end:/'/},m={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],k=["true","false"],O={match:/(\/[a-z._-]+)+/},P=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],F=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],L=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:x,literal:k,built_in:[...P,...F,"set","shopt",...T,...L]},contains:[S,e.SHEBANG(),w,_,o,u,O,d,f,p,m,n]}}const eE="[A-Za-z$_][0-9A-Za-z$_]*",mU=["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"],gU=["true","false","null","undefined","NaN","Infinity"],cN=["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"],uN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_U=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],vU=[].concat(hN,cN,uN);function tE(e){const t=e.regex,n=(j,{after:q})=>{const H="</"+j[0].slice(1);return j.input.indexOf(H,q)!==-1},i=eE,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,q)=>{const H=j[0].length+j.index,A=j.input[H];if(A==="<"||A===","){q.ignoreMatch();return}A===">"&&(n(j,{after:H})||q.ignoreMatch());let Y;const J=j.input.substring(H);if(Y=J.match(/^\s*=/)){q.ignoreMatch();return}if((Y=J.match(/^\s+extends\s+/))&&Y.index===0){q.ignoreMatch();return}}},d={$pattern:eE,keyword:mU,literal:gU,built_in:vU,"variable.language":_U},f="[0-9](_?[0-9])*",p=`\\.(${f})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${p})|\\.)?|(${p}))[eE][+-]?(${f})\\b`},{begin:`\\b(${m})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},P={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,{match:/\$\d+/},_];b.contains=F.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(F)});const T=[].concat(P,b.contains),L=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:L},z={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},U={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...cN,...uN]}},Z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Q={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(j){return t.concat("(?!",j.join("|"),")")}const R={match:t.concat(/\b/,B([...hN,"super","import"].map(j=>`${j}\\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},N={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",$={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),Z,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,P,{match:/\$\d+/},_,U,{scope:"attr",match:i+t.lookahead(":"),relevance:0},$,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},R,G,z,N,{match:/\$[(.]/}]}}function yU(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 nE(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},u={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+.-]*/,f={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}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},m={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},_=e.inherit(p,{contains:[]}),b=e.inherit(m,{contains:[]});p.contains.push(b),m.contains.push(_);let S=[n,f];return[p,m,_,b].forEach(O=>{O.contains=O.contains.concat(S)}),S=S.concat(p,m),{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,p,m,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,f,u,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function iE(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"]},f={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},m={begin:/\{\{/,relevance:0},_={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,f],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,f],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,f,m,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,f,m,p]},{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,m,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,m,p]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},k={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},O={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",f,x,_,e.HASH_COMMENT_MODE]}]};return p.contains=[_,x,f],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[f,x,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,k,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[O]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,O,_]}]}}const _p="[A-Za-z$_][0-9A-Za-z$_]*",dN=["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"],fN=["true","false","null","undefined","NaN","Infinity"],pN=["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"],mN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],gN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_N=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],vN=[].concat(gN,pN,mN);function bU(e){const t=e.regex,n=(j,{after:q})=>{const H="</"+j[0].slice(1);return j.input.indexOf(H,q)!==-1},i=_p,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,q)=>{const H=j[0].length+j.index,A=j.input[H];if(A==="<"||A===","){q.ignoreMatch();return}A===">"&&(n(j,{after:H})||q.ignoreMatch());let Y;const J=j.input.substring(H);if(Y=J.match(/^\s*=/)){q.ignoreMatch();return}if((Y=J.match(/^\s+extends\s+/))&&Y.index===0){q.ignoreMatch();return}}},d={$pattern:_p,keyword:dN,literal:fN,built_in:vN,"variable.language":_N},f="[0-9](_?[0-9])*",p=`\\.(${f})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${p})|\\.)?|(${p}))[eE][+-]?(${f})\\b`},{begin:`\\b(${m})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},P={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,{match:/\$\d+/},_];b.contains=F.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(F)});const T=[].concat(P,b.contains),L=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:L},z={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},U={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...pN,...mN]}},Z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Q={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(j){return t.concat("(?!",j.join("|"),")")}const R={match:t.concat(/\b/,B([...gN,"super","import"].map(j=>`${j}\\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},N={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",$={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),Z,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,k,P,{match:/\$\d+/},_,U,{scope:"attr",match:i+t.lookahead(":"),relevance:0},$,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},R,G,z,N,{match:/\$[(.]/}]}}function sE(e){const t=e.regex,n=bU(e),i=_p,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},u={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['"]/},f=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],p={$pattern:_p,keyword:dN.concat(f),literal:fN,built_in:vN.concat(r),"variable.language":_N},m={className:"meta",begin:"@"+i},_=(x,k,O)=>{const P=x.contains.findIndex(F=>F.label===k);if(P===-1)throw new Error("can not find mode to replace");x.contains.splice(P,1,O)};Object.assign(n.keywords,p),n.exports.PARAMS_CONTAINS.push(m);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([m,o,u,S]),_(n,"shebang",e.SHEBANG()),_(n,"use_strict",d);const w=n.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const SU=/\[\[wiki:([^\]]+)\]\]/g,wU=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,xU=/^(\S[^:]*?):[ \t]*(.*)$/,CU=new sN({gfm:!0,breaks:!1}),rE={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},rv=$U();function Bs(e,t={}){const{entries:n,content:i}=TU(e),r=NU(i,t.resolveWikiLink),o=CU.parse(r,{async:!1}),u=RU(n),d=nh.sanitize(u+o,rE),f=new DOMParser().parseFromString(d,"text/html");return MU(f,t.omitDuplicateTitle),LU(f),jU(f),DU(f),{html:nh.sanitize(f.body.innerHTML,rE),toc:IU(f)}}function kU(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=wU.exec(e);return t?{entries:AU(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function AU(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=xU.exec(i);if(r){const[,d="",f=""]=r;t.push({key:d.trim(),value:f.trim()});continue}const o=t[t.length-1];if(!o)continue;const u=i.trim();o.value=o.value?`${o.value} ${u}`:u}return t}function RU(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${ih(n.key)}</dt><dd>${ih(n.value)}</dd>`).join("")}</dl>`}function NU(e,t){return e.replace(SU,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return ih(`[[wiki:${r}]]`);const o=t(r);if(o===null)return ih(`[[wiki:${r}]]`);const u=ih(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${u}</a>`})}function LU(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=HU(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function MU(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||aE(n.textContent??"")===aE(t)&&n.remove()}function jU(e){for(const t of e.querySelectorAll("pre > code")){const n=PU(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const u=e.createElement("div");u.className="diagram-block",u.setAttribute("data-mermaid-source",kU(i)),u.setAttribute("data-diagram-state","pending"),r.replaceWith(u);continue}const o=BU(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(OU(e,n||"text"),r.firstChild)}}function OU(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 u=0;u<3;u++)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 DU(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";zU(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function IU(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 BU(e,t){return t&&rv.getLanguage(t)?rv.highlight(e,{language:t}).value:rv.highlightAuto(e).value}function $U(){return Rs.registerLanguage("bash",Q2),Rs.registerLanguage("sh",Q2),Rs.registerLanguage("javascript",tE),Rs.registerLanguage("js",tE),Rs.registerLanguage("json",yU),Rs.registerLanguage("markdown",nE),Rs.registerLanguage("md",nE),Rs.registerLanguage("python",iE),Rs.registerLanguage("py",iE),Rs.registerLanguage("typescript",sE),Rs.registerLanguage("ts",sE),Rs}function PU(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function zU(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function HU(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function aE(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function ih(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const FU="modulepreload",UU=function(e){return"/console/"+e},oE={},WU=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let f=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=u?.nonce||u?.getAttribute("nonce");r=f(n.map(p=>{if(p=UU(p),p in oE)return;oE[p]=!0;const m=p.endsWith(".css"),_=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${_}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":FU,m||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),m)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return r.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},qU=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",GU=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),KU=/^on/i,VU={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},lE="diagramInteractionBound",YU=/^oklch\s*\(\s*([^)]+)\s*\)$/i,XU=/^(-?\d+(?:\.\d+)?)(deg)?$/i,js=[25,50,75,100,125,150,200],ZU=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let av=null;const cE=new WeakSet;let JU=0,QU=0,gh=null;function $a(e){const t=e.trim();if(!t)return t;const n=SW(t);return n?wW(n):t}function Zp(e){if(cE.has(e))return;cE.add(e),uE(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){gh&&!gh.trigger.isConnected&&Ku(!1);for(const u of o.addedNodes)if(u instanceof Element&&(u.matches?.(".diagram-block[data-mermaid-source]")||u.querySelector?.(".diagram-block[data-mermaid-source]"))){r=!0;break}if(r)break}r&&uE(e)}).observe(t,{childList:!0,subtree:!0})}function uE(e){const t=e.querySelectorAll(qU);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",eW(n))}async function eW(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=EU(t)}catch{ov(e,"Invalid diagram source");return}if(!n.trim()){ov(e,"Empty diagram source");return}try{const i=await nW(),r=`mermaid-diagram-${++JU}`,{svg:o}=await i.render(r,n);e.innerHTML=tW(o),rW(e,o),aW(e),oW(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);ov(e,r)}}function ov(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function tW(e){const t=(n,i)=>{KU.test(i.attrName)&&(i.keepAttr=!1)};nh.addHook("uponSanitizeAttribute",t);try{return nh.sanitize(e,VU)}finally{nh.removeHook("uponSanitizeAttribute",t)}}async function nW(){return av||(av=(async()=>{const e=await WU(()=>import("./mermaid.core-B2Lf_dRe.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:iW(),themeCSS:sW(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),av}function iW(){const e=getComputedStyle(document.documentElement),t=(x,k)=>{const O=e.getPropertyValue(x).trim();return $a(O||k)},n=(x,k)=>e.getPropertyValue(x).trim()||k,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),u=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),f=t("--coral","#ef7c63"),p=t("--ink-deep","#1d2734"),m=t("--ink-fog","#a6afbb"),_=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,u,f,$a("oklch(70% 0.11 68)"),d,$a("oklch(76% 0.09 205)"),o,$a("oklch(68% 0.14 30)"),m,$a("oklch(62% 0.08 228)"),$a("oklch(52% 0.05 248)")],w=Object.fromEntries(ZU.map((x,k)=>[x,S[k]??p]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:_,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:_,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:d,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:_,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:_,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function sW(){const e=getComputedStyle(document.documentElement),t=(p,m)=>{const _=e.getPropertyValue(p).trim();return $a(_||m)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),u=$a("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),f=t("--ink-pearl","#e6e9ef");return`
|
|
161
|
+
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
162
|
+
stroke: ${n};
|
|
163
|
+
fill: ${d};
|
|
164
|
+
}
|
|
165
|
+
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
166
|
+
stroke: ${r};
|
|
167
|
+
}
|
|
168
|
+
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
169
|
+
fill: ${f};
|
|
170
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
171
|
+
}
|
|
172
|
+
.pieCircle {
|
|
173
|
+
stroke: ${n};
|
|
174
|
+
stroke-width: 1.35px;
|
|
175
|
+
opacity: 0.96;
|
|
176
|
+
filter: drop-shadow(0 0 1.5px ${u});
|
|
177
|
+
}
|
|
178
|
+
.pieOuterCircle {
|
|
179
|
+
stroke: ${i};
|
|
180
|
+
opacity: 0.7;
|
|
181
|
+
}
|
|
182
|
+
.slice, .legend text, .pieTitleText {
|
|
183
|
+
fill: ${f};
|
|
184
|
+
paint-order: stroke;
|
|
185
|
+
stroke: ${o};
|
|
186
|
+
stroke-width: 3px;
|
|
187
|
+
stroke-linejoin: round;
|
|
188
|
+
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
189
|
+
}
|
|
190
|
+
.slice {
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
letter-spacing: 0.04em;
|
|
193
|
+
font-style: italic;
|
|
194
|
+
}
|
|
195
|
+
.pieTitleText {
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
letter-spacing: 0.12em;
|
|
198
|
+
font-style: italic;
|
|
199
|
+
}
|
|
200
|
+
.legend text {
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
letter-spacing: 0.03em;
|
|
203
|
+
}
|
|
204
|
+
.legend rect {
|
|
205
|
+
rx: 999px;
|
|
206
|
+
ry: 999px;
|
|
207
|
+
opacity: 0.9;
|
|
208
|
+
stroke: ${o};
|
|
209
|
+
stroke-width: 1.5px;
|
|
210
|
+
paint-order: stroke;
|
|
211
|
+
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
|
|
212
|
+
}
|
|
213
|
+
`}function rW(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 u=0;u<o;u++){const d=i[u],f=r[u];if(!d||!f)continue;const p=d.getAttribute("href")??d.getAttribute("xlink:href")??"",m=bN(p);m&&f.setAttribute("href",m)}}function aW(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:u}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(u)||i<0||r<0||o<=0||u<=0||t.setAttribute("viewBox",`${Gl(i)} ${Gl(r)} ${Gl(o)} ${Gl(u)}`)}function oW(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),vW(e),e.dataset[lE]!=="true"&&(e.dataset[lE]="true",e.addEventListener("click",lW),e.addEventListener("keydown",cW))}function lW(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||vp(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),yN(t))}function cW(e){if(e.key!=="Enter"&&e.key!==" "||vp(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),yN(t))}function yN(e){const t=e.querySelector("svg");if(!t)return;Ku(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++QU,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 u=document.createElement("div");u.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const f=document.createElement("h2");f.id=o,f.textContent="MANIFEST · DIAGRAM";const p=document.createElement("button");p.className="diagram-lightbox__close",p.type="button",p.setAttribute("aria-label","Close expanded diagram"),p.textContent="Close";const m=document.createElement("div");m.className="diagram-lightbox__controls",m.setAttribute("aria-label","Diagram zoom controls");const _=cf("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=cf("+","Zoom in","in"),w=cf("Fit","Fit diagram to viewport","fit"),x=cf("Reset","Reset diagram zoom","reset");m.append(_,b,S,w,x);const k=document.createElement("div");k.className="diagram-lightbox__viewport";const O=dW(t),P=t.cloneNode(!0);P.removeAttribute("style"),pW(P,`diagram-lightbox-svg-${r}`),k.append(P),d.append(f,m,p),u.append(d,k),i.append(u),document.body.append(i);const F=new uW(k,P,b,O);_.addEventListener("click",()=>F.zoomOut()),S.addEventListener("click",()=>F.zoomIn()),w.addEventListener("click",()=>F.fit()),x.addEventListener("click",()=>F.reset());const T=mW(i),L=U=>{(U.target===i||U.target===p)&&Ku(!0)},M=U=>{if(U.key==="Escape"){U.preventDefault(),Ku(!0);return}F.handleKeyboard(U)||U.key==="Tab"&&_W(U,i)},z={dialog:i,trigger:e,inertStates:T,onClick:L,onKeyDown:M,cleanupPanZoom:()=>F.destroy()};n&&(z.onCancel=U=>{U.preventDefault(),Ku(!0)},i.addEventListener("cancel",z.onCancel),i.showModal()),i.addEventListener("click",L),document.addEventListener("keydown",M,!0),gh=z,F.fit(),p.focus()}function cf(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 uW{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=js.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,js.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(js.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=js.findIndex(d=>d>r),u=o===-1?js.length-1:Math.max(0,o-1);this.applyZoom(u),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*(uf(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(uf(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=uf(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Gl(this.baseSize.width*i)),this.svg.setAttribute("height",Gl(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,u=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+n-u.left,f=this.viewport.scrollTop+i-u.top;this.applyZoom(t),this.viewport.scrollLeft=d/r*this.svgWidth-(n-u.left),this.viewport.scrollTop=f/o*this.svgHeight-(i-u.top)}onPointerDown=t=>{if(t.button!==0||vp(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=uf(this.pinchStart.zoomIndex)*i;this.applyZoom(fW(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,js.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{vp(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===js.indexOf(200)?js.indexOf(100):js.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 hW(e){const t=hE(e.getAttribute("width")),n=hE(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],u=r!==void 0&&Number.isFinite(r)&&r>0?r:null,d=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??u??800,height:n??d??600}}function dW(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:hW(e)}function hE(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 Gl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function fW(e){let t=0,n=Number.POSITIVE_INFINITY;return js.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function uf(e){return js[e]??js[0]}function pW(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 Ku(e){const t=gh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),gW(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),gh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function mW(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 gW(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 _W(e,t){const n=Array.from(t.querySelectorAll(GU)).filter(bW);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 vW(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function vp(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!yW(t)}function yW(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function bW(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function bN(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:bN(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 SW(e){const t=YU.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():"",u=r.trim().split(/[\s,]+/).filter(Boolean);if(u.length!==3)return null;const[d,f,p]=u;if(!d||!f||!p)return null;const m=lv(d,1),_=lv(f,.4),b=xW(p);if(m===null||_===null||b===null)return null;let S=1;if(i>=0){const w=lv(o,1);if(w===null)return null;S=w}return{L:m,C:_,h:b,alpha:S}}function wW(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,u=r-.1055613458*n-.0638541728*i,d=r-.0894841775*n-1.291485548*i,f=o**3,p=u**3,m=d**3,_=4.0767416621*f-3.3077115913*p+.2309699292*m,b=-1.2684380046*f+2.6097574011*p-.3413193965*m,S=-.0041960863*f-.7034186147*p+1.707614701*m,w=hf(cv(_)),x=hf(cv(b)),k=hf(cv(S));if(e.alpha<1){const O=hf(e.alpha);return`#${So(w)}${So(x)}${So(k)}${So(O)}`}return`#${So(w)}${So(x)}${So(k)}`}function lv(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 xW(e){const t=XU.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function cv(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 hf(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function So(e){return e.toString(16).padStart(2,"0")}const CW=[{icon:"◈",tone:"aurora",text:"Walk me through how this session unfolded"},{icon:"●",tone:"aurora",text:"What is the agent doing right now?"},{icon:"▲",tone:"coral",text:"Flag anything I should review"},{icon:"≡",tone:"brass",text:"Draft a handoff brief"}],kW=32,Vu="session-analyst-artifacts";function EW({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=qR(e),[u,d]=y.useState(""),f=t.catalog?.clis.find(G=>G.cliId===t.cliId),p=f?.models.find(G=>G.id===t.model),m=t.entries.length>0,_=t.artifacts.length,b=e.hiddenCompanionPanelIds,S=e.onSetCompanionPanelVisible,w=b!==void 0&&S!==void 0,x=b?.includes(Vu)??!1,k=_>0&&!x,O=y.useRef(0),[P,F]=y.useState(0),T=y.useRef(null),L=y.useRef(null),M=t.entries.at(-1),z=y.useRef(m).current,U=m&&!z;y.useLayoutEffect(()=>{const G=L.current;!G||!m||(G.scrollTop=G.scrollHeight)},[m,M?.text,t.entries.length,t.latestActivity,t.phase]),y.useEffect(()=>{const G=L.current;G&&Zp(G)},[]),y.useEffect(()=>{const G=O.current;if(O.current=_,!(!w||!S)){if(_===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!x){const B=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;S(Vu,!1),B&&window.requestAnimationFrame(()=>T.current?.focus())}return}if(G===0&&x&&t.artifactsAutoOpenArmed){S(Vu,!0);return}_>G&&x&&F(B=>B+1)}},[_,x,n,S,t.artifactsAutoOpenArmed,w]);const Z=async G=>{const B=G.trim();!B||t.busy||(d(""),await i(B))},Q=y.useCallback(G=>{const B=G.target.closest('[data-action="copy-code"]');if(!B)return;const R=B.closest("pre")?.getAttribute("data-code");R&&AW(B,R)},[]);return c.jsxs("section",{className:`session-analyst__chat-pane ${m?"has-interacted":"is-initial"}`,"aria-label":"Session Analyst chat","data-phase":t.phase,children:[w?c.jsxs("button",{ref:T,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${_===0?" is-waiting":""}`,"aria-label":k?"Hide Artifacts":"Open Artifacts","aria-pressed":k,"aria-disabled":_===0,tabIndex:_===0?-1:void 0,title:_===0?"Artifacts the analyst publishes appear here":void 0,onClick:()=>{!S||_===0||(k&&n({type:"artifacts-chip-disarm"}),S(Vu,!k))},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:k?"«":"»"}),_>0?c.jsx("span",{className:`session-analyst-handle__count${P>0?" is-pulsing":""}`,children:_},P):null,c.jsx("span",{className:"session-analyst-handle__label",children:"ARTIFACTS"})]}):null,c.jsx(RW,{state:t,onReset:()=>{o().then(()=>d("")).catch(()=>{})}}),c.jsxs("div",{className:"session-analyst__workspace",children:[c.jsxs("section",{ref:L,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[m?c.jsx("ol",{className:"session-analyst__transcript",onClick:Q,children:t.entries.map((G,B)=>c.jsx("li",{className:`session-analyst__message session-analyst__message--${G.role}`,children:G.role==="analyst"?c.jsx(TW,{text:G.text,streaming:t.busy&&B===t.entries.length-1}):G.text},`${G.role}-${B}`))}):c.jsxs("div",{className:"session-analyst__hero-wrap",children:[c.jsxs("header",{className:"session-analyst__hero",children:[c.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),c.jsx("h2",{children:"Ask about this session"}),c.jsx("p",{children:"Review, explain, and summarize this session — without affecting the host agent."})]}),c.jsx("div",{className:"session-analyst__suggestions",children:CW.map(G=>c.jsxs("button",{type:"button",onClick:()=>{Z(G.text)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":G.tone,"aria-hidden":"true",children:G.icon}),G.text]},G.text))})]}),t.phase!=="idle"?c.jsx(NW,{state:t}):null]}),c.jsx("form",{className:`session-analyst__composer ${m?"is-docked":"is-initial"}${U?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:G=>{G.preventDefault(),Z(u)},children:c.jsxs("div",{className:"session-analyst__composer-surface",children:[m?null:c.jsxs("div",{className:"session-analyst__selector-strip","aria-label":"Initial analysis settings",children:[c.jsx("span",{className:"session-analyst__select",children:c.jsx("select",{"aria-label":"Analysis CLI",disabled:t.started||!t.catalog,value:t.cliId,onChange:G=>n({type:"select-cli",cliId:G.target.value}),children:t.catalog?.clis.map(G=>c.jsx("option",{value:G.cliId,disabled:!G.available,children:G.label},G.cliId))})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx("select",{"aria-label":"Analysis model",disabled:t.started||!p,value:t.model,onChange:G=>n({type:"select-model",model:G.target.value}),children:f?.models.map(G=>c.jsx("option",{value:G.id,children:G.label},G.id))})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx("select",{"aria-label":"Analysis effort",disabled:t.started||!p||!p.effortLevels.length,value:t.effort,onChange:G=>n({type:"select-effort",effort:G.target.value}),children:p?.effortLevels.length?p.effortLevels.map(G=>c.jsx("option",{value:G,children:G},G)):c.jsx("option",{value:"",children:"n/a"})})})]}),c.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:"Ask about this session"}),c.jsx("textarea",{id:`analysis-${e.operationId}`,rows:1,placeholder:"Ask about the session…",value:u,onChange:G=>d(G.target.value),onKeyDown:G=>{G.key!=="Enter"||G.shiftKey||G.nativeEvent.isComposing||(G.preventDefault(),Z(u))},disabled:t.busy}),t.busy?c.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":"Stop",onClick:()=>{r()},children:c.jsx("span",{"aria-hidden":"true"})}):c.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":"Send",disabled:!u.trim(),children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:c.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]})})]})]})}const TW=y.memo(function({text:t,streaming:n}){const i=y.useRef(t),r=y.useRef(n?t:""),o=y.useRef(null),[u,d]=y.useState(()=>n?Bs(t).html:"");i.current=t;const f=y.useMemo(()=>n?null:Bs(t).html,[n,t]);return y.useEffect(()=>{if(!n){o.current!==null&&window.clearTimeout(o.current),o.current=null;return}r.current===t||o.current!==null||(o.current=window.setTimeout(()=>{o.current=null;const p=i.current;p!==r.current&&(r.current=p,d(Bs(p).html))},kW))},[n,t]),y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]),c.jsx("div",{className:"session-analyst__response markdown-body",dangerouslySetInnerHTML:{__html:f??u}})});function AW(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function RW({state:e,onReset:t}){const n=e.started||e.phase!=="idle"||e.entries.length>0||e.artifacts.length>0;return c.jsxs("header",{className:"session-analyst__panel-head",children:[c.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:"Session Analyst"}),c.jsx("small",{children:"Read-only intelligence for this operation"})]}),c.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":"Reset Session Analyst",onClick:t,disabled:!n,children:"Reset"}),c.jsxs("span",{className:"session-analyst__panel-state",children:[c.jsx("i",{"aria-hidden":"true"}),jW(e)]})]})}function NW({state:e}){const t=OW(e),n=DW(t),i=MW(e.latestActivity);if(e.phase==="complete")return null;if(e.phase==="stopped")return c.jsxs("div",{className:"session-analyst__receipt is-stopped",role:"status",children:["Stopped · last confirmed: ",i," · ",n]});const r=e.phase==="error",o=LW(e.latestActivity);return c.jsxs("div",{className:`session-analyst__pulse${r?" is-error":""}`,role:r?"alert":"status","aria-live":r?void 0:"polite",children:[r?null:c.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),c.jsxs("div",{className:"session-analyst__pulse-main",children:[c.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),c.jsxs("span",{className:"session-analyst__pulse-copy",children:[c.jsx("strong",{children:r?e.error:o.label},`${e.phase}-${o.label}`),c.jsx("small",{children:r?`Last confirmed activity: ${i}`:o.note})]}),c.jsx("time",{children:n})]}),c.jsx("span",{className:"session-analyst__truth-mark",children:"Last confirmed activity only"})]})}function LW(e){return!e||e.kind==="starting"?{label:"Starting analyst",note:e?.connected?"Analyst connection confirmed":"Starting a new analysis session"}:e.kind==="reasoning"?{label:"Reasoning over session",note:"Thought event received · content hidden"}:e.kind==="tool"?{label:`Using ${e.title}`,note:`Tool status: ${e.status}`}:{label:"Writing answer",note:"Answer chunk received"}}function MW(e){return!e||e.kind==="starting"?"Starting analyst":e.kind==="reasoning"?"Reasoning over session":e.kind==="tool"?`Using ${e.title} (${e.status})`:"Writing answer"}function jW(e){return e.phase==="error"?"Needs attention":e.busy?"Analyzing":e.phase==="complete"?"Complete":e.phase==="stopped"?"Stopped":"Ready"}function OW(e){const[t,n]=y.useState(()=>Date.now());return y.useEffect(()=>{if(!e.busy)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e.busy,e.runStartedAt]),e.runStartedAt===null?0:Math.max(0,(e.runEndedAt??t)-e.runStartedAt)}function DW(e){return`${Math.floor(e/1e3)}s`}class vr extends Error{constructor(t,n){super(n),this.status=t}status}const IW=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function SN(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await r1(t),xN(await t.json(),t.status)}async function wN(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await r1(t),PW(await t.json(),t.status)}async function uv(e,t,n){return s1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function BW(e,t,n,i){return s1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function $W(e,t,n){return s1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function s1(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await r1(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new vr(r.status,"Invalid carrier settings mutation response");return{state:xN(o.state,r.status)}}async function r1(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new vr(e.status,t)}function xN(e,t){CN(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new vr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>zW(i,t))}}function PW(e,t){CN(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new vr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>HW(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function zW(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceCapable!="boolean"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new vr(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceCapable:n.taskForceCapable,taskforce:{backends:n.taskforce.backends.map(i=>UW(i,t))}}}function HW(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new vr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>FW(i,t)),defaultModel:n.defaultModel}}function FW(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new vr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new vr(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function UW(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new vr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function CN(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(IW.has(r))throw new vr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const WW=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class er extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function kN(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new er(t.status,"Invalid agent state response");return n.agentClis.map(i=>QW(i,t.status))}async function qW(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.clis))throw new er(t.status,"Invalid Agent CLI state response");return n}async function GW(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new er(t.status,"Invalid tenants response");return n.tenants.map(i=>eq(i,t.status))}async function KW(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new er(t.status,"Invalid jobs response");return n.tenants}async function VW(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new er(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Jp(i,t.status))}async function YW(e){const t=await fetch("/api/v1/operations",{signal:e});await ta(t);const n=await t.json();if(!Array.isArray(n.operations))throw new er(t.status,"Invalid operations response");return{operations:n.operations.map(i=>tq(i,t.status))}}async function XW(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 ta(i),Jp(await i.json(),i.status)}async function ZW(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await ta(n),Jp(await n.json(),n.status)}async function JW(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ta(n)}function Jp(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||hb(n))throw new er(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 ta(e){if(!e.ok)throw new er(e.status,`Agent plugin request failed: ${e.status}`)}function QW(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new er(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function eq(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 er(t,"Invalid tenant response");return n}function tq(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"||hb(n)||hb(n.payload))throw new er(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 hb(e){return db(e,new Set(WW))}function db(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>db(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||db(i,t))}const nq="active",fb=new Set(["done","error","aborted"]);function iq(e,t){let n=TN(pb(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=EN(n,i);return fb.has(t.status)&&!fb.has(n.status)&&(n={...n,status:t.status}),n}function EN(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:oq(e.recentEvents,t)};switch(t.type){case"job:registered":return rq(i,n);case"job:finalized":return{...i,status:Nn(n.status)??"done",finishedAt:Ia(n.finishedAt)??t.at,summary:Nn(n.summary),error:Nn(n.error)};case"track:begin":return Ml(TN(i,n.request),n,t.id,r=>({...r,startedAt:Ia(n.startedAt)??t.at,requestPreview:Nn(n.requestPreview)}));case"track:status":return Ml(i,n,t.id,r=>({...r,status:Nn(n.status)??r.status}));case"track:text":return Ml(i,n,t.id,r=>{const o=r.text+(Nn(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Ia(n.textLength)??Nn(n.text)?.length??0),latestLine:lq(o)||r.latestLine}});case"track:thought":return Ml(i,n,t.id,r=>{const o=r.thought+(Nn(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Ia(n.textLength)??Nn(n.text)?.length??0)}});case"track:tool":return Ml(i,n,t.id,r=>({...r,status:"stream",tools:aq(r.tools,n)}));case"track:finalized":return Ml(i,n,t.id,r=>{const o=dE(r.text,r.sentTextLength,Nn(n.fallbackText),Ia(n.fallbackTextLength)),u=dE(r.thought,r.sentThoughtLength,Nn(n.fallbackThought),Ia(n.fallbackThoughtLength));return{...r,status:Nn(n.status)??"done",finishedAt:Ia(n.finishedAt)??t.at,error:Nn(n.error),text:o.text,sentTextLength:o.sentLength,thought:u.text,sentThoughtLength:u.sentLength}});default:return i}}function TN(e,t){if(e.request)return e;const n=sq(t);return n?{...e,request:n}:e}function sq(e){if(typeof e!="object"||e===null)return;const t=e;if(!Array.isArray(t.blocks)||typeof t.additional!="string")return;const n=[];for(const i of t.blocks){if(typeof i!="object"||i===null)return;const r=i;if(typeof r.tag!="string"||typeof r.hint!="string"||typeof r.required!="boolean"||typeof r.present!="boolean"||typeof r.body!="string")return;n.push({tag:r.tag,hint:r.hint,required:r.required,present:r.present,body:r.body})}return{blocks:n,additional:t.additional}}function pb(e,t,n){return{jobId:t,tenantId:e,status:nq,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function uc(e){return fb.has(e)}function rq(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 u=r[o.trackId],d={...u??AN(o.trackId),displayName:o.displayName??u?.displayName??o.trackId,displayCli:o.displayCli??u?.displayCli,model:o.model??u?.model,effort:o.effort??u?.effort,subtitle:o.subtitle??u?.subtitle,kind:o.kind??u?.kind,startedAt:o.startedAt??u?.startedAt};u||(i=[...i,o.trackId]),r={...r,[o.trackId]:d}}return{...e,label:Nn(t.label)??e.label,ownerCarrierId:Nn(t.ownerCarrierId)??e.ownerCarrierId,kind:Nn(t.kind)??e.kind,signatureCli:Nn(t.signatureCli)??e.signatureCli,startedAt:Ia(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function Ml(e,t,n,i){const r=Nn(t.trackId);if(!r)return e;const o=e.tracks[r],u={...i(o??AN(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:u}}}function AN(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function aq(e,t){const n=Nn(t.toolId)??Nn(t.id);if(!n)return e;const i={id:n,name:Nn(t.name),input:t.input,output:t.output,status:Nn(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 dE(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 oq(e,t){return[...e,t].slice(-120)}function lq(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
214
|
+
`);return n[n.length-1]?.trim()??""}function Nn(e){return typeof e=="string"?e:void 0}function Ia(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const cq=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function uq(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
|
|
215
|
+
|
|
216
|
+
`);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=dq(r);o&&n.push(o),i=e.indexOf(`
|
|
217
|
+
|
|
218
|
+
`)}return n}}function hq(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=pE(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=pE(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:fq(t.reason)}:null}const n=fE(t.event)??fE(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function dq(e){const t=e.split(`
|
|
219
|
+
`),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
220
|
+
`);return!i&&n==="message"?null:{event:n,data:i}}function fE(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 pE(e){try{return Jp(e,200)}catch{return null}}function fq(e){return typeof e=="string"&&cq.has(e)?e:void 0}const a1={droppedCount:0},mb=new Set;let vn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function pq(){return R5(mq,RN)}function RN(){return vn}function mq(e){return mb.add(e),()=>{mb.delete(e)}}function ms(e){vn={...vn,...e},Sq()}function NN(e){ms({agentClis:e})}function gq(e){const t={};for(const n of e)t[n.sessionId]=n;ms({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function yp(e){const t=!!vn.sessions[e.sessionId];ms({sessions:{...vn.sessions,[e.sessionId]:e},sessionOrder:t?vn.sessionOrder:[e.sessionId,...vn.sessionOrder],turnState:{...vn.turnState,[e.sessionId]:e.turnState}})}function LN(e){const{[e]:t,...n}=vn.sessions,{[e]:i,...r}=vn.turnState;ms({sessions:n,sessionOrder:vn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:vn.activeTerminalSessionId===e?null:vn.activeTerminalSessionId,turnState:r})}function MN(e){ms({activeTerminalSessionId:e})}function _q(e){ms({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...vn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&vn.tenantJobs[t])]})}function vq(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=iq(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??a1}}ms({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...vn.tenantOrder.filter(n=>t[n])]})}function yq(e,t){const n=e.tenantId,i=e.jobId??wq(e),r=vn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:a1},o=i?r.jobs[i]??pb(n,i,e.at):pb(n,"__unknown__",e.at),u=EN(o,e),d=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,f={...r,tenantLabel:t??r.tenantLabel,jobOrder:d,jobs:i?{...r.jobs,[i]:u}:r.jobs};return ms({tenantJobs:{...vn.tenantJobs,[n]:f},tenantOrder:vn.tenantOrder.includes(n)?vn.tenantOrder:[n,...vn.tenantOrder]}),{job:u,unknownTenant:!vn.tenantJobs[n]}}function bq(e,t,n){const i=vn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:a1};ms({tenantJobs:{...vn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function jN(e){const t=e.tenantId;if(!t)return[];const n=vn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function Sq(){for(const e of mb)e()}function wq(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const mE=250,xq=5e3,gb=new Map;function Cq(e){const t=new AbortController;return kq(t.signal,e),()=>t.abort()}async function kq(e,t){let n=mE;for(;!e.aborted;){ms({connection:"connecting"});try{await Rq(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}`);ms({connection:"live",connectionError:null}),n=mE,await Eq(i.body.getReader(),e,t),e.aborted||ms({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;ms({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await Lq(n,e),n=Math.min(n*2,xq)}}async function Eq(e,t,n){const i=new TextDecoder,r=uq();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const u of r(i.decode(o.value,{stream:!0}))){const d=hq(u);if(d){if(d.kind==="truncation"&&d.truncation){bq(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){yp(d.session),bp(n,d.session.sessionId,o1(d.session));continue}if(d.kind==="attention"&&d.session){yp(d.session),d.reason!=="idle_prompt"&&bp(n,d.session.sessionId,"awaiting");continue}d.event&&(yq(d.event,d.tenantLabel),Aq(n,d.event.tenantId))}}}}function o1(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&Tq(e)?"running":"idle"}function Tq(e){return jN(e).some(t=>!uc(t.status))}function bp(e,t,n){const i=gb.get(t);e.status.set(t,n),gb.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 Aq(e,t){const{sessions:n}=RN();for(const i of Object.values(n))i.tenantId===t&&gb.get(i.sessionId)!=="awaiting"&&bp(e,i.sessionId,o1(i))}async function Rq(e,t){const[n,i,r,o,u]=await Promise.all([kN(e),VW(e),GW(e),KW(e),YW(e)]);NN(n),gq(i),_q(r),vq(o);for(const d of i)bp(t,d.sessionId,o1(d));Nq(u.operations,t)}function Nq(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function Lq(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const Mq=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function jq(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 Oq(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function Dq(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 ON(e){if(e)return Mq.has(e)?e:void 0}function Iq(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function Qp(e){return e==="err"||e==="error"}function _h(e,t){return!uc(e)&&Iq(t)}function l1(e,t){return Qp(e)?"error":e==="done"||e==="aborted"?e:uc(t)?t:e}function Bq(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 $q(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 Pq(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 DN(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 zq(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})=>_h(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(_h(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function Hq(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=DN(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class em extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function Fq(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await c1(t),BN(await t.json(),t.status)}async function Uq(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 c1(i),IN(await i.json(),i.status)}async function Wq(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await c1(n),IN(await n.json(),n.status)}async function c1(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 em(e.status,t)}function IN(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new em(t,"Invalid model auth mutation response");return{state:BN(n.state,t)}}function BN(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new em(t,"Invalid model auth state response");return{providers:n.providers.map(i=>qq(i,t))}}function qq(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new em(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const _b=new Set;let vb={loading:!1,state:null,busyCli:null,error:null},Xr=0;function Gq(){return y.useSyncExternalStore(Kq,gE,gE)}function gE(){return vb}function Kq(e){return _b.add(e),()=>_b.delete(e)}async function Vq(e){const t=++Xr;Zr({loading:!0,error:null});try{const n=await Fq(e);if(t!==Xr)return;Zr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Xr)return;Zr({loading:!1,error:u1(n)})}}async function Yq(e,t){const n=++Xr;Zr({busyCli:e,error:null});try{const i=await Uq(e,t);return n!==Xr||(Zr({state:i.state,busyCli:null,error:null}),await $N()),!0}catch(i){return n!==Xr||Zr({busyCli:null,error:u1(i)}),!1}}async function Xq(e){const t=++Xr;Zr({busyCli:e,error:null});try{const n=await Wq(e);return t!==Xr||(Zr({state:n.state,busyCli:null,error:null}),await $N()),!0}catch(n){return t!==Xr||Zr({busyCli:null,error:u1(n)}),!1}}async function $N(){try{NN(await kN())}catch{}}function Zr(e){vb={...vb,...e};for(const t of _b)t()}function u1(e){return e instanceof Error?e.message:String(e)}class PN extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function Zq(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await zN(t),HN(await t.json(),t.status)}async function Jq(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await zN(n),HN(await n.json(),n.status)}async function zN(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 PN(e.status,t)}function HN(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new PN(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode,kimiModel:Qq(n.kimiModel)}}function Qq(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.model!="string"||t.model.length===0?null:{model:t.model,...typeof t.effort=="string"?{effort:t.effort}:{}}}const yb=new Set;let Sp={loading:!1,state:null,savingField:null,error:null},$f=0;function h1(){return y.useSyncExternalStore(eG,_E,_E)}function _E(){return Sp}function eG(e){return yb.add(e),()=>{yb.delete(e)}}async function d1(e){const t=++$f;ec({loading:!0,error:null});try{const n=await Zq(e);if(t!==$f)return;ec({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==$f)return;ec({loading:!1,error:FN(n)})}}async function f1(e,t){const n=Sp.state;if(!n||e==="kimiModel"&&t===null)return!1;$f+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:e==="codexLaunchMode"?{codexLaunchMode:i.codexLaunchMode}:{kimiModel:i.kimiModel};ec({state:i,savingField:e,error:null});try{const o=await Jq(r);return ec({state:o,savingField:null,error:null}),!0}catch(o){return ec({state:n,savingField:null,error:FN(o)}),!1}}function ec(e){Sp={...Sp,...e};for(const t of yb)t()}function FN(e){return e instanceof Error?e.message:String(e)}function tG({job:e}){const t=e.request;return c.jsxs("section",{className:"request-details","aria-label":`Request for ${e.label??e.jobId}`,children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),t?c.jsxs("div",{className:"request-details-blocks",children:[t.blocks.map((n,i)=>c.jsx(nG,{block:n},`${n.tag}-${i}`)),t.additional.trim().length>0?c.jsxs("section",{className:"request-details-block request-details-additional","aria-label":"Additional request",children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:"Additional"}),c.jsx("span",{className:"request-details-presence",children:"residual"})]}),c.jsx("pre",{children:t.additional})]}):null]}):c.jsx("p",{className:"request-details-unavailable",children:"Request unavailable for this legacy job."})]})}function nG({block:e}){const t=e.present?e.body.length===0?"present · empty":"present":e.required?"missing · required":"missing · optional";return c.jsxs("section",{className:"request-details-block","aria-label":`${e.tag} ${t}`,children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:e.tag}),c.jsx("span",{className:"request-details-hint",children:e.hint}),c.jsx("span",{className:"request-details-required",children:e.required?"required":"optional"}),c.jsx("span",{className:`request-details-presence ${e.present?"is-present":"is-missing"}`,children:t})]}),e.present?c.jsx("pre",{children:e.body}):null]})}const iG=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],sG="/plugins/terminal/agent/ticket",rG="/plugins/terminal/ws",hv="fleet-plugin.terminal.stream-dock-expanded",aG="fleet-plugin.terminal.stream-dock-collapsed",oG=56,lG=4e3,cG={...Yz,step:1,defaultValue:14},uG="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",hG=5e3,UN={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Yu(e.payload,"cliLabel")??void 0,render:e=>c.jsx(vG,{context:e}),canOpenCompanions:({api:e,operation:t})=>UR(e,t.id),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>c.jsx(EW,{context:e})},{id:Vu,title:"Artifacts",hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(rF,{context:e})}]},WN={id:"general",title:"General",render:()=>c.jsx(SG,{})},qN={id:"agent-cli",title:"Agent CLI",render:()=>c.jsx(wG,{})},GN={id:"agent.attention",title:"Agent input waiting"},dG={id:"agent.ended",title:"Agent turn ended"},df={id:"terminal",operationKinds:[UN],settingsSections:[WN,qN],notificationKinds:[GN,dG],install:e=>fG(e),closeOperation:async e=>{try{await JW(e)}finally{eF(e),LN(e)}},launch:async({theaterId:e,kind:t})=>{const n=await XW(e,t.id);return yp(n),MN(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?c.jsx(HG,{}):e.id==="claude"?c.jsx(PG,{}):e.id==="codex"?c.jsx(zG,{}):c.jsx($G,{})};function fG(e){return Cq({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function KN(e,t){const n=y.useRef(null),i=y.useRef(!0),[r,o]=y.useState(!0),u=y.useCallback(f=>{i.current!==f&&(i.current=f,o(f))},[]);y.useEffect(()=>{const f=n.current;if(!f)return;const p=()=>{const m=f.scrollHeight-f.scrollTop-f.clientHeight;u(m<=oG)};return f.addEventListener("scroll",p,{passive:!0}),()=>f.removeEventListener("scroll",p)},[e,u]),y.useLayoutEffect(()=>{u(!0);const f=n.current;f&&(f.scrollTop=f.scrollHeight)},[e,u]),y.useLayoutEffect(()=>{const f=n.current;!f||!i.current||(f.scrollTop=f.scrollHeight)},[t]);const d=y.useCallback(()=>{const f=n.current;f&&(f.scrollTop=f.scrollHeight,f.focus({preventScroll:!0}),u(!0))},[u]);return{containerRef:n,pinned:r,jumpToLatest:d}}function pG(e){return Array.from(e.querySelectorAll("button, summary, [href], input, select, textarea, [tabindex]")).filter(t=>{if(t.tabIndex<0||t.hidden||t.closest("[hidden]")||t.matches(":disabled"))return!1;const n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"&&t.getClientRects().length>0})}function mG(){const[e,t]=y.useState(()=>{try{return localStorage.removeItem(aG),localStorage.getItem(hv)==="true"}catch{return!1}}),n=y.useCallback(i=>{try{i?localStorage.setItem(hv,"true"):localStorage.removeItem(hv)}catch{}t(i)},[]);return[e,n]}function gG(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?"":jq((t??n)-e)}function _G(e){const t=e.companionsOpen??!1,[n,i]=y.useState(!1);return y.useEffect(()=>{if(t||n)return;let r=!1,o=!1;const u=async()=>{if(o)return;o=!0;const f=await UR(e.api,e.operationId);o=!1,!r&&f&&i(!0)};u();const d=window.setInterval(()=>{u()},hG);return()=>{r=!0,window.clearInterval(d)}},[t,e.api,e.operationId,n]),t||n}function vE({context:e,ready:t}){const n=e.companionsOpen??!1;return c.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}`,"aria-label":n?"Exit Session Analyst":"Open Session Analyst","aria-pressed":n,"aria-disabled":!t,disabled:!t,title:t?void 0:"Send a message in this session first",onClick:()=>{t&&e.onRequestCompanions?.(!e.companionsOpen)},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),c.jsx("span",{className:"session-analyst-handle__label",children:n?"EXIT":"ANALYZE"})]})}function vG({context:e}){const n=pq().sessions[e.operationId]??LG(e),[i,r]=y.useState(!1),[o,u]=y.useState("request"),[d,f]=y.useState([]),[p,m]=y.useState([]),_=y.useId(),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(new Set),k=y.useRef(!0),O=_G(e);y.useEffect(()=>{const R=e.companionsOpen??!1,D=k.current;k.current=R,D&&!R&&tF(e.operationId)},[e.companionsOpen,e.operationId]);const P=jN(n),F=P.filter(R=>!uc(R.status)),T=Hq(F,P,p),L=DN(P,d),M=`${i}:${o}`,z=L.map(R=>`${R.jobId}:${R.lastEventId}`).join(","),U=KN(M,z);y.useLayoutEffect(()=>{const R=x.current,D=P.filter(N=>R.has(N.jobId)&&uc(N.status)).map(N=>N.jobId);x.current=new Set(F.map(N=>N.jobId)),D.length!==0&&m(N=>$q(N,D,Date.now()+lG))},[F,P]),y.useEffect(()=>{if(p.length===0)return;const R=Math.min(...p.map(N=>N.expiresAt)),D=window.setTimeout(()=>{m(N=>Pq(N,P,Date.now()))},Math.max(0,R-Date.now()));return()=>window.clearTimeout(D)},[P,p]),y.useEffect(()=>{i&&f(R=>Bq(R,F.map(D=>D.jobId)))},[F,i]);const Z=y.useCallback(()=>{r(!1),f([]),w.current?.focus()},[]),Q=y.useCallback(()=>{f(T.map(R=>R.jobId)),u("request"),r(!0)},[T]),G=y.useCallback(R=>{u(R)},[]),B=y.useCallback(R=>{const D=["request","activity"],N=D.indexOf(o);let E;if(R.key==="ArrowLeft"&&(E=(N+D.length-1)%D.length),R.key==="ArrowRight"&&(E=(N+1)%D.length),R.key==="Home"&&(E=0),R.key==="End"&&(E=D.length-1),E===void 0)return;R.preventDefault();const $=D[E];u($),document.getElementById(`${_}-${$}`)?.focus()},[o,_]);return y.useLayoutEffect(()=>{if(!i)return;const R=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame(R)},[i]),y.useEffect(()=>{if(!i)return;const R=D=>{if(D.key==="Escape"){D.stopPropagation(),Z();return}if(D.key==="Tab"){const N=S.current;if(!N)return;const E=pG(N),$=E[0],j=E[E.length-1];D.shiftKey&&document.activeElement===$?(D.preventDefault(),j?.focus()):!D.shiftKey&&document.activeElement===j&&(D.preventDefault(),$?.focus())}};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[i,Z]),n.status==="dormant"?c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(vE,{context:e,ready:O}),c.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{NG(n.sessionId)},children:[c.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),c.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]})]}):c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(vE,{context:e,ready:O}),c.jsx(K0,{operationId:n.sessionId,ticketPath:sG,wsPath:rG,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>LN(n.sessionId)}),T.length>0?c.jsx(yG,{activeJobs:T,onOpenDetail:Q,detailBtnRef:w}):null,i?c.jsxs("div",{ref:S,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[c.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:Z}),c.jsxs("div",{className:"job-overlay-card",children:[c.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:Z,children:"×"}),c.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[c.jsx("button",{id:`${_}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${_}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>G("request"),onKeyDown:B,children:"Request"}),c.jsx("button",{id:`${_}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${_}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>G("activity"),onKeyDown:B,children:"Activity"})]}),c.jsx("div",{id:`${_}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:L.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):L.map(R=>c.jsx(tG,{job:R},R.jobId))}),c.jsx("div",{id:`${_}-activity-panel`,ref:o==="activity"?U.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:L.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):L.map(R=>c.jsx(AG,{job:R},R.jobId))}),o==="activity"&&!U.pinned?c.jsx("button",{type:"button",className:"follow-button",onClick:U.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function yG({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=mG(),o=e[0],u=gG(o?.startedAt,o?.finishedAt),d=e.reduce((M,z)=>M+Dq(z),0),f=Oq(d),p=e.length===1&&o?ON(o.ownerCarrierId):void 0,m=e.length===1&&o?o.label:void 0,_=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",b=zq(e),S=e.map(M=>`${M.jobId}:${M.lastEventId}`).join(","),w=`${i}:${e.map(M=>M.jobId).join(",")}`,{containerRef:x,pinned:k,jumpToLatest:O}=KN(w,S),P=e.some(M=>M.trackOrder.some(z=>{const U=M.tracks[z];return U?_h(M.status,U.status):!1})),F=e.some(M=>!uc(M.status)),T=e.some(M=>M.status==="error"||M.trackOrder.some(z=>Qp(M.tracks[z]?.status??""))),L=F?"job-dock-dot":T?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return c.jsxs("div",{className:"job-dock",children:[c.jsxs("div",{className:"job-dock-strip",children:[c.jsx("span",{className:L,"aria-hidden":"true"}),c.jsxs("span",{className:"job-dock-carrier",title:m,children:[p?c.jsx("span",{className:"job-dock-captain-dot","data-captain":p,"aria-hidden":"true"}):null,c.jsx("span",{className:"job-dock-captain-tag",children:_})]}),c.jsxs("span",{className:"job-dock-strip-line",style:i?{display:"none"}:void 0,"aria-hidden":"true",children:[b.thinking?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):b.text,!i&&P&&b.text?c.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),c.jsxs("span",{className:"job-dock-meta",children:[u?c.jsx("span",{children:u}):null,f?c.jsx("span",{children:f}):null]}),c.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?"▼":"▲"}),c.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),c.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[c.jsxs("div",{ref:x,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&m?c.jsx("div",{className:"job-dock-row",children:c.jsx("span",{className:"job-dock-row-label",children:m})}):null,e.map(M=>{const z=e.length>1,U=!z&&M.trackOrder.length===1;return M.trackOrder.map(Z=>{const Q=M.tracks[Z];return Q?c.jsx(bG,{track:Q,job:M,multiJob:z,singleTrack:U},`${M.jobId}:${Z}`):null})})]}),k?null:c.jsx("button",{type:"button",className:"follow-button",onClick:O,children:"↓ Follow"})]})]})}function bG({track:e,job:t,multiJob:n,singleTrack:i}){const r=_h(t.status,e.status),u=jG(e.text),d=!u&&r&&!!e.thought,f=r?MG(e):void 0,p=l1(e.status,t.status),m=n||!i,_=n?ON(t.ownerCarrierId):void 0;return c.jsxs("div",{className:"job-dock-row",children:[m?c.jsxs("span",{className:"job-dock-row-name",children:[_?c.jsx("span",{className:"job-dock-captain-dot","data-captain":_,"aria-hidden":"true"}):null,c.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,c.jsxs("span",{className:`job-dock-row-status${r?" job-dock-row-status--live":""}${Qp(p)?" job-dock-row-status--error":""}`,children:[p,f?` · ${f}`:""]}),u?c.jsxs("span",{className:"job-dock-row-line",children:[u,r?c.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,d?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function SG(){const{renderer:e,font:t}=zR();return c.jsxs(c.Fragment,{children:[c.jsx(kG,{}),c.jsx(OG,{terminalFont:t}),c.jsx(DG,{terminalRenderer:e})]})}function wG(){const[e,t]=y.useState([]),[n,i]=y.useState(null),r=h1();return y.useEffect(()=>{const o=new AbortController;return qW(o.signal).then(u=>t(u.clis)).catch(u=>{o.signal.aborted||i(u instanceof Error?u.message:String(u))}),()=>o.abort()},[]),y.useEffect(()=>{const o=new AbortController;return d1(o.signal),()=>o.abort()},[]),c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[c.jsx("div",{className:"agent-cli-head",children:c.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),c.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?c.jsx("p",{className:"settings-error",children:n}):null,c.jsx("div",{className:"agent-cli-list",children:e.map(o=>c.jsx(TG,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:u=>{f1("codexLaunchMode",u)}},o.id))}),r.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:r.error}):null,c.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."}),c.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),c.jsx(xG,{})]})}function xG(){const e=Gq(),t=h1(),[n,i]=y.useState(null);y.useEffect(()=>{const m=new AbortController;return Vq(m.signal),()=>m.abort()},[]),y.useEffect(()=>{const m=new AbortController;return wN(m.signal).then(_=>i(_.cliTypes.find(b=>b.id==="claude-kimi")??null)).catch(()=>{}),()=>m.abort()},[]),y.useEffect(()=>{const m=new AbortController;return d1(m.signal),()=>m.abort()},[]);const r=t.state?.kimiModel??null,o=r?.model??n?.defaultModel,u=n?.models.find(m=>m.modelId===o),d=r?.effort??u?.effort?.default,f=t.savingField!==null,p=(m,_)=>{f1("kimiModel",_?{model:m,effort:_}:{model:m})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[c.jsxs("div",{className:"model-auth-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Settings for Kimi"}),c.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?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(m=>c.jsx(CG,{provider:m,busy:e.busyCli===m.cli},m.cli)),n&&o?c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"terminal-carriers-runtime-row",children:[c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("label",{className:"terminal-carriers-label",htmlFor:"kimi-default-model",children:"Default model"}),c.jsx("select",{id:"kimi-default-model",className:"terminal-carriers-select",value:o,disabled:f||!t.state,onChange:m=>{const _=n.models.find(b=>b.modelId===m.target.value);_&&p(_.modelId,_.effort?r?.effort??_.effort.default:void 0)},children:n.models.map(m=>c.jsx("option",{value:m.modelId,children:m.name},m.modelId))})]}),u?.effort?c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("label",{className:"terminal-carriers-label",htmlFor:"kimi-default-effort",children:"Default effort"}),c.jsx("select",{id:"kimi-default-effort",className:"terminal-carriers-select",value:d??u.effort.default,disabled:f||!t.state,onChange:m=>p(u.modelId,m.target.value),children:u.effort.levels.map(m=>c.jsx("option",{value:m,children:m},m))})]}):null]}),c.jsx("p",{className:"global-settings-help",children:"Used for Kimi sessions without an explicit carrier model. Applies to newly launched sessions."})]}):null,c.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function CG({provider:e,busy:t}){const[n,i]=y.useState(""),r=async()=>{await Yq(e.cli,n)&&i("")};return c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"model-auth-row-head",children:[c.jsx("span",{className:"model-auth-name",children:e.displayName}),c.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?c.jsx("div",{className:"model-auth-actions",children:c.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{Xq(e.cli)},children:t?"Working…":"Sign out"})}):c.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[c.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)}),c.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function kG(){const e=h1(),t=e.state,n=e.savingField!==null;return y.useEffect(()=>{const i=new AbortController;return d1(i.signal),()=>i.abort()},[]),c.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?c.jsx(c.Fragment,{children:c.jsx(EG,{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:()=>{f1("enableMetaphor",!t.enableMetaphor)}})}):c.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function EG({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:u}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:e}),c.jsx("p",{className:"global-settings-help",children:t})]}),c.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:u,children:c.jsx("span",{children:r?n:i})})]})}function TG({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return c.jsxs("div",{className:"agent-cli-row",children:[c.jsx("span",{className:"agent-cli-name",children:e.displayName}),c.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?c.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[c.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),c.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?c.jsx("span",{className:"agent-cli-version",children:e.version}):null,c.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function AG({job:e}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),c.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?c.jsx(RG,{track:n,jobStatus:e.status},n.trackId):null})})]})}function RG({track:e,jobStatus:t}){const n=BG(e.status,t),i=n==="track-card--live",r=l1(e.status,t);return c.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[c.jsxs("header",{className:"track-card-head",children:[c.jsx("span",{className:"track-card-title",children:e.displayName}),c.jsx("span",{className:"track-card-status",children:r})]}),e.thought?c.jsxs("details",{className:"track-card-thinking",children:[c.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),c.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:c.jsx("pre",{children:e.thought})})]}):null,e.text?c.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[c.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),c.jsxs("pre",{children:[e.text,i?c.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?c.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?c.jsx("ul",{className:"track-card-tools",children:e.tools.map(o=>c.jsx("li",{children:o.name??o.id},o.id))}):null]})}async function NG(e){yp(await ZW(e)),MN(e)}function LG(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Yu(e.operation.payload,"cliId")??void 0,cliLabel:Yu(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Yu(e.operation.payload,"tenantId")??void 0,registrationId:Yu(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Yu(e,t){const n=e[t];return typeof n=="string"?n:null}function MG(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 jG(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
221
|
+
`);return n[n.length-1]?.trim()??""}function OG({terminalFont:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!0),[o,u]=y.useState(null),d=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Jl.id:Jl.id}:{source:"system",familyName:e.customName};y.useEffect(()=>{const p=new AbortController;return r(!0),u(null),uA({signal:p.signal}).then(m=>{p.signal.aborted||n(m.fonts.filter(_=>_.monospace).map(_=>({family:_.family,monospace:_.monospace})))}).catch(m=>{p.signal.aborted||IG(m)||(n([]),u("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{p.signal.aborted||r(!1)}),()=>p.abort()},[]);const f=p=>{if(p.source==="system"){rH(p.familyName);return}const m=hh.find(_=>_.id===p.id);m&&sH(m.id)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[c.jsx("div",{className:"global-settings-row",children:c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.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."})]})}),c.jsx("div",{"aria-describedby":"terminal-font-help",children:c.jsx(lA,{builtIns:hh.map(p=>({id:p.id,label:p.name,family:p.family,aliases:[p.familyName],description:p.meta})),installedFonts:t,selected:d,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Jl.family,previewText:uG,size:e.size,sizeRange:cG,loading:i,error:o,onSelectionChange:f,onSizeCommit:aH})}),c.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 DG({terminalRenderer:e}){return c.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),c.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."})]}),c.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:iG.map(t=>{const n=t.id===e;return c.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>iH(t.id),children:t.label},t.id)})})]})})}function IG(e){return e instanceof DOMException&&e.name==="AbortError"}function BG(e,t){if(_h(t,e))return"track-card--live";const n=l1(e,t);return Qp(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function $G(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function PG(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.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 zG(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function HG(){return c.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const FG={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},bb=new Set;let xi={loading:!1,state:null,options:null,activeCarrierId:null,draft:FG,savingActionId:null,error:null};function VN(){return y.useSyncExternalStore(UG,yE,yE)}function yE(){return xi}function UG(e){return bb.add(e),()=>{bb.delete(e)}}async function dv(e){pr({loading:!0,error:null});try{const[t,n]=await Promise.all([SN(e),wN(e)]);YN(t,n)}catch(t){if(e?.aborted)return;pr({loading:!1,error:ZN(t)})}}function WG(e){const t=xi.state?.carriers.find(n=>n.carrierId===e);pr({activeCarrierId:e,draft:t?p1(t,xi.options):xi.draft,error:null})}function Kl(e){pr({draft:{...xi.draft,...e},error:null})}function Sb(e,t){const n=xi.draft.taskforce[e]??{model:"",effort:""};pr({draft:{...xi.draft,taskforce:{...xi.draft.taskforce,[e]:{...n,...t}}},error:null})}function qG(){const e=XN();e&&pr({draft:p1(e,xi.options),error:null})}async function GG(e){const t=XN();return t?KG("save-all",async()=>{const n=xi.draft;let i=null;n.displayName!==t.displayName&&(i=(await uv(t.carrierId,{displayName:n.displayName})).state);const r=n.cliType!==t.cliType;return r&&(i=(await uv(t.carrierId,{cli:n.cliType})).state),(r||n.model!==t.model||(n.effort||"")!==(t.effort||""))&&(i=(await uv(t.carrierId,{model:YG(n)})).state),i=await XG(t,e,i),{state:i??await SN()}}):!1}function YN(e,t){const n=ZG(e,xi.activeCarrierId),i=e.carriers.find(r=>r.carrierId===n)??null;pr({loading:!1,state:e,options:t,activeCarrierId:n,draft:i?p1(i,t):xi.draft,error:null})}async function KG(e,t){pr({savingActionId:e,error:null});try{const n=await t();return YN(n.state,xi.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),pr({savingActionId:null}),!0}catch(n){return pr({savingActionId:null,error:ZN(n)}),!1}}function p1(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??VG(i.id,r?.model??i.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:n}}function VG(e,t,n){return n?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function YG(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function XN(){return xi.state?.carriers.find(e=>e.carrierId===xi.activeCarrierId)??null}async function XG(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 $W(e.carrierId,r.cliType)).state);for(const r of t){const o=e.taskforce.backends.find(u=>u.cliType===r.cliType);o&&o.model===r.model&&(o.effort||"")===(r.effort||"")||(n=(await BW(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return n}function ZG(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function pr(e){xi={...xi,...e};for(const t of bb)t()}function ZN(e){return e instanceof Error?e.message:String(e)}const JG=50,QG=2400,eK={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)"},tK={id:"carriers",title:"Carriers",render:()=>c.jsx(nK,{})};function nK(){const e=VN(),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),[u,d]=y.useState([]),[f,p]=y.useState("idle"),m=e.savingActionId==="save-all",_=t?lK(t,e.draft,u):!1,b=t?.taskforce.backends.map(x=>`${x.cliType}:${x.model}:${x.effort??""}`).join("|")??"";y.useEffect(()=>{const x=new AbortController;return dv(x.signal),()=>x.abort()},[]),y.useEffect(()=>{o(!1),d(t?.taskforce.backends.map(x=>x.cliType)??[]),p("idle")},[t?.carrierId,b]),y.useEffect(()=>{if(f!=="saved")return;const x=window.setTimeout(()=>p("idle"),QG);return()=>window.clearTimeout(x)},[f]);function S(){t&&(qG(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),p("idle"))}async function w(){if(!t)return;if(p("saving"),!await GG(uK(u,e.draft.taskforce))){p("idle");return}o(!1),p("saved")}return c.jsxs(c.Fragment,{children:[e.error?c.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,c.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?c.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?c.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(x=>c.jsx(iK,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>WG(x.carrierId)},x.carrierId))]}),t&&e.options&&n?c.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:eL(t.carrierId),children:[c.jsxs("div",{className:"terminal-carriers-detail-head",children:[c.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[c.jsxs("div",{className:"terminal-carriers-captain-id",children:[c.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),c.jsx("div",{className:`terminal-carriers-name-line ${r?"is-editing":""}`,children:r?c.jsxs(c.Fragment,{children:[c.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:e.draft.displayName,maxLength:JG,onChange:x=>Kl({displayName:x.target.value})}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Save display name",disabled:m,onClick:()=>{o(!1)},children:c.jsx(dK,{})}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Cancel display name edit",onClick:()=>{Kl({displayName:t.displayName}),o(!1)},children:c.jsx(fK,{})})]}):c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",onClick:()=>{Kl({displayName:t.displayName}),o(!0)},children:c.jsx(hK,{})})]})}),c.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),c.jsxs("div",{className:"terminal-carriers-detail-actions",children:[c.jsx("div",{className:`terminal-carriers-save-status ${f==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:f==="saving"||m?"Saving…":f==="saved"?"Saved ✓":""}),c.jsxs("div",{className:"terminal-carriers-save-actions",children:[c.jsx("button",{type:"button",className:`terminal-carriers-action-button ${_?"is-dirty":""}`,disabled:!_||m,onClick:()=>{w()},children:"Save"}),c.jsx("button",{type:"button",className:`terminal-carriers-action-button ${_?"is-dirty":""}`,disabled:!_||m,onClick:S,children:"Discard"}),c.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading,onClick:()=>{dv()},children:"Refresh"})]})]})]}),c.jsxs("div",{className:"terminal-carriers-body",children:[c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),c.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),c.jsxs("div",{className:"terminal-carriers-runtime",children:[c.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:c.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[c.jsx("label",{className:"terminal-carriers-label",htmlFor:"carrier-cli",children:"CLI"}),c.jsx("select",{id:"carrier-cli",className:"terminal-carriers-select",value:e.draft.cliType,onChange:x=>rK(x.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(x=>c.jsx("option",{value:x.id,children:x.displayName},x.id))})]})}),c.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[c.jsx(JN,{id:"carrier-model",label:"Model",models:n.models,value:e.draft.model,onChange:x=>aK(n,x)}),c.jsx(QN,{id:"carrier-effort",model:i,value:e.draft.effort,onChange:x=>Kl({effort:x})})]})]})]}),t.taskForceCapable?c.jsx(sK,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:u,onRowsChange:d}):null]})]},t.carrierId):c.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[c.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),c.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{dv()},children:"Refresh"})]})]})}function iK({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return c.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:eL(e.carrierId),onClick:i,children:[c.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),c.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?c.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function JN({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:t}),c.jsx("select",{id:e,className:"terminal-carriers-select",value:i,disabled:r,onChange:u=>o(u.target.value),children:n.map(u=>c.jsx("option",{value:u.modelId,children:u.name},u.modelId))})]})}function QN({id:e,model:t,value:n,disabled:i=!1,onChange:r}){return t?.effort?c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:"Effort"}),c.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=>c.jsx("option",{value:o,children:o},o))})]}):c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),c.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]})}function sK({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,rows:r,onRowsChange:o}){const u=VN(),d=e.taskforce.backends.length,[f,p]=y.useState(d>0),[m,_]=y.useState(!1),[b,S]=y.useState(""),w=e.taskforce.backends.length>=n,x=t.filter(O=>!r.includes(O.id)),k=b||x[0]?.id||"";return c.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${f?"is-expanded":""}`,children:[c.jsxs("div",{className:"terminal-carriers-section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),c.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.`})]}),c.jsx("div",{className:"terminal-carriers-tf-head-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":f,onClick:()=>p(O=>!O),children:f?"Hide":"Configure"})})]}),f?c.jsxs("div",{className:"terminal-carriers-tf-list",children:[r.length===0?c.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend drafted."}):null,r.map(O=>{const P=t.find(M=>M.id===O);if(!P)return null;const F=u.draft.taskforce[P.id]??{model:P.defaultModel,effort:""},T=P.models.find(M=>M.modelId===F.model)??P.models[0]??null,L=e.taskforce.backends.some(M=>M.cliType===P.id);return c.jsxs("div",{className:`terminal-carriers-tf-item ${L?"is-active":""}`,children:[c.jsxs("div",{className:"terminal-carriers-tf-title",children:[c.jsx("span",{className:`terminal-carriers-live-dot ${L?"is-live":""}`,"aria-hidden":"true"}),c.jsx("strong",{children:P.displayName})]}),c.jsx(JN,{id:`tf-${P.id}-model`,label:"Model",models:P.models,value:F.model,onChange:M=>oK(P,M)}),c.jsx(QN,{id:`tf-${P.id}-effort`,model:T,value:F.effort,onChange:M=>Sb(P.id,{effort:M})}),c.jsx("div",{className:"terminal-carriers-tf-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:i==="save-all",onClick:()=>o(r.filter(M=>M!==P.id)),children:"Remove"})})]},P.id)}),c.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[m&&x.length>0?c.jsx("select",{className:"terminal-carriers-select terminal-carriers-tf-add-select",value:k,onChange:O=>S(O.target.value),"aria-label":"Task Force CLI to add",children:x.map(O=>c.jsx("option",{value:O.id,children:O.displayName},O.id))}):null,c.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:x.length===0||i==="save-all",onClick:()=>{if(!m){_(!0);return}const O=k,P=t.find(T=>T.id===O),F=P?.models.find(T=>T.modelId===P.defaultModel)??P?.models[0]??null;!P||!F||(Sb(P.id,{model:F.modelId,effort:F.effort?.default??""}),o(r.includes(P.id)?r:[...r,P.id]),S(""),_(!1))},children:"Add"})]})]}):null]})}function rK(e,t){const n=t.find(r=>r.id===e),i=n?.models.find(r=>r.modelId===n.defaultModel)??n?.models[0]??null;Kl({cliType:e,model:i?.modelId??"",effort:i?.effort?.default??""})}function aK(e,t){const n=e.models.find(i=>i.modelId===t);Kl({model:t,effort:n?.effort?.default??""})}function oK(e,t){const n=e.models.find(i=>i.modelId===t);Sb(e.id,{model:t,effort:n?.effort?.default??""})}function lK(e,t,n){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:cK(e,n,t.taskforce)}function cK(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 uK(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 eL(e){return{"--cap-color":eK[e]??"var(--brass)"}}function hK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.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"}),c.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function dK(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:c.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function fK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),c.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const pK="global-shell:theater:",mK="/plugins/terminal/global/ticket",gK="/plugins/terminal/ws",_K=168,vK={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},yK={id:"global-shell",title:"Shell",icon:bK,preferredExtraWidth:_K,render:e=>c.jsx("div",{style:vK,children:c.jsx(K0,{operationId:`${pK}${encodeURIComponent(e.theaterId??"")}`,ticketPath:mK,wsPath:gK,theme:"instrument",active:!0})})};function bK(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const SK="/plugins/terminal/shell/ticket",wK="/plugins/terminal/ws",tL={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>y.createElement(xK,{context:e})},fv={id:"terminal",operationKinds:[tL],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:()=>c.jsx(CK,{})};function xK({context:e}){return c.jsx(K0,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:SK,wsPath:wK,theme:e.theme,onExit:e.onClose})}function CK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),c.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 kK=new Set(["agent"]),EK={id:"terminal",operationKinds:[tL,UN],settingsSections:[WN,qN,tK],notificationKinds:[GN],railPanels:[yK],install:e=>(HR(),nH(e.settings),df.install?.(e)),closeOperation:async e=>{const t=await AK(e);if(t?.type==="shell"){await fv.closeOperation?.(e);return}t&&kK.has(t.type)&&await df.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?fv.launch?.(e)??{id:""}:df.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?fv.renderLaunchIcon?.(e):df.renderLaunchIcon?.(e)},TK=[EK];async function AK(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 te={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"},RK={src:te.ts,lib:te.ts,app:te.ts,test:te.shell,tests:te.shell,__tests__:te.shell,spec:te.shell,specs:te.shell,node_modules:te.binary,vendor:te.binary,dist:te.config,build:te.config,out:te.config,target:te.config,docs:te.md,doc:te.md,public:te.data,assets:te.data,static:te.data,components:te.image,scripts:te.js,styles:te.css,".git":te.html,".github":te.config,".vscode":te.css},bE={ts:{shape:"angle",tone:te.ts},tsx:{shape:"angle",tone:te.ts},mts:{shape:"angle",tone:te.ts},cts:{shape:"angle",tone:te.ts},"d.ts":{shape:"angle",tone:te.ts},js:{shape:"angle",tone:te.js},jsx:{shape:"angle",tone:te.js},mjs:{shape:"angle",tone:te.js},cjs:{shape:"angle",tone:te.js},json:{shape:"braces",tone:te.json},jsonc:{shape:"braces",tone:te.json},json5:{shape:"braces",tone:te.json},jsonl:{shape:"braces",tone:te.json},graphql:{shape:"braces",tone:te.image},gql:{shape:"braces",tone:te.image},proto:{shape:"braces",tone:te.go},css:{shape:"hash",tone:te.css},scss:{shape:"hash",tone:te.css},sass:{shape:"hash",tone:te.css},less:{shape:"hash",tone:te.css},styl:{shape:"hash",tone:te.css},html:{shape:"markup",tone:te.html},htm:{shape:"markup",tone:te.html},xml:{shape:"markup",tone:te.html},xhtml:{shape:"markup",tone:te.html},vue:{shape:"markup",tone:te.shell},svelte:{shape:"markup",tone:te.rust},astro:{shape:"markup",tone:te.image},md:{shape:"doc",tone:te.md},mdx:{shape:"doc",tone:te.md},markdown:{shape:"doc",tone:te.md},rst:{shape:"doc",tone:te.md},txt:{shape:"doc",tone:te.default},text:{shape:"doc",tone:te.default},log:{shape:"doc",tone:te.default},adoc:{shape:"doc",tone:te.md},pdf:{shape:"doc",tone:te.ruby},py:{shape:"angle",tone:te.py},pyi:{shape:"angle",tone:te.py},pyw:{shape:"angle",tone:te.py},go:{shape:"angle",tone:te.go},rs:{shape:"angle",tone:te.rust},rb:{shape:"angle",tone:te.ruby},rake:{shape:"angle",tone:te.ruby},gemspec:{shape:"angle",tone:te.ruby},java:{shape:"angle",tone:te.html},kt:{shape:"angle",tone:te.config},kts:{shape:"angle",tone:te.config},scala:{shape:"angle",tone:te.ruby},c:{shape:"angle",tone:te.ts},h:{shape:"angle",tone:te.ts},cpp:{shape:"angle",tone:te.css},cc:{shape:"angle",tone:te.css},cxx:{shape:"angle",tone:te.css},hpp:{shape:"angle",tone:te.css},cs:{shape:"angle",tone:te.config},php:{shape:"angle",tone:te.config},swift:{shape:"angle",tone:te.html},lua:{shape:"angle",tone:te.ts},dart:{shape:"angle",tone:te.go},sh:{shape:"terminal",tone:te.shell},bash:{shape:"terminal",tone:te.shell},zsh:{shape:"terminal",tone:te.shell},fish:{shape:"terminal",tone:te.shell},ps1:{shape:"terminal",tone:te.css},bat:{shape:"terminal",tone:te.shell},cmd:{shape:"terminal",tone:te.shell},yaml:{shape:"gear",tone:te.config},yml:{shape:"gear",tone:te.config},toml:{shape:"gear",tone:te.config},ini:{shape:"gear",tone:te.config},conf:{shape:"gear",tone:te.config},cfg:{shape:"gear",tone:te.config},properties:{shape:"gear",tone:te.config},env:{shape:"gear",tone:te.config},editorconfig:{shape:"gear",tone:te.config},png:{shape:"image",tone:te.image},jpg:{shape:"image",tone:te.image},jpeg:{shape:"image",tone:te.image},gif:{shape:"image",tone:te.image},webp:{shape:"image",tone:te.image},svg:{shape:"image",tone:te.image},ico:{shape:"image",tone:te.image},bmp:{shape:"image",tone:te.image},avif:{shape:"image",tone:te.image},tiff:{shape:"image",tone:te.image},heic:{shape:"image",tone:te.image},mp4:{shape:"image",tone:te.data},mov:{shape:"image",tone:te.data},webm:{shape:"image",tone:te.data},mkv:{shape:"image",tone:te.data},mp3:{shape:"chip",tone:te.shell},wav:{shape:"chip",tone:te.shell},flac:{shape:"chip",tone:te.shell},ogg:{shape:"chip",tone:te.shell},sql:{shape:"database",tone:te.data},csv:{shape:"database",tone:te.data},tsv:{shape:"database",tone:te.data},db:{shape:"database",tone:te.data},sqlite:{shape:"database",tone:te.data},sqlite3:{shape:"database",tone:te.data},parquet:{shape:"database",tone:te.data},zip:{shape:"archive",tone:te.archive},tar:{shape:"archive",tone:te.archive},gz:{shape:"archive",tone:te.archive},tgz:{shape:"archive",tone:te.archive},bz2:{shape:"archive",tone:te.archive},xz:{shape:"archive",tone:te.archive},rar:{shape:"archive",tone:te.archive},"7z":{shape:"archive",tone:te.archive},zst:{shape:"archive",tone:te.archive},bin:{shape:"chip",tone:te.binary},exe:{shape:"chip",tone:te.binary},dll:{shape:"chip",tone:te.binary},so:{shape:"chip",tone:te.binary},dylib:{shape:"chip",tone:te.binary},wasm:{shape:"chip",tone:te.config},class:{shape:"chip",tone:te.binary},lock:{shape:"chip",tone:te.binary},woff:{shape:"chip",tone:te.config},woff2:{shape:"chip",tone:te.config},ttf:{shape:"chip",tone:te.config},otf:{shape:"chip",tone:te.config}},NK={dockerfile:{shape:"chip",tone:te.css},"docker-compose.yml":{shape:"gear",tone:te.css},"docker-compose.yaml":{shape:"gear",tone:te.css},makefile:{shape:"gear",tone:te.html},"cmakelists.txt":{shape:"gear",tone:te.html},".gitignore":{shape:"gear",tone:te.html},".gitattributes":{shape:"gear",tone:te.html},".dockerignore":{shape:"gear",tone:te.html},".npmignore":{shape:"gear",tone:te.html},".npmrc":{shape:"gear",tone:te.ruby},"package.json":{shape:"braces",tone:te.shell},"tsconfig.json":{shape:"braces",tone:te.ts},license:{shape:"doc",tone:te.json},"license.md":{shape:"doc",tone:te.json},licence:{shape:"doc",tone:te.json}},LK={shape:"default",tone:te.default},wb={angle:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.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"}),c.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),c.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.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"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:c.jsxs(c.Fragment,{children:[c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),c.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"}),c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),c.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"}),c.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.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:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:c.jsxs(c.Fragment,{children:[c.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"}),c.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:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.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"}),c.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 MK({name:e}){const t=OK(e);return c.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:wb[t.shape]})}function jK({name:e,open:t}){const n=RK[e.toLowerCase()]??te.folder;return c.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?wb.folderOpen:wb.folderClosed})}function OK(e){const t=e.toLowerCase(),n=NK[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:te.config};if(t.startsWith("readme"))return{shape:"doc",tone:te.md};if(t.endsWith(".d.ts"))return bE["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=bE[r];if(o)return o}return LK}const DK=200,ff=30,SE=5,nL="fleet-console.fileExplorer.showHidden",wE=500;function Ws(e,t){return e===t}async function IK({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const u=[],d=new Map(t),f=new Set,p=new Set;let m=0;const _=b=>{for(const S of b)if(!(!$K(S,i)||f.has(S.relativePath))){if(f.size>=wE)return;f.add(S.relativePath),u.push(S)}};for(_(e);u.length>0&&r();){const b=u.shift();if(!b)return;const S=d.get(b.relativePath);if(S){if(p.has(S.relativePath))continue;p.add(S.relativePath),_(S.entries);continue}if(m>=wE)return;m+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(d.set(b.relativePath,w),o(b.relativePath,w),p.has(w.relativePath))continue;p.add(w.relativePath),_(w.entries)}catch{}}}function iL(e,t,n,i,r,o,u,d,f=new Set){const p=[];for(const m of e){if(!d&&m.name.startsWith("."))continue;const _=o.get(m.relativePath),b=_?.entries,S=_?.relativePath??m.relativePath,w=m.kind==="dir"&&f.has(S),x=m.kind==="dir"&&!w&&sL(b??[],o,u,d);if(u&&!m.name.toLowerCase().includes(u)&&!x)continue;const k=i.has(m.relativePath)||!!(u&&x);if(p.push({entry:m,depth:t,isSelected:n===m.relativePath,isExpanded:k,isLoading:r.has(m.relativePath)}),m.kind==="dir"&&k&&!w&&b){const O=new Set(f);O.add(S),p.push(...iL(b,t+1,n,i,r,o,u,d,O))}}return p}function BK({contextKey:e,files:t,theaterId:n,selectedPath:i,onSelect:r}){const[o,u]=y.useState(null),[d,f]=y.useState(null),[p,m]=y.useState(""),[_,b]=y.useState(new Set),[S,w]=y.useState(new Set),[x,k]=y.useState(new Map),[O,P]=y.useState(""),[F,T]=y.useState(0),[L,M]=y.useState(600),[z,U]=y.useState(()=>PK()),Z=y.useRef(null),Q=y.useRef(_);Q.current=_;const G=y.useRef(p);G.current=p;const B=y.useRef(t);B.current=t;const R=y.useRef(e);R.current=e;const D=y.useRef(x);D.current=x;const N=y.useRef(0),E=!!O;y.useEffect(()=>{n&&(u(null),f(null),m(""),b(new Set),k(new Map),P(""),T(0))},[e,n]),y.useEffect(()=>{if(!n)return;const ke=e;t.listFolder(p||void 0).then(Le=>{Ws(ke,R.current)&&(u(Le),f(null))}).catch(Le=>{Ws(ke,R.current)&&f(Le instanceof Error?Le.message:"Unable to load folder")})},[e,n,p,t]),y.useEffect(()=>{const ke=++N.current;if(!E||!o)return;let Le=!0;const Ae=e,Me=()=>Le&&ke===N.current&&Ws(Ae,R.current);return IK({entries:o.entries,cachedResults:D.current,files:t,showHidden:z,isCurrent:Me,onFolderResult:(et,dt)=>{Me()&&k(Je=>new Map(Je).set(et,dt))}}),()=>{Le=!1}},[e,t,E,o,z]),y.useEffect(()=>{const ke=Z.current;if(!ke)return;const Le=new ResizeObserver(()=>M(ke.clientHeight));return Le.observe(ke),M(ke.clientHeight),()=>Le.disconnect()},[]),y.useEffect(()=>{if(!n)return;let ke=!0;const Le=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,Ae=new EventSource(Le),Me=()=>{const dt=e;B.current.listFolder(G.current||void 0).then(Je=>{Ws(dt,R.current)&&(u(Je),f(null))}).catch(()=>{})},et=()=>{Me();for(const dt of Q.current){const Je=e;B.current.listFolder(dt).then(oe=>{Ws(Je,R.current)&&k(qe=>new Map(qe).set(dt,oe))}).catch(()=>{})}};return Ae.addEventListener("change",dt=>{let Je;try{Je=JSON.parse(dt.data)}catch{return}if(typeof Je=="string"&&((Je===""||Je===G.current)&&Me(),Je!==""&&Q.current.has(Je))){const oe=e;B.current.listFolder(Je).then(qe=>{Ws(oe,R.current)&&k(Ye=>new Map(Ye).set(Je,qe))}).catch(()=>{})}}),Ae.onopen=()=>{if(ke){ke=!1;return}et()},()=>{Ae.close()}},[e,n,t]);const $=y.useCallback(ke=>{const Le=ke.relativePath,Ae=!_.has(Le);if(b(Me=>{const et=new Set(Me);return et.has(Le)?(et.delete(Le),et):(et.add(Le),et)}),Ae){const Me=e;w(et=>new Set(et).add(Le)),t.listFolder(Le).then(et=>{Ws(Me,R.current)&&(k(dt=>new Map(dt).set(Le,et)),w(dt=>{const Je=new Set(dt);return Je.delete(Le),Je}))}).catch(()=>{Ws(Me,R.current)&&w(et=>{const dt=new Set(et);return dt.delete(Le),dt})})}},[e,t,_]),j=y.useCallback(ke=>{ke.kind==="dir"?$(ke):r(ke)},[$,r]),q=y.useCallback(ke=>{T(ke.currentTarget.scrollTop)},[]),H=y.useCallback(()=>{U(ke=>{const Le=!ke;try{localStorage.setItem(nL,Le?"1":"0")}catch{}return Le})},[]),A=y.useCallback(()=>{if(!n)return;const ke=e;t.listFolder(p||void 0).then(Le=>{Ws(ke,R.current)&&(u(Le),f(null))}).catch(Le=>{Ws(ke,R.current)&&f(Le instanceof Error?Le.message:"Unable to load folder")});for(const Le of _)t.listFolder(Le).then(Ae=>{Ws(ke,R.current)&&k(Me=>new Map(Me).set(Le,Ae))}).catch(()=>{})},[e,t,p,_,n]),Y=O.toLowerCase(),J=y.useMemo(()=>o?iL(o.entries,0,i,_,S,x,Y,z):[],[o,i,_,S,x,Y,z]),he=!z&&o!==null&&o.entries.length>0&&J.length===0&&!O,de=J.length>DK,ae=de?Math.max(0,Math.floor(F/ff)-SE):0,we=de?Math.min(J.length,Math.ceil((F+L)/ff)+SE):J.length,je=J.slice(ae,we),De=J.length*ff,We=ae*ff;return n?d&&!o?c.jsx("div",{className:"fexp-tree-error",children:d}):o?c.jsxs("div",{className:"fexp-tree-container",children:[c.jsxs("div",{className:"fexp-filter",children:[c.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:O,onChange:ke=>P(ke.target.value),"aria-label":"Filter files"}),O&&c.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>P(""),"aria-label":"Clear filter",children:"✕"}),c.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:A,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),c.jsx("button",{type:"button",className:`fexp-hidden-toggle${z?" is-active":""}`,onClick:H,"aria-pressed":z,"aria-label":z?"Hide hidden files":"Show hidden files",title:z?"Hide hidden files":"Show hidden files",children:z?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),c.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),c.jsxs("div",{ref:Z,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:de?q:void 0,children:[!1,de?c.jsx("div",{style:{height:De,position:"relative"},children:c.jsx("div",{style:{transform:`translateY(${We}px)`},children:je.map(ke=>c.jsx(xE,{row:ke,onEntryClick:j},ke.entry.relativePath))})}):je.map(ke=>c.jsx(xE,{row:ke,onEntryClick:j},ke.entry.relativePath)),J.length===0&&O&&c.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),J.length===0&&!O&&o.entries.length===0&&c.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),he&&c.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):c.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):c.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function sL(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 u=t.get(o.relativePath);if(u&&!r.has(u.relativePath)){const d=new Set(r);if(d.add(u.relativePath),sL(u.entries,t,n,i,d))return!0}}}return!1}function $K(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function xE({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:u}=e,d=n.kind==="dir",f=i*16,p=y.useCallback(()=>t(n),[n,t]);return c.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${d?" is-dir":" is-file"}`,style:{paddingLeft:`${f+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":d?o:void 0,onClick:p,children:[c.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:d?c.jsx(jK,{name:n.name,open:o}):c.jsx(MK,{name:n.name})}),c.jsx("span",{className:"fexp-tree-name",children:n.name}),u&&c.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function PK(){try{return localStorage.getItem(nL)==="1"}catch{return!1}}function zK({name:e,sizeHint:t}){return c.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[c.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),c.jsx("p",{className:"fexp-bin-name",children:e}),t&&c.jsx("p",{className:"fexp-bin-meta",children:t}),c.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function HK(e,t){switch(t){case"typescript":case"javascript":return UK(e);case"json":return WK(e);case"python":return GK(e);case"css":case"scss":case"sass":case"less":return KK(e);case"html":case"xml":return VK(e);case"bash":case"shell":return YK(e);case"yaml":return XK(e);default:return[{kind:"text",value:e}]}}const FK=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 UK(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
222
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=Va(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Va(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*\(/);FK.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 WK(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=Va(e,n,'"','"'),u=e.slice(n+r).trimStart().startsWith(":");t.push({kind:u?"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 qK=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 GK(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
223
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Va(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*\(/);qK.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 KK(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
224
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Va(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 VK(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}=Va(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 YK(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
|
|
225
|
+
`,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=Va(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 XK(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
226
|
+
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Va(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 Va(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
|
|
227
|
+
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function ZK({content:e,lang:t,truncated:n}){const i=y.useMemo(()=>JK(e,t),[e,t]);return c.jsxs("div",{className:"fexp-code-wrap",children:[n&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{className:"fexp-code-scroll",children:c.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:c.jsx("tbody",{children:i.map((r,o)=>c.jsxs("tr",{className:"fexp-code-row",children:[c.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),c.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function JK(e,t){return e.split(`
|
|
228
|
+
`).map(i=>QK(i,t))}function QK(e,t){return t==="plaintext"||t==="markdown"?CE(e)||" ":HK(e,t).map(i=>{const r=CE(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function CE(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function eV({src:e,name:t}){return c.jsxs("div",{className:"fexp-img-wrap",children:[c.jsx("div",{className:"fexp-img-stage",children:c.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),c.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const tV=new Set([".png",".jpg",".jpeg",".webp",".gif"]),nV=new Set(["img.shields.io"]),iV=/^[a-z][a-z0-9+.-]*:/i;function kE(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||iV.test(n))return null;const i=rL(n);if(!i)return null;const r=aV(i);return r===null?null:oV(r,t)}function sV(e){const t=rL(e).toLowerCase();return[...tV].some(n=>t.endsWith(n))}function EE(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function rV(e){try{const t=new URL(e);return t.protocol==="https:"&&nV.has(t.hostname)}catch{return!1}}function rL(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function aV(e){try{return decodeURI(e)}catch{return null}}function oV(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}`,u=[];for(const d of o.split("/"))if(!(!d||d===".")){if(d===".."){if(u.length===0)return null;u.pop();continue}u.push(d)}return u.length>0?u.join("/"):null}function lV({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:r}){const o=y.useMemo(()=>{const _=Bs(e).html,b=new DOMParser().parseFromString(_,"text/html");return pv(b.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i}),b.body.innerHTML},[e,n,i]),u=y.useRef(null);y.useEffect(()=>{const _=u.current;if(!_)return;Zp(_),pv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i});const b=new MutationObserver(()=>pv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i}));return b.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>b.disconnect()},[o,n,i]);const d=y.useCallback(_=>{const b=_.target.closest('[data-action="copy-code"]');if(!b)return;const S=b.closest("pre")?.getAttribute("data-code");if(!S)return;navigator.clipboard?.writeText(S);const w=b.textContent;b.textContent="Copied",window.setTimeout(()=>{b.textContent=w},1200)},[]),f=y.useCallback(_=>{const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),p=y.useCallback(_=>{if(_.key!=="Enter"&&_.key!==" ")return;const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),m=y.useCallback(_=>{d(_),f(_)},[d,f]);return c.jsxs("div",{className:"fexp-md-wrap",children:[r&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{ref:u,className:"markdown-body",onClick:m,onKeyDown:p,dangerouslySetInnerHTML:{__html:o}})]})}function pv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=kE(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===EE(t.theaterId,r)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&rV(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=kE(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&sV(o)){n.setAttribute("src",EE(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&cV(n)}}function cV(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 uV=360,m1=248,g1=200,wp=160,xp=4;function hV(e){return e-g1-xp>=wp}function dV(e,t,n){const i=n-g1-xp;return i<wp?e:Math.max(wp,Math.min(i,e-t))}function fV(e){const t=g1+xp;return`minmax(0, 1fr) ${xp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function pV(e){return e?uV:null}const aL="fleet-console.file-explorer.treePaneWidth",_1={selectedPath:null,viewState:{kind:"none"}},mV={..._1,treePaneWidth:m1},oL=new Map,TE=new Map,xb=new Set;let Cp=bV();function gV(e){return y.useSyncExternalStore(yV,()=>vV(e),()=>mV)}function AE(e,t){e&&uL(e,{selectedPath:t})}function Ma(e,t){e&&uL(e,{viewState:t})}function _V(e){Cp=hL(e);try{localStorage.setItem(aL,String(Cp))}catch{}lL()}function lL(){for(const e of xb)e()}function cL(e){return oL.get(e)??_1}function vV(e){const t=e??"__none__",n=e!=null?cL(e):_1,i=TE.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===Cp)return i;const r={...n,treePaneWidth:Cp};return TE.set(t,r),r}function uL(e,t){oL.set(e,{...cL(e),...t}),lL()}function yV(e){return xb.add(e),()=>{xb.delete(e)}}function bV(){try{return hL(Number(localStorage.getItem(aL)))}catch{return m1}}function hL(e){return!Number.isFinite(e)||e<=0?m1:Math.max(wp,Math.round(e))}const SV=new Set([".png",".jpg",".jpeg",".webp",".gif"]),wV={id:"file-explorer",title:"Files",icon:kV,render:e=>c.jsx(CV,{...e})};function xV(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const n=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!n.ok){const i=await n.json();throw new Error(i.error??"list_failed")}return n.json()}}}function CV(e){const{theaterId:t}=e,n=t??"",{selectedPath:i,viewState:r,treePaneWidth:o}=gV(n),u=y.useRef(o);u.current=o;const d=y.useRef(null),[f,p]=y.useState(!1),m=y.useMemo(()=>xV(t),[t]),_=y.useCallback(async(k,O)=>{if(!t){Ma(t,{kind:"error",message:"no_theater"});return}AE(n,k);const P=O??k.split("/").filter(Boolean).at(-1)??k,F=P.slice(P.lastIndexOf(".")).toLowerCase();if(SV.has(F)){const T=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(k)}`:"";Ma(n,{kind:"image",relativePath:k,name:P,src:T});return}Ma(n,{kind:"loading"});try{const T=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:k})});if(!T.ok){const M=await T.json();throw new Error(M.error??"read_failed")}const L=await T.json();if(L.binary){Ma(n,{kind:"binary",name:P});return}Ma(n,{kind:"code",relativePath:L.relativePath,content:L.content,lang:L.lang,truncated:L.truncated})}catch(T){const L=T instanceof Error?T.message:"Unable to load file";L==="binary_file"?Ma(n,{kind:"binary",name:P}):Ma(n,{kind:"error",message:L})}},[n,t]),b=y.useCallback(async k=>{k.kind==="file"&&await _(k.relativePath,k.name)},[_]),S=y.useCallback(()=>{Ma(n,{kind:"none"}),AE(n,null)},[n]),w=y.useCallback(k=>{k.preventDefault();const O=d.current;if(!O)return;const P=O.getBoundingClientRect().width;if(!hV(P))return;const F=k.clientX,T=u.current;p(!0);const L=z=>{const U=z.clientX-F,Z=dV(T,U,P);u.current=Z,_V(Z)},M=()=>{document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",M),p(!1)};document.addEventListener("pointermove",L),document.addEventListener("pointerup",M)},[]),x=r.kind!=="none";return y.useLayoutEffect(()=>{e.requestExtraWidth?.(pV(x))},[e,x]),c.jsxs("div",{ref:d,className:`fexp-root${x?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:x?{gridTemplateColumns:fV(o)}:void 0,children:[x&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fexp-viewer-pane",children:[c.jsxs("div",{className:"fexp-viewer-head",children:[c.jsx("span",{className:"fexp-viewer-filename",children:r.kind!=="loading"&&r.kind!=="error"?"relativePath"in r?r.relativePath:r.name:""}),c.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),c.jsxs("div",{className:"fexp-viewer-body",children:[r.kind==="loading"&&c.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),r.kind==="error"&&c.jsx("div",{className:"fexp-viewer-error",children:r.message}),r.kind==="code"&&r.lang==="markdown"&&c.jsx(lV,{content:r.content,onOpenPath:_,relativePath:r.relativePath,theaterId:t,truncated:r.truncated}),r.kind==="code"&&r.lang!=="markdown"&&c.jsx(ZK,{content:r.content,lang:r.lang,truncated:r.truncated}),r.kind==="image"&&c.jsx(eV,{src:r.src,name:r.name}),r.kind==="binary"&&c.jsx(zK,{name:r.name})]})]}),c.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),c.jsx("div",{className:"fexp-tree-pane",children:c.jsx(BK,{files:m,theaterId:t,contextKey:n,selectedPath:i,onSelect:b},n)})]})}function kV(){return c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:c.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 EV={id:"file-explorer",railPanels:[wV]},TV=[EV],AV={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function RV(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 dL({files:e,selectedPath:t,onSelect:n}){const i=RV(e);return c.jsx(fL,{node:i,depth:0,selectedPath:t,onSelect:n})}function fL({node:e,depth:t,selectedPath:n,onSelect:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx(NV,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>c.jsx(LV,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function NV({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,u]=y.useState(!1),d=y.useCallback(()=>u(_=>!_),[]);let f=e,p=t;for(;Object.keys(p.dirs).length===1&&p.files.length===0;){const _=Object.keys(p.dirs)[0];f+="/"+_,p=p.dirs[_]}const m=n*16+12;return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`},onClick:d,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.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"})}),c.jsx("span",{className:"repository-folder-name",children:f})]}),!o&&c.jsx(fL,{node:p,depth:n+1,selectedPath:i,onSelect:r})]})}function LV({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=y.useCallback(()=>i(e),[e,i]),u=t*16+12,d=e.path.split("/").pop()??e.path;return c.jsxs("button",{type:"button",className:`repository-file-row${r?" is-cur":""}`,style:{paddingLeft:`${u}px`},title:e.path,onClick:o,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:AV[e.status]??e.status}),c.jsx("span",{className:"repository-file-name",children:c.jsx("span",{className:"repository-file-fn",children:d})}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const RE="fleet-console.diff.changesCollapsed",MV={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function jV(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function OV(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function pL({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[u,d]=y.useState(()=>OV(RE)),f=y.useCallback(()=>{d(_=>{const b=!_;try{localStorage.setItem(RE,b?"1":"0")}catch{}return b})},[]),p=y.useMemo(()=>e.kind==="ok"?jV(e.files,o):[],[o,e]);if(e.kind==="loading")return c.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const _=e.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=e.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return c.jsxs("div",{className:"repository-sections-notice",children:[c.jsx("strong",{className:"repository-notice-title",children:_}),c.jsx("span",{className:"repository-notice-body",children:b}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]})}if(e.kind==="error")return c.jsxs("div",{className:"repository-sections-error",children:[c.jsx("span",{children:e.message}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]});const m=o?`${p.length}/${e.files.length}`:String(e.files.length);return c.jsx("div",{className:"repository-sections",children:c.jsxs("div",{className:`repository-section${u?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-section-head",onClick:f,children:[c.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-section-name",children:"Changes"}),c.jsx("span",{className:"repository-count-badge",children:m})]}),!u&&c.jsx("div",{className:"repository-section-rows",children:p.length===0?c.jsx("div",{className:"repository-empty-row",children:o?"No matching items":"No changes"}):n==="tree"?c.jsx(dL,{files:p,selectedPath:i,onSelect:r}):p.map(_=>c.jsx(mL,{entry:_,isSelected:_.path===i,onSelect:r},_.path))})]})})}function mL({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("/"),u=o>=0?r.slice(0,o+1):"",d=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return c.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":MV[e.status]??e.status,children:e.status}),c.jsxs("span",{className:"repository-file-name",children:[c.jsx("span",{className:"repository-file-fn",children:d}),u&&c.jsx("span",{className:"repository-file-dir",children:u})]}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const DV=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 IV(e){let t="",n=0;const i=(r,o)=>`<span class="repository-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,u=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(u,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 u=e.slice(o,n);t+=DV.has(u)?i("keyword",u):/^[A-Z]/.test(u)?i("type",u):u;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const BV=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,$V=/^diff --git a\/(.+) b\/(.+)$/;function PV(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 u of t)if(!u.startsWith("\\")){if(u.startsWith("diff --git ")){const d=$V.exec(u),f=d?.[1],p=d?.[2]??u,m=f!==void 0&&f!==p?f:void 0;n.push({kind:"file-label",text:p,oldPath:m}),o=!0;continue}if(o){if(u.startsWith("new file mode")||u.startsWith("deleted file mode")||u.startsWith("old mode")||u.startsWith("new mode")||u.startsWith("rename from ")||u.startsWith("rename to ")||u.startsWith("similarity index")||u.startsWith("dissimilarity index")){n.push({kind:"meta",text:u});continue}if(u.startsWith("index ")||u.startsWith("--- ")||u.startsWith("+++ "))continue;if(!u.startsWith("@@")){u!==""&&n.push({kind:"ctx",text:` ${u}`});continue}}if(u.startsWith("@@")){o=!1;const d=BV.exec(u);if(d){i=parseInt(d[1]??"0",10),r=parseInt(d[2]??"0",10);const f=d[3]?.trimEnd()??"",p=`@@ -${d[1]??""} +${d[2]??""} @@${f?` ${f.trimStart()}`:""}`;n.push({kind:"hunk-label",text:p})}else n.push({kind:"hunk-label",text:u});continue}u.startsWith("+")?n.push({kind:"add",text:u,newLine:r++}):u.startsWith("-")?n.push({kind:"del",text:u,oldLine:i++}):n.push({kind:"ctx",text:u,oldLine:i++,newLine:r++})}return n}function pf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function v1({ctx:e,repoRel:t,file:n,mode:i,commit:r,compare:o}){const[u,d]=y.useState({kind:"loading"});if(y.useEffect(()=>{if(!e.theaterId){d({kind:"error",message:"no_theater"});return}let _=!1;return d({kind:"loading"}),o?e.api.fetch("repository","compare-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:o.theaterId,repoRel:o.repoRel,base:o.base,head:o.head,filePath:n.path,...n.oldPath?{oldPath:n.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||d({kind:"ok",result:S})}).catch(b=>{_||d({kind:"error",message:b instanceof Error?b.message:"unknown"})}):r?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,repoRel:r.repoRel,ref:r.fullHash,filePath:n.path,...n.oldPath??r.oldPath?{oldPath:n.oldPath??r.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||d({kind:"ok",result:S})}).catch(b=>{_||d({kind:"error",message:b instanceof Error?b.message:"unknown"})}):e.api.fetch("repository","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,filePath:n.path,mode:i})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||d({kind:"ok",result:S})}).catch(b=>{_||d({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,r,o,t]),u.kind==="loading")return c.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(u.kind==="error")return c.jsx("div",{className:"repository-hunk-error",children:u.message});const{result:f}=u,m=PV(f.content).filter(_=>_.kind!=="file-label");return c.jsxs("div",{className:"repository-hunk-wrap",children:[f.truncated&&c.jsx("div",{className:"repository-truncated-badge",children:"Diff truncated"}),c.jsx("div",{className:"repository-hunk-scroll",children:c.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:c.jsx("tbody",{children:m.map((_,b)=>c.jsx("tr",{className:`repository-line repository-line-${_.kind}`,children:_.kind==="hunk-label"?c.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:pf(_.text)}}):_.kind==="meta"?c.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:pf(_.text)}}):_.kind==="file-label"?c.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:pf(_.text)}}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"repository-gutter repository-gutter-old",children:_.oldLine??""}),c.jsx("td",{className:"repository-gutter repository-gutter-new",children:_.newLine??""}),c.jsx("td",{className:"repository-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),c.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:IV(pf(_.text.length>0?_.text.slice(1):_.text))}})]})},b))})})})]})}const y1=140,gL=120,_L=160,yr=4,vL=null;function yL({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const u=n-r-o;return u<i?vL:Math.max(i,Math.min(u,e-t))}function bL(e){const t=y1+yr;return`minmax(0, 1fr) ${yr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function zV(e){const t=_L+yr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${yr}px minmax(0, 1fr)`}function SL(e,t,n,i,r,o=yr){const u=n-r-o;return u<i?vL:Math.max(i,Math.min(u,e+t))}function HV(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${yr}px minmax(120px, 1fr)`}function FV(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${yr}px minmax(140px, 1fr)`}function b1({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),t.removeEventListener("blur",u)},u=()=>{r&&(r=!1,o(),i())},d=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),t.addEventListener("blur",u),d}const UV="fleet-console.repository.compare.",WV=248,qV=220;function wL(e,t){return`${UV}${e}.${t}`}function GV(e,t){try{const n=localStorage.getItem(wL(e,t));if(!n)return null;const i=JSON.parse(n);return typeof i!="object"||i===null?null:{base:typeof i.base=="string"?i.base:"",head:typeof i.head=="string"?i.head:""}}catch{return null}}function KV(e,t,n,i){try{localStorage.setItem(wL(e,t),JSON.stringify({base:n,head:i}))}catch{}}function VV({ctx:e,repoRel:t,refs:n,refsError:i=!1,onRetryRefs:r,onFileOpenChange:o}){const[u,d]=y.useState(""),[f,p]=y.useState(""),[m,_]=y.useState({kind:"idle"}),[b,S]=y.useState(null),[w,x]=y.useState(WV),[k,O]=y.useState(!1),P=y.useRef(w),F=y.useRef(null),T=y.useRef(null),L=y.useRef(!1),M=y.useRef(0),z=y.useMemo(()=>n.remotes.filter(H=>!x1(H.ref)),[n.remotes]),U=n.branches.find(H=>H.current)??null,Z=U===null,Q=y.useCallback(H=>H==="HEAD"?Z:n.branches.some(A=>A.ref===H)||z.some(A=>A.ref===H)||n.tags.some(A=>A.ref===H),[n.branches,n.tags,z,Z]);y.useEffect(()=>{const H=n.branches.length>0||z.length>0||n.tags.length>0,A=U?.ref??"HEAD";if(!L.current){if(!H||!e.theaterId)return;L.current=!0;const Y=GV(e.theaterId,t);d(Y&&Q(Y.base)?Y.base:""),p(Y&&Q(Y.head)?Y.head:A);return}d(Y=>Y&&!Q(Y)?"":Y),p(Y=>Y&&!Q(Y)?A:Y)},[e.theaterId,U,Q,n.branches.length,n.tags.length,z.length,t]),y.useEffect(()=>{o?.(b!==null)},[o,b]),y.useEffect(()=>()=>T.current?.(),[]);const G=y.useCallback((H,A)=>{const Y=H==="base"?A:u,J=H==="head"?A:f;H==="base"?d(A):p(A),e.theaterId&&KV(e.theaterId,t,Y,J)},[u,e.theaterId,f,t]),B=y.useCallback(()=>{if(!e.theaterId||!u||!f||u===f)return;const H=++M.current;S(null),_({kind:"loading"}),fetch("/plugins/repository/compare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,base:u,head:f})}).then(async A=>{if(H!==M.current)return;if(!A.ok){const J=await A.json();if(H!==M.current)return;const he=J.error??"git_failed";_(he==="no_git_repo"||he==="git_unavailable"?{kind:"notice",reason:he}:{kind:"error",message:he});return}const Y=await A.json();H===M.current&&_({kind:"ok",base:u,head:f,files:Y.files,...Y.mergeBase?{mergeBase:Y.mergeBase}:{},...Y.truncated?{truncated:!0}:{}})}).catch(A=>{H===M.current&&_({kind:"error",message:A instanceof Error?A.message:"unknown"})})},[u,e.theaterId,f,t]),R=y.useCallback(H=>{H.preventDefault();const A=F.current;if(!A)return;const Y=A.getBoundingClientRect().width,J=H.clientX,he=P.current;T.current?.(),O(!0),T.current=b1({documentTarget:document,windowTarget:window,onMove:de=>{const we=yL({startWidth:he,dx:de.clientX-J,containerWidth:Y,listPaneMinWidth:qV,hunkPaneMinWidth:y1,dividerWidth:yr});we!==null&&(P.current=we,x(we))},onFinish:()=>{O(!1),T.current=null}})},[]),D=H=>H.map(A=>c.jsx("option",{value:A.ref,children:A.label},A.ref)),N=(H,A)=>c.jsxs("select",{className:"repository-compare-select","aria-label":H==="base"?"Base ref":"Head ref",value:A,onChange:Y=>G(H,Y.target.value),children:[H==="base"&&c.jsx("option",{value:"",disabled:!0,children:"Select base…"}),Z&&c.jsx("option",{value:"HEAD",children:"HEAD"}),n.branches.length>0&&c.jsx("optgroup",{label:"LOCAL",children:D(n.branches)}),z.length>0&&c.jsx("optgroup",{label:"REMOTES",children:D(z)}),n.tags.length>0&&c.jsx("optgroup",{label:"TAGS",children:D(n.tags)})]}),E=u!==""&&f!==""&&u!==f,$=m.kind==="ok"?m.base:null,j=m.kind==="ok"?m.head:null,q=y.useMemo(()=>$&&j&&e.theaterId?{base:$,head:j,theaterId:e.theaterId,repoRel:t}:null,[$,j,e.theaterId,t]);return c.jsxs("div",{className:"repository-compare",children:[i?c.jsxs("div",{className:"history-error",children:["Unable to load refs",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:r,children:"Retry"})]}):c.jsxs("div",{className:"repository-compare-controls",children:[N("base",u),c.jsx("span",{className:"repository-compare-arrow","aria-hidden":"true",children:"…"}),N("head",f),c.jsx("button",{type:"button",className:"repository-refresh-btn repository-compare-run",disabled:!E,onClick:B,children:"Compare"})]}),c.jsxs("div",{ref:F,className:`repository-root${b?" has-hunk":""}${k?" is-dragging":""}`,style:b?{gridTemplateColumns:bL(w)}:void 0,children:[b&&q?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:b.path}),c.jsx("button",{type:"button",onClick:()=>S(null),children:"✕"})]}),c.jsx(v1,{ctx:e,repoRel:t,file:b,mode:"unified",compare:q})]}):null,b?c.jsx("div",{className:"repository-divider",onPointerDown:R,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane repository-compare-results",children:[m.kind==="idle"&&c.jsx("div",{className:"history-empty",children:"Select base and head refs, then run Compare."}),m.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Comparing…"}),m.kind==="ok"&&m.files.length===0&&c.jsx("div",{className:"history-empty",children:"No differences between the selected refs."}),m.kind==="error"&&m.message==="no_merge_base"&&c.jsx("div",{className:"history-empty",children:"The selected refs share no common history."}),(m.kind==="notice"||m.kind==="error"&&m.message!=="no_merge_base"||m.kind==="ok"&&m.files.length>0)&&c.jsxs(c.Fragment,{children:[m.kind==="ok"&&m.mergeBase&&c.jsxs("div",{className:"repository-compare-meta",children:["merge-base ",c.jsx("span",{children:m.mergeBase})]}),c.jsx(pL,{state:m.kind==="ok"?{kind:"ok",files:m.files}:m,onRetry:B,viewMode:"list",selectedPath:b?.path??null,onSelect:S,filterText:""}),m.kind==="ok"&&m.truncated&&c.jsx("div",{className:"history-truncated",children:"Comparison capped — file list truncated."})]})]})]})]})}function xL(){return Object.create(null)}function NE(){return{dirs:xL(),repos:[]}}function YV(e){const t=NE();for(const n of e){const i=n.relPath.replaceAll("\\","/").split("/").filter(o=>o.length>0);if(i.length===0)continue;i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]=NE()),r=r.dirs[o];r.repos.push(n)}return CL(t),t}function CL(e){e.repos.sort((n,i)=>n.name.localeCompare(i.name));const t=Object.entries(e.dirs).sort(([n],[i])=>n.localeCompare(i));e.dirs=xL();for(const[n,i]of t)CL(i),e.dirs[n]=i}function XV(e,t){let n=e,i=t;for(;Object.keys(i.dirs).length===1&&i.repos.length===0;){const r=Object.keys(i.dirs)[0];n+="/"+r,i=i.dirs[r]}return{label:n,node:i}}function kL(e){let t=e.repos.length;for(const n of Object.values(e.dirs))t+=kL(n);return t}const Cb=new Set;let S1={file:null};function EL(){for(const e of Cb)e()}function ZV(e){return Cb.add(e),()=>{Cb.delete(e)}}function LE(){return S1}function JV(e,t){const n=y.useSyncExternalStore(ZV,LE,LE);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function QV(e,t,n){S1={file:{entry:e,theaterId:t,repoRel:n}},EL()}function mv(){S1={file:null},EL()}const kb=12,jl=28,gv=3,eY=5,ME=["var(--id-cerulean)","var(--id-plum)","var(--id-amber)","var(--id-teal)","var(--id-moss)","var(--id-indigo)","var(--id-rose)","var(--id-crimson)"];function Ou(e){return e*kb+6}function wo(e){return ME[e%ME.length]??"var(--ink-fog)"}function tY({node:e,laneCount:t,collapsed:n=!1}){const i=Math.max(t,1),r=n?10:0,o=i*kb+r,u=Ou(e.lane),d=jl/2;return c.jsxs("svg",{width:o,height:jl,viewBox:`0 0 ${o} ${jl}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(f=>c.jsx("line",{x1:Ou(f),y1:0,x2:Ou(f),y2:jl,stroke:wo(f),strokeWidth:1.5},`pt-${f}`)),e.connectAbove&&c.jsx("line",{x1:u,y1:0,x2:u,y2:d-gv,stroke:wo(e.lane),strokeWidth:1.5}),e.connectBelow&&c.jsx("line",{x1:u,y1:d+gv,x2:u,y2:jl,stroke:wo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(f=>c.jsx("line",{x1:Ou(f),y1:0,x2:u,y2:d,stroke:wo(f),strokeWidth:1.5,strokeLinecap:"round"},`mf-${f}`)),e.branchToLanes.map(f=>c.jsx("line",{x1:u,y1:d,x2:Ou(f),y2:jl,stroke:wo(f),strokeWidth:1.5,strokeLinecap:"round"},`bt-${f}`)),e.isHead&&c.jsx("circle",{cx:u,cy:d,r:eY,fill:"none",stroke:wo(e.lane),strokeWidth:1.5}),c.jsx("circle",{cx:u,cy:d,r:gv,fill:wo(e.lane)}),n&&c.jsx("text",{x:i*kb+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const _v=8;function nY(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 u=e[o],d=u.fullHash,f=[...u.parents],p=[];for(let x=0;x<t.length;x++)t[x]===d&&p.push(x);let m,_=!1;const b=[];if(p.length===0){const x=t.indexOf(null);x>=0?m=x:t.length<_v?(m=t.length,t.push(null)):(i=!0,m=_v-1,t[m]=null,_=!0)}else{m=Math.min(...p);for(const x of p)x!==m&&(b.push(x),t[x]=null)}const S=[];if(f.length===0)t[m]=null;else{t[m]=_?null:f[0]??null;for(const x of f.slice(1))if(!(t.indexOf(x)>=0)){const O=t.indexOf(null);if(O>=0)t[O]=x,S.push(O);else if(t.length<_v){const P=t.length;t.push(x),S.push(P)}else i=!0}}const w=t.map((x,k)=>({h:x,i:k})).filter(({h:x,i:k})=>x!==null&&k!==m).map(({i:x})=>x);r=Math.max(r,m,...S,...w),n.push({lane:m,isHead:u.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:p.length>0,connectBelow:f.length>0&&t[m]===f[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function TL(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(),u=Math.round((r-o)/864e5);return u===0?`Today ${i}`:u===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function w1(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 AL="fleet-console.history.logHeight",jE="fleet-console.history.headerHeight",OE="fleet-console.history.fileListWidth",RL="fleet-console.history.filesView",iY=240,sY=214,rY=180;function aY(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function oY(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))||w1(i).some(r=>r.label.toLowerCase().includes(n))):e}function lY(e){return e==="Escape"}function cY(e){return e.reduce((t,n)=>({files:t.files+1,additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{files:0,additions:0,deletions:0})}function uY(e,t,n){return e.files>0&&!t&&!n}function DE({current:e}){return e?c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.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 hY({entry:e,checkouts:t,selected:n,graphNode:i,laneCount:r,layoutCollapsed:o,onSelect:u}){const d=w1(e),f=aY(e,t);return c.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>u(e),children:[c.jsx("span",{className:"history-commit-subject",children:e.subject}),c.jsx("span",{className:"history-commit-sha",children:e.shortHash}),c.jsx("span",{className:"history-commit-time",children:TL(e.authorAt)}),c.jsxs("span",{className:"history-commit-badges",children:[d.map(p=>{const m=p.kind==="branch"?t.find(_=>_.branch===p.label):null;return c.jsxs("span",{className:`history-badge history-badge--${p.kind}`,children:[m&&c.jsx(DE,{current:m.isCurrent}),p.label]},`${p.kind}:${p.label}`)}),f&&c.jsxs("span",{className:"history-badge history-badge--worktree",children:[c.jsx(DE,{current:f.isCurrent}),"detached"]})]}),c.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:c.jsx(tY,{node:i,laneCount:r,collapsed:o})})]})}function dY({ctx:e,repoRel:t,target:n,onSelectCommit:i,onClose:r}){const[o,u]=y.useState({kind:"loading"}),[d,f]=y.useState("details"),[p,m]=y.useState(null),[_,b]=y.useState(!1),[S,w]=y.useState(()=>Eb(jE,sY)),[x,k]=y.useState(()=>Eb(OE,rY)),[O,P]=y.useState(_Y),F=y.useRef(null),T=y.useRef(null),L=y.useRef(null),M=y.useRef(S),z=y.useRef(x),U=y.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);y.useEffect(()=>{let G=!1;return u({kind:"loading"}),e.api.fetch("repository","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,ref:n.fullHash})}).then(async B=>{if(!B.ok)throw new Error((await B.json()).error??"git_failed");return B.json()}).then(B=>{G||(u({kind:"ok",result:B}),m(B.files[0]?.path??null))}).catch(B=>{G||u({kind:"error",message:B instanceof Error?B.message:"unknown"})}),()=>{G=!0}},[e.api,e.theaterId,t,n.fullHash]),y.useEffect(()=>()=>L.current?.(),[]);const Z=y.useCallback((G,B)=>{G.preventDefault();const R=B==="y"?F.current:T.current;if(!R)return;const D=B==="y"?M.current:z.current,N=B==="y"?G.clientY:G.clientX,E=B==="y"?R.getBoundingClientRect().height:R.getBoundingClientRect().width;L.current?.(),L.current=b1({documentTarget:document,windowTarget:window,onMove:$=>{const j=$,q=SL(D,(B==="y"?j.clientY:j.clientX)-N,E,120,120);q!==null&&(B==="y"?(M.current=q,w(q)):(z.current=q,k(q)))},onFinish:()=>{const $=B==="y"?M.current:z.current;try{localStorage.setItem(B==="y"?jE:OE,String($))}catch{}L.current=null}})},[]),Q=o.kind==="loading"?c.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):o.kind==="error"?c.jsx("div",{className:"history-inspector-empty history-inspector-error",children:o.message}):(()=>{const{meta:G,files:B}=o.result,R=B.find(H=>H.path===p)??B[0]??null,D=B.reduce((H,A)=>H+A.additions,0),N=B.reduce((H,A)=>H+A.deletions,0),E=n.entry,$=(H,A)=>{m(H.path),A&&f("changes")},j=H=>{P(H);try{localStorage.setItem(RL,H)}catch{}},q=()=>{const H=navigator.clipboard?.writeText(n.fullHash);H&&H.then(()=>{b(!0),window.setTimeout(()=>b(!1),1200)}).catch(()=>{})};return d==="details"?c.jsxs("div",{ref:F,className:"history-details-tab",style:{gridTemplateRows:HV(S)},children:[c.jsx(fY,{meta:G,entry:E,fullHash:n.fullHash,copied:_,onCopy:q,onParent:H=>i({fullHash:H})}),c.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:H=>Z(H,"y")}),c.jsx(IE,{files:B,selectedPath:p,additions:D,deletions:N,viewMode:O,onViewMode:j,onSelect:H=>$(H,!0)})]}):c.jsx("div",{className:"history-changes-tab",children:c.jsxs("div",{ref:T,className:"history-changes-columns",style:{gridTemplateColumns:FV(x)},children:[c.jsx(IE,{files:B,selectedPath:p,additions:D,deletions:N,viewMode:O,onViewMode:j,onSelect:H=>$(H,!1)}),c.jsx("div",{className:"history-divider",onPointerDown:H=>Z(H,"x")}),R?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:R.path,children:R.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":"Previous file",disabled:B.indexOf(R)===0,onClick:()=>$(B[B.indexOf(R)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":"Next file",disabled:B.indexOf(R)===B.length-1,onClick:()=>$(B[B.indexOf(R)+1],!1),children:"›"})]})]}),c.jsx(v1,{ctx:e,repoRel:t,file:R,mode:"unified",commit:U})]}):c.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return c.jsxs("div",{className:"history-inspector",onKeyDown:G=>{lY(G.key)&&(G.preventDefault(),r())},children:[c.jsxs("div",{className:"history-segmented",children:[c.jsx("button",{type:"button","aria-pressed":d==="details",onClick:()=>f("details"),children:"Details"}),c.jsxs("button",{type:"button","aria-pressed":d==="changes",onClick:()=>f("changes"),children:["Changes ",o.kind==="ok"&&c.jsx("span",{children:o.result.files.length})]}),c.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:r,children:"✕"})]}),Q]})}function fY({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return c.jsxs("div",{className:"history-inspector-head",children:[c.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&c.jsx("pre",{className:"history-inspector-message",children:e.body}),c.jsxs("div",{className:"history-author",children:[c.jsx("span",{className:"history-avatar",children:vY(e.authorName)}),c.jsxs("span",{children:[c.jsx("b",{children:e.authorName}),c.jsx("small",{children:e.authorEmail})]}),c.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??TL(e.authorAt)})]}),c.jsxs("div",{className:"history-inspector-ids",children:[c.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,c.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(u=>c.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(u.full),children:["parent ",u.short]},u.full))]}),t&&c.jsx("div",{className:"history-ref-chips",children:w1(t).map(u=>c.jsx("span",{className:`history-badge history-badge--${u.kind}`,children:u.label},`${u.kind}:${u.label}`))})]})}function IE({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:u}){return c.jsxs("section",{className:"history-commit-files",children:[c.jsxs("div",{className:"history-files-title",children:[c.jsx("span",{className:"history-files-label",children:"Changed files"}),c.jsxs("span",{className:"history-files-stats",children:[e.length," ",c.jsxs("i",{children:["+",n]})," ",c.jsxs("em",{children:["−",i]})]}),c.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":r==="list",onClick:()=>o("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":r==="tree",onClick:()=>o("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx("div",{className:"history-files-scroll",children:r==="tree"?c.jsx(dL,{files:e,selectedPath:t,onSelect:u}):e.map(d=>c.jsx(mL,{entry:d,isSelected:d.path===t,onSelect:u},d.path))})]})}function pY({ctx:e,repoRel:t,active:n=!0,refFilter:i=null,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:d}){return c.jsx(mY,{ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:d},`${e.theaterId??""}:${t}`)}function mY({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:d}){const[f,p]=y.useState({kind:"loading"}),[m,_]=y.useState(null),[b,S]=y.useState(""),[w,x]=y.useState(0),[k,O]=y.useState(gY),[P,F]=y.useState(!1),T=y.useRef(null),L=y.useRef(null),M=y.useRef(k);y.useEffect(()=>{_(null)},[i]);const[z,U]=y.useState(n);y.useEffect(()=>{n&&U(!0)},[n]),y.useEffect(()=>{if(!z)return;if(!e.theaterId){p({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let D=!1;return p({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,...i?{ref:i}:{}})}).then(async N=>{if(!N.ok)throw new Error((await N.json()).error??"git_failed");return N.json()}).then(N=>{D||p({kind:"ok",commits:N.commits,checkouts:N.checkouts,truncated:N.truncated??!1})}).catch(N=>{D||p({kind:"error",message:N instanceof Error?N.message:"unknown"})}),()=>{D=!0}},[e.api,e.theaterId,z,w,i,t]),y.useEffect(()=>{o?.(n&&m!==null)},[n,o,m]),y.useEffect(()=>()=>L.current?.(),[]);const Z=y.useCallback(D=>{D.preventDefault();const N=T.current;if(!N)return;const E=M.current,$=D.clientY,j=N.getBoundingClientRect().height;L.current?.(),F(!0),L.current=b1({documentTarget:document,windowTarget:window,onMove:q=>{const H=SL(E,q.clientY-$,j,gL,_L,yr);H!==null&&(M.current=H,O(H))},onFinish:()=>{try{localStorage.setItem(AL,String(M.current))}catch{}F(!1),L.current=null}})},[]),Q=y.useMemo(()=>f.kind==="ok"?oY(f.commits,b):[],[b,f]),G=f.kind==="ok"?nY(Q):null,B=y.useMemo(()=>cY(r),[r]),R=uY(B,b,i);return c.jsxs("div",{ref:T,className:`history-root${P?" is-dragging":""}`,style:m?{gridTemplateRows:zV(k)}:void 0,children:[c.jsxs("div",{className:"history-list-pane",children:[c.jsxs("div",{className:"history-toolbar",children:[c.jsxs("div",{className:"history-filter",children:[c.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:b,onChange:D=>S(D.target.value)}),b&&c.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>S(""),children:"✕"})]}),i&&c.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:u,children:[i," ✕"]}),f.kind==="ok"&&c.jsx("span",{className:"history-count",children:b?`${Q.length}/${f.commits.length}`:f.commits.length})]}),c.jsxs("div",{className:"history-list",children:[R&&c.jsxs("button",{type:"button",className:"repository-wip-row",onClick:d,children:["Uncommitted changes ",c.jsxs("span",{children:[B.files," files · +",B.additions," −",B.deletions]})]}),f.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Loading…"}),f.kind==="error"&&c.jsxs("div",{className:"history-error",children:[f.message,c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>x(D=>D+1),children:"Retry"})]}),f.kind==="ok"&&f.commits.length===0&&c.jsx("div",{className:"history-empty",children:"No history"}),f.kind==="ok"&&f.commits.length>0&&Q.length===0&&c.jsx("div",{className:"history-empty",children:"No matching items"}),f.kind==="ok"&&G&&Q.map((D,N)=>c.jsx(hY,{entry:D,checkouts:f.checkouts,selected:m?.fullHash===D.fullHash,graphNode:G.nodes[N],laneCount:G.activeLaneCount,layoutCollapsed:G.collapsed,onSelect:E=>_({fullHash:E.fullHash,entry:E})},D.fullHash)),f.kind==="ok"&&(f.truncated||f.commits.length>=200)&&c.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),m&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":"Resize commit log",onPointerDown:Z}),c.jsx("div",{className:"history-detail-pane",children:c.jsx(dY,{ctx:e,repoRel:t,target:m,onSelectCommit:_,onClose:()=>_(null)})})]})]})}function gY(){return Eb(AL,iY,gL)}function _Y(){try{const e=localStorage.getItem(RL);if(e==="list"||e==="tree")return e}catch{}return"list"}function Eb(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function vY(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const NL="fleet-console.diff.viewMode",LL="fleet-console.diff.listPaneWidth",ML="fleet-console.repository.source",tm="fleet-console.repository.repo.",jL="fleet-console.repository.scanDepth",Tb=1,OL=8,yY=3,bY=400,SY=248,DL=220;function wY(){try{const e=localStorage.getItem(NL);if(e==="list"||e==="tree")return e}catch{}return"list"}function xY(){try{const e=localStorage.getItem(ML);if(e==="repositories"||e==="worktrees"||e==="changes"||e==="history"||e==="compare"||e==="branches"||e==="tags"||e==="stashes")return e}catch{}return"changes"}function CY(e){try{return localStorage.getItem(`${tm}${e}`)??""}catch{return""}}function kY(e,t,n){try{const i=`${tm}${e}`,r=localStorage.getItem(i);if(r===null)return"";if(t.some(o=>o.relPath===r)||n.some(o=>o.relPath===r))return r;localStorage.removeItem(i)}catch{}return""}function EY(){try{const e=Number.parseInt(localStorage.getItem(jL)??"",10);if(Number.isInteger(e)&&e>=Tb&&e<=OL)return e}catch{}return yY}function TY(e){try{localStorage.setItem(jL,String(e))}catch{}}function AY(e,t){try{localStorage.setItem(`${tm}${e}`,t)}catch{}}function RY(e){try{localStorage.removeItem(`${tm}${e}`)}catch{}}function NY(e){try{localStorage.setItem(ML,e)}catch{}}function LY(){try{const e=localStorage.getItem(LL),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(DL,t)}catch{}return SY}function MY(e){return e.entry.status==="U"?"untracked":"unified"}function jY({ctx:e}){return c.jsx(DY,{ctx:e},e.theaterId)}function x1(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function OY(e,t){const n=(i,r)=>i.map(o=>({key:o.ref,source:r,primary:o.label,ref:o.ref,current:o.current}));return e==="branches"?[{label:"LOCAL",rows:n(t.branches,"branches")},{label:"REMOTES",rows:n(t.remotes.filter(i=>!x1(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]}function DY({ctx:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!1),[o,u]=y.useState(0),[d,f]=y.useState(!1),[p,m]=y.useState(EY),_=y.useCallback(Ne=>{m(Ne),TY(Ne)},[]),[b,S]=y.useState(!1),[w,x]=y.useState([]),[k,O]=y.useState(!1),[P,F]=y.useState(0),[T,L]=y.useState(null),[M,z]=y.useState(()=>e.theaterId?CY(e.theaterId):""),U=y.useRef(M),[Z,Q]=y.useState(xY),[G,B]=y.useState(null),[R,D]=y.useState({branches:[],remotes:[],tags:[],stashes:[]}),[N,E]=y.useState(!1),[$,j]=y.useState(0),[q,H]=y.useState({kind:"loading"}),[A,Y]=y.useState(0),[J,he]=y.useState(!1),[de,ae]=y.useState(!1),[we,je]=y.useState(wY),[De,We]=y.useState(""),ke=JV(e.theaterId??null,M),[Le,Ae]=y.useState(LY),Me=y.useRef(Le),et=y.useRef(null),[dt,Je]=y.useState(!1),oe=y.useCallback(Ne=>{Q(Ne),NY(Ne)},[]),qe=y.useCallback((Ne,Ce)=>{e.theaterId&&(Ce&&AY(e.theaterId,Ne),mv(),B(null),We(""),he(!1),ae(!1),H({kind:"loading"}),D({branches:[],remotes:[],tags:[],stashes:[]}),U.current=Ne,z(Ne),oe("changes"))},[e.theaterId,oe]);y.useEffect(()=>{if(!e.theaterId)return;let Ne=!1;return r(!1),S(!1),e.api.fetch("repository","repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:p})}).then(Ce=>Ce.json()).then(Ce=>{Ne||(n(Ce.repos),f(Ce.truncated===!0),S(!0))}).catch(()=>{Ne||r(!0)}),()=>{Ne=!0}},[e.api,e.theaterId,o,p]),y.useEffect(()=>{if(!e.theaterId)return;let Ne=!1;const Ce=M;return x([]),O(!1),L(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:Ce})}).then(ut=>ut.json()).then(ut=>{Ne||(x(ut.worktrees),L(Ce))}).catch(ut=>{if(Ne)return;if((typeof ut=="object"&&ut!==null&&"status"in ut?ut.status:null)===400&&Ce!==""){RY(e.theaterId),qe("",!1);return}O(!0)}),()=>{Ne=!0}},[e.api,e.theaterId,M,qe,P]),y.useEffect(()=>{if(!e.theaterId||!b||T!==M)return;const Ne=kY(e.theaterId,t,w);Ne!==U.current&&qe(Ne,!1)},[e.theaterId,M,t,b,qe,w,T]),y.useEffect(()=>{if(!e.theaterId)return;let Ne=!1;return D({branches:[],remotes:[],tags:[],stashes:[]}),E(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:M})}).then(Ce=>Ce.ok?Ce.json():Promise.reject()).then(Ce=>{Ne||D(Ce)}).catch(()=>{Ne||E(!0)}),()=>{Ne=!0}},[e.api,e.theaterId,M,$]),y.useEffect(()=>{if(!e.theaterId){H({kind:"error",message:"no_theater"});return}let Ne=!1;return H({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:M})}).then(async Ce=>{if(!Ce.ok){const jt=(await Ce.json()).error??"git_failed";Ne||H(jt==="no_git_repo"||jt==="git_unavailable"?{kind:"notice",reason:jt}:{kind:"error",message:jt});return}const ut=await Ce.json();Ne||H({kind:"ok",files:ut.files})}).catch(Ce=>{Ne||H({kind:"error",message:Ce instanceof Error?Ce.message:"unknown"})}),()=>{Ne=!0}},[A,e.theaterId,M]),y.useLayoutEffect(()=>()=>mv(),[]);const Ye=y.useCallback(Ne=>{e.theaterId&&QV(Ne,e.theaterId,M)},[e.theaterId,M]),Mt=y.useCallback(Ne=>{if(!e.theaterId||Ne.relPath===M){oe("changes");return}qe(Ne.relPath,!0)},[e.theaterId,M,oe,qe]),Wt=y.useCallback(()=>mv(),[]),hn=y.useCallback(Ne=>{je(Ne);try{localStorage.setItem(NL,Ne)}catch{}},[]),ct=y.useCallback(Ne=>{Ne.preventDefault();const Ce=et.current;if(!Ce)return;const ut=Ce.getBoundingClientRect().width,dn=Ne.clientX,jt=Me.current;Je(!0);const ne=$e=>{const Oe=yL({startWidth:jt,dx:$e.clientX-dn,containerWidth:ut,listPaneMinWidth:DL,hunkPaneMinWidth:y1,dividerWidth:yr});Oe!==null&&(Me.current=Oe,Ae(Oe))},ce=()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",ce),Je(!1);try{localStorage.setItem(LL,String(Me.current))}catch{}};document.addEventListener("pointermove",ne),document.addEventListener("pointerup",ce)},[]);y.useLayoutEffect(()=>(e.requestExtraWidth?.(Z==="changes"&&ke||Z==="history"&&J||Z==="compare"&&de?bY:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,ke,Z,J,de]);const Yt=ke?MY(ke):null,bt=y.useCallback(()=>Y(Ne=>Ne+1),[]),Se=q.kind==="ok"?q.files:[],Qe=t.find(Ne=>Ne.relPath===M)??w.find(Ne=>Ne.relPath===M);return c.jsxs("div",{className:"repository-unified",children:[c.jsxs("div",{className:`repository-identity${M?" is-subcontext":""}`,children:[c.jsx($L,{}),c.jsx("strong",{children:Qe?.name??"Repository"}),Qe?.branch&&c.jsx("span",{children:Qe.branch})]}),c.jsxs("div",{className:"repository-unified-body",children:[c.jsx(IY,{source:Z,refs:R,repos:t,worktrees:w,onSource:oe}),c.jsxs("div",{className:"repository-source-content",children:[Z==="repositories"?i?c.jsxs("div",{className:"history-error",children:["Unable to load repositories",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>u(Ne=>Ne+1),children:"Retry"})]}):c.jsx(BY,{repos:t,selectedRel:M,onRepository:Mt,scanDepth:p,onScanDepth:_,truncated:d}):null,Z==="worktrees"?k?c.jsxs("div",{className:"history-error",children:["Unable to load worktrees",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>F(Ne=>Ne+1),children:"Retry"})]}):c.jsx(PY,{worktrees:w,onWorktree:Mt}):null,c.jsx("div",{className:"repository-source-fill",hidden:Z!=="history",children:c.jsx(pY,{ctx:e,repoRel:M,active:Z==="history",refFilter:G,wipFiles:Se,onInspectorOpenChange:he,onClearRef:()=>B(null),onWip:()=>oe("changes")},`${e.theaterId??""}:${M}`)}),c.jsx("div",{className:"repository-source-fill",hidden:Z!=="compare",children:c.jsx(VV,{ctx:e,repoRel:M,refs:R,refsError:N,onRetryRefs:()=>j(Ne=>Ne+1),onFileOpenChange:ae},`${e.theaterId??""}:${M}`)}),Z!=="repositories"&&Z!=="worktrees"&&Z!=="changes"&&Z!=="history"&&Z!=="compare"?N?c.jsxs("div",{className:"history-error",children:["Unable to load refs",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>j(Ne=>Ne+1),children:"Retry"})]}):c.jsx(zY,{source:Z,refs:R,onRef:Ne=>{B(Ne),oe("history")}}):null,c.jsxs("div",{hidden:Z!=="changes",ref:et,className:`repository-root${ke?" has-hunk":""}${dt?" is-dragging":""}`,style:ke?{gridTemplateColumns:bL(Le)}:void 0,children:[ke&&Yt?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:ke.entry.path}),c.jsx("button",{type:"button",onClick:Wt,children:"✕"})]}),c.jsx(v1,{ctx:e,repoRel:M,file:ke.entry,mode:Yt})]}):null,ke?c.jsx("div",{className:"repository-divider",onPointerDown:ct,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane",children:[c.jsxs("div",{className:"repository-toolbar",children:[c.jsxs("div",{className:"repository-filter",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:De,onChange:Ne=>We(Ne.target.value)}),De?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>We(""),children:"✕"}):null]}),c.jsxs("div",{className:"repository-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${we==="list"?" is-active":""}`,title:"List view","aria-pressed":we==="list",onClick:()=>hn("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${we==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":we==="tree",onClick:()=>hn("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx(pL,{state:q,onRetry:bt,viewMode:we,selectedPath:ke?.entry.path??null,onSelect:Ye,filterText:De})]})]})]})]})]})}function nm({source:e}){const t=e==="repositories"?"M3 5h12v9H3zM5 3h8v2":e==="worktrees"?"M5 3v12M5 6h7M5 12h7":e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="compare"?"M5.5 3v9M3 9.5l2.5 2.5L8 9.5M12.5 15V6M10 8.5L12.5 6L15 8.5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":"M4 5h10v9H4zM6 3h6";return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function IY({source:e,refs:t,repos:n,worktrees:i,onSource:r}){const o=(u,d,f)=>c.jsxs("button",{type:"button","aria-label":d,"aria-current":e===u?"page":void 0,onClick:()=>r(u),children:[c.jsx(nm,{source:u}),c.jsx("span",{children:d}),f!==void 0&&c.jsx("i",{children:f})]},u);return c.jsxs("nav",{className:"repository-source-nav","aria-label":"Repository sources",children:[c.jsx("b",{children:"CONTEXT"}),o("repositories","Repositories",n.length),o("worktrees","Worktrees",i.length),c.jsx("b",{children:"WORKING"}),o("changes","Changes"),o("history","History"),o("compare","Compare"),c.jsx("b",{children:"REFS"}),o("branches","Branches",t.branches.length+t.remotes.filter(u=>!x1(u.ref)).length),o("tags","Tags",t.tags.length),o("stashes","Stashes",t.stashes.length)]})}function BY({repos:e,selectedRel:t,onRepository:n,scanDepth:i,onScanDepth:r,truncated:o}){const u=e.filter(m=>m.kind==="root").sort((m,_)=>m.name.localeCompare(_.name)),d=e.filter(m=>m.kind==="nested"),f=YV(d),p=[...u.length>0?[{key:"root",label:"THIS THEATER",render:()=>c.jsx(c.Fragment,{children:u.map(m=>c.jsx(BL,{repo:m,depth:0,selectedRel:t,onRepository:n},m.relPath))})}]:[],...d.length>0?[{key:"nested",label:"NESTED",render:()=>c.jsx(IL,{node:f,depth:0,selectedRel:t,onRepository:n})}]:[]];return c.jsxs("div",{className:"repository-scan-pane",children:[c.jsx("div",{className:"repository-ref-list",children:p.map(m=>c.jsxs("div",{className:"repository-ref-group",children:[c.jsx("b",{className:"repository-ref-group-label",children:m.label}),m.render()]},m.key))}),c.jsxs("div",{className:"repository-scan-foot",children:[c.jsx("label",{htmlFor:"repository-scan-depth",children:"Depth"}),c.jsx("select",{id:"repository-scan-depth",className:"repository-scan-depth",value:i,onChange:m=>r(Number.parseInt(m.target.value,10)),children:Array.from({length:OL-Tb+1},(m,_)=>Tb+_).map(m=>c.jsx("option",{value:m,children:m},m))}),c.jsxs("span",{className:"repository-scan-count",children:[e.length," found",o?" · limit reached":""]})]})]})}function IL({node:e,depth:t,selectedRel:n,onRepository:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx($Y,{dirKey:r,node:o,depth:t,selectedRel:n,onRepository:i},r)),e.repos.map(r=>c.jsx(BL,{repo:r,depth:t,selectedRel:n,onRepository:i},r.relPath))]})}function $Y({dirKey:e,node:t,depth:n,selectedRel:i,onRepository:r}){const[o,u]=y.useState(!1),d=y.useCallback(()=>u(b=>!b),[]),{label:f,node:p}=XV(e,t),m=n*16+12,_=kL(p);return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`,gridTemplateColumns:"12px 15px 1fr auto"},onClick:d,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.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"})}),c.jsx("span",{className:"repository-folder-name",children:f}),c.jsx("span",{className:"repository-folder-count",children:_})]}),!o&&c.jsx(IL,{node:p,depth:n+1,selectedRel:i,onRepository:r})]})}function BL({repo:e,depth:t,selectedRel:n,onRepository:i}){const r=t*16+30;return c.jsxs("button",{type:"button",title:e.relPath,className:`repository-ref-row${e.relPath===n?" is-current":""}`,style:{paddingLeft:`${r}px`},onClick:()=>i(e),children:[c.jsx(nm,{source:"repositories"}),c.jsxs("span",{className:"repository-ref-name",children:[e.name,e.relPath===n&&" ✓"]}),e.branch&&c.jsx("span",{className:"repository-ref-sub",children:e.branch})]})}function PY({worktrees:e,onWorktree:t}){return c.jsx("div",{className:"repository-ref-list",children:e.map(n=>c.jsxs("button",{type:"button",title:n.relPath,className:`repository-ref-row${n.current?" is-current":""}`,onClick:()=>t(n),children:[c.jsx(nm,{source:"worktrees"}),c.jsxs("span",{className:"repository-ref-name",children:[n.name,n.current&&" ✓"]}),n.branch&&c.jsx("span",{className:"repository-ref-sub",children:n.branch})]},n.relPath))})}function zY({source:e,refs:t,onRef:n}){return e==="repositories"||e==="worktrees"||e==="changes"||e==="history"||e==="compare"?null:c.jsx("div",{className:"repository-ref-list",children:OY(e,t).map(i=>c.jsxs("div",{className:"repository-ref-group",children:[i.label&&c.jsx("b",{className:"repository-ref-group-label",children:i.label}),i.rows.map(r=>c.jsxs("button",{type:"button",className:`repository-ref-row${r.current?" is-current":""}`,disabled:r.ref===null,onClick:()=>{r.ref&&n(r.ref)},children:[c.jsx(nm,{source:r.source}),c.jsxs("span",{className:"repository-ref-name",children:[r.primary,r.current&&" ✓"]}),r.sub&&c.jsx("span",{className:"repository-ref-sub",children:r.sub})]},r.key))]},i.label??e))})}function $L(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),c.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const HY={id:"repository",title:"Repository",icon:()=>c.jsx($L,{}),render:e=>c.jsx(jY,{ctx:e})},FY={id:"repository",railPanels:[HY]},UY=[FY],mf=["claude-code","codex","cursor","opencode"],WY={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},qY="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function GY({source:e,skill:t,theaterId:n,onCancel:i,onStarted:r,jobLog:o}){const[u,d]=y.useState(n?"project":"global"),[f,p]=y.useState(!0),[m,_]=y.useState(new Set(mf)),{status:b,start:S}=o,w=b==="running",x=b==="done",k=b==="error",O=y.useCallback(()=>{p(!0),_(new Set(mf))},[]),P=y.useCallback(T=>{p(!1),_(L=>{const M=new Set(L);return M.has(T)?M.delete(T):M.add(T),M})},[]),F=y.useCallback(()=>{const T=f?mf:Array.from(m);if(T.length===0)return;const L={source:e,skill:t,scope:u,agents:T};u==="project"&&n&&(L.theaterId=n),S("/plugins/skills/install",L),r(u)},[f,m,e,t,u,n,S,r]);return c.jsxs("div",{className:"skills-install-flow",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${u==="project"?" is-active":""}`,onClick:()=>d("project"),disabled:!n||w||x,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${u==="global"?" is-active":""}`,onClick:()=>d("global"),disabled:w||x,children:"Global"})]}),c.jsxs("div",{className:"skills-agents-row",children:[c.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:O,disabled:w||x,children:"All agents"}),mf.map(T=>c.jsx("button",{type:"button",className:`skills-agent-chip${!f&&m.has(T)?" is-active":""}`,onClick:()=>P(T),disabled:w||x,children:WY[T]},T))]}),c.jsx("p",{className:"skills-permission-warning",children:qY}),!w&&!x&&!k&&c.jsxs("div",{className:"skills-card-actions",children:[c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:"Cancel"}),c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:F,disabled:!f&&m.size===0,children:"Install now"})]})]})}const KY=4e3;function PL({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:u}){const[d,f]=y.useState(!1),p=y.useRef(null),m=y.useRef(null);y.useEffect(()=>{e==="running"&&f(!1)},[e]),y.useEffect(()=>{const k=p.current;k&&(k.scrollTop=k.scrollHeight)},[t]),y.useEffect(()=>{if(e==="done")return m.current=setTimeout(()=>{f(!1),o()},KY),()=>{m.current&&(clearTimeout(m.current),m.current=null)}},[e,o]);const _=y.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),f(!1),o()},[o]),b=y.useCallback(()=>f(k=>!k),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",x=e==="running"?n:e==="done"?i:r;return c.jsxs("div",{className:"skills-dock",children:[d&&c.jsxs("div",{ref:p,className:"skills-dock-log",children:[t.map((k,O)=>c.jsx("div",{className:"skills-dock-log-line",children:k},O)),e==="done"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),c.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${d?" is-open":""}`,"aria-expanded":d,onClick:b,onKeyDown:k=>{k.target===k.currentTarget&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),b())},children:[c.jsx("span",{className:S,"aria-hidden":"true"}),c.jsx("span",{className:w,"aria-live":"polite",children:x}),e==="running"&&t.length>0&&c.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:k=>{k.stopPropagation(),_()},children:"✕"}),e==="error"&&c.jsxs(c.Fragment,{children:[u!=null&&c.jsx("button",{type:"button",className:"skills-dock-retry",onClick:k=>{k.stopPropagation(),u()},children:"Retry"}),c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:k=>{k.stopPropagation(),_()},children:"✕"})]}),c.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const VY={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},Ab=new Set;let hi=VY;function Xa(){for(const e of Ab)e()}function YY(e){return Ab.add(e),()=>{Ab.delete(e)}}function BE(){return hi}function C1(){return y.useSyncExternalStore(YY,BE,BE)}function gf(e){hi={...hi,activeTab:e},Xa()}function $E(e){hi={...hi,scope:e},Xa()}function XY(e){hi={...hi,filterText:e},Xa()}function ZY(e){hi={...hi,searchQuery:e},Xa()}function Pl(e,t){hi={...hi,searchResults:e,searchLoading:t},Xa()}function kp(e){return e??""}function Rb(e,t){return e.installedContextKey===t}function vv(e,t,n){hi.installedContextKey===e&&(hi={...hi,installedList:t,installedLoading:n},Xa())}function Nb(e){hi={...hi,installFormOpenId:e},Xa()}function JY(e){hi={...hi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Xa()}const PE=750;function zL(){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((u,d)=>{i(),t({status:"running",lines:[]}),(async()=>{const f=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).catch(()=>null);if(!f?.ok){t({status:"error",lines:[]});return}const{jobId:p}=await f.json();let m=0;const _=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(p)}&cursor=${m}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();m=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{_()},PE):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{_()},PE)})()},[i]);return{...e,start:o,reset:r}}const QY=300,Pf=2;function eX(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function tX(e){if(e.length<Pf){Pl([],!1);return}Pl([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Pl([],!1);return}const n=await t.json();Pl(n.skills??[],!1)}catch{Pl([],!1)}}function nX({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:r,onInstallStarted:o,jobLog:u}){const d={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return c.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>r(d,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&c.jsx("span",{className:"skills-card-installs",children:eX(e.installs)})]}),c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("div",{className:"skills-card-actions",children:c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:n?"Cancel":"Install"})}),n&&c.jsx(GY,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:f=>o(e.name,f),jobLog:u})]})}function iX({theaterId:e,onReadMore:t,onInstallSuccess:n}){const{searchQuery:i,searchResults:r,searchLoading:o,installFormOpenId:u}=C1(),d=y.useRef(null),f=zL(),[p,m]=y.useState(null),_=y.useCallback(S=>{if(ZY(S),d.current&&clearTimeout(d.current),S.length<Pf){Pl([],!1);return}d.current=setTimeout(()=>{tX(S)},QY)},[]);y.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),y.useEffect(()=>{f.status!=="done"||!p||(n(p.name,p.scope),Nb(null),m(null))},[f.status,p,n]);const b=p?`Installing ${p.name}…`:"Installing…";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:i,onChange:S=>_(S.target.value),"aria-label":"Search skills registry"}),o&&c.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!o&&i.length>=Pf&&r.length===0&&c.jsxs("div",{className:"skills-empty-state",children:['No results for "',i,'".']}),!o&&i.length>0&&i.length<Pf&&c.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),c.jsx("div",{className:"skills-card-list",children:r.map(S=>c.jsx(nX,{result:S,theaterId:e,isFormOpen:u===S.id,onInstallClick:()=>Nb(u===S.id?null:S.id),onReadMore:t,onInstallStarted:(w,x)=>m({name:w,scope:x}),jobLog:f},S.id))})]}),c.jsx(PL,{status:f.status,lines:f.lines,runningLabel:b,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const sX=2600;function rX({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,u]=y.useState(!1),d=y.useRef(null),f=y.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),p=y.useCallback(()=>{o?(f(),u(!1),i?.(e.name,e.scope)):(u(!0),d.current=setTimeout(()=>u(!1),sX))},[o,f,i,e.name,e.scope]);return y.useEffect(()=>()=>f(),[f]),c.jsxs("div",{className:"skills-card",children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),c.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),c.jsxs("div",{className:"skills-card-actions",children:[n&&c.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&&c.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:p,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function aX(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function oX({theaterId:e,onReadMore:t,refreshKey:n}){const i=C1(),{scope:r,filterText:o}=i,u=kp(e),d=Rb(i,u)?i.installedList:[],f=Rb(i,u)&&i.installedLoading,p=zL(),m=y.useRef(null),_=y.useCallback(P=>{const F=kp(P);vv(F,[],!0),aX(P).then(T=>vv(F,T,!1)).catch(()=>vv(F,[],!1))},[]);y.useEffect(()=>{_(e)},[e,_,n]),y.useEffect(()=>{(p.status==="done"||p.status==="error")&&_(e)},[p.status,e,_]);const b=y.useCallback(P=>{const F=P;m.current=F;const T={scope:F};F==="project"&&e&&(T.theaterId=e),p.start("/plugins/skills/update",T)},[e,p]),S=y.useCallback((P,F)=>{const T={scope:F,skill:P};F==="project"&&e&&(T.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}).then(()=>_(e)).catch(()=>null)},[e,_]),w=y.useCallback(()=>{m.current&&b(m.current)},[b]),x=r==="project"&&!e?"global":r,k=d.filter(P=>P.scope!==x?!1:o?P.name.toLowerCase().includes(o.toLowerCase()):!0),O=p.status==="running"&&m.current===x;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${x==="project"?" is-active":""}`,onClick:()=>$E("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${x==="global"?" is-active":""}`,onClick:()=>$E("global"),children:"Global"})]}),c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:P=>XY(P.target.value),"aria-label":"Filter installed skills"}),f&&c.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&k.length===0&&c.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${x} skills installed.`}),c.jsx("div",{className:"skills-card-list",children:k.map(P=>c.jsx(rX,{skill:P,onReadMore:t,onUpdate:b,onRemove:S,isUpdating:O},`${P.scope}:${P.name}`))})]}),c.jsx(PL,{status:p.status,lines:p.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:p.reset,onRetry:w})]})}function yv(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 lX({content:e}){const t=y.useMemo(()=>{const r=Bs(e).html,o=new DOMParser().parseFromString(r,"text/html");return yv(o.body),o.body.innerHTML},[e]),n=y.useRef(null);y.useEffect(()=>{const r=n.current;if(!r)return;yv(r);const o=new MutationObserver(()=>yv(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 u=o.closest("pre")?.getAttribute("data-code");if(!u)return;navigator.clipboard?.writeText(u);const d=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=d},1200)},[]);return c.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const cX=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),uX="Skills run with full agent permissions. Review before use.";function hX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(cX)),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 dX({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:r}){const[o,u]=y.useState(null),[d,f]=y.useState(!1),p=y.useRef(null),m=y.useRef(null),_=y.useRef(null);if(y.useEffect(()=>{e&&p.current===null&&(p.current=document.activeElement)},[e]),y.useEffect(()=>{if(!e){u(null);return}f(!0),u(null);let S=!1;return(async()=>{try{let x;if(t){const O={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(O.theaterId=n),x=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})}else x=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(S)return;if(!x.ok){f(!1);return}const k=await x.json();S||(u(k.markdown??""),f(!1))}catch{S||f(!1)}})(),()=>{S=!0}},[e,t,n]),y.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"?(w.preventDefault(),i()):w.key==="Tab"&&hX(w,_.current),w.stopImmediatePropagation()};return m.current?.focus(),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0);const w=p.current;p.current=null,w?.focus?.()}},[e,i]),y.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const b=e.displayPath||e.source||null;return Ya.createPortal(c.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:c.jsxs("div",{ref:_,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"skills-overlay-header",children:[c.jsx("span",{className:"skills-overlay-title",children:e.name}),b&&c.jsx("span",{className:"skills-overlay-meta",children:b}),c.jsx("button",{ref:m,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"skills-overlay-body",children:[d&&c.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!d&&o===null&&c.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),o!==null&&c.jsx(lX,{content:o})]}),c.jsxs("div",{className:"skills-overlay-footer",children:[c.jsx("p",{className:"skills-permission-warning",children:uX}),!t&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),r()},children:"Install"})]})]})}),document.body)}const fX=3200;function pX({message:e,onDismiss:t}){return y.useEffect(()=>{if(!e)return;const n=setTimeout(t,fX);return()=>clearTimeout(n)},[e,t]),e?c.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function mX({ctx:e}){const t=kp(e.theaterId);return c.jsx(gX,{ctx:e},t)}function gX({ctx:e}){const{theaterId:t}=e,n=C1(),{activeTab:i}=n,r=kp(e.theaterId),[o,u]=y.useState(null),[d,f]=y.useState(null),[p,m]=y.useState(0),_=Rb(n,r)?n.installedList.length:0;y.useLayoutEffect(()=>{JY(r)},[r]);const b=y.useCallback(k=>{u({skill:k,isInstalled:!0})},[]),S=y.useCallback((k,O)=>{u({skill:k,isInstalled:!1,registryId:O})},[]),w=y.useCallback((k,O)=>{f(`Installed ${k} to ${O}`),m(P=>P+1),gf("installed")},[]),x=y.useCallback(()=>{o?.registryId&&(Nb(o.registryId),gf("find")),u(null)},[o]);return c.jsxs("div",{className:"skills-root",children:[c.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>gf("installed"),children:["Installed",_>0?` ${_}`:""]}),c.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>gf("find"),children:"Find"})]}),i==="installed"?c.jsx(oX,{theaterId:t,onReadMore:b,refreshKey:p}):c.jsx(iX,{theaterId:t,onReadMore:S,onInstallSuccess:w}),c.jsx(pX,{message:d,onDismiss:()=>f(null)}),c.jsx(dX,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>u(null),onInstall:x})]})}function _X(){return c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:c.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 vX={id:"skills",title:"Skills",icon:_X,render:e=>c.jsx(mX,{ctx:e})},yX={id:"skills",railPanels:[vX]},bX=[yX],HL=[...TK,...TV,...UY,...bX],SX=UL(HL),FL=y.createContext(SX),wX=FL.Provider;async function xX(){const e=[...HL],t=new Set(e.map(i=>i.id)),n=await CX();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await kX(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 UL(e)}function yc(){return y.useContext(FL)}async function CX(){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(TX):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function kX(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return EX(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 UL(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 EX(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function TX(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)}let WL=!1;const Lb=new Set;function AX(){return y.useSyncExternalStore(RX,zE,zE)}function zE(){return WL}function qL(e){WL=NX(e)?e.fullscreen:!1;for(const t of Lb)t()}function HE(){qL({fullscreen:!1})}function RX(e){return Lb.add(e),()=>Lb.delete(e)}function NX(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 GL="(display-mode: fullscreen)",LX=480,MX=480,jX=()=>!0;function OX(){return typeof window<"u"&&window.matchMedia(GL).matches}function DX(e=jX){const t=AX(),[n,i]=y.useState(OX),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,u=y.useRef(o);u.current=o;const d=y.useRef(!1),f=y.useRef(null),[p,m]=y.useState(o),[_,b]=y.useState(!0),[S,w]=y.useState(!1),x=y.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),k=y.useCallback(T=>{x(),!(!u.current||d.current)&&(f.current=setTimeout(()=>{f.current=null,u.current&&!d.current&&e()&&b(!1)},T))},[e,x]),O=y.useCallback(()=>{x(),u.current&&b(!0)},[x]),P=y.useCallback(()=>k(MX),[k]),F=y.useCallback(()=>{const T=!d.current;d.current=T,w(T),T&&(x(),b(!0))},[x]);return y.useEffect(()=>{const T=window.matchMedia(GL),L=()=>i(T.matches);return L(),T.addEventListener("change",L),()=>T.removeEventListener("change",L)},[]),y.useLayoutEffect(()=>(x(),m(o),b(!0),o&&!d.current&&k(LX),x),[x,o,k]),{isFullscreen:p,isVisible:_,isPinned:S,reveal:O,hideAfterLeave:P,togglePin:F}}function IX({operationsViewVisible:e}){const t=Qs(),n=yc(),i=XT(),r=oA(),o=$X(),u=`${o}${o==="⌘"?"":"+"}B`,d=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,f=s0(),p=t.theaters.find(Ce=>Ce.id===t.activeTheaterId)??null,m=cI(t.operations,t.activeOperationId,t.activeTheaterId),_=m?n.plugins.find(Ce=>Ce.id===m.pluginId):null,b=typeof m?.payload.cliId=="string"?m.payload.cliId:null,S=typeof m?.payload.cliLabel=="string"?m.payload.cliLabel:b,w=m?_?.operationKinds?.find(Ce=>Ce.type===m.type)??null:null,x=m&&_?.renderLaunchIcon?_.renderLaunchIcon({id:b??m.type,type:m.type,title:w?.title??m.type}):null,k=y.useRef(null),O=y.useRef(null),P=y.useRef(null),F=y.useRef(null),T=y.useRef({edge:!1,band:!1}),L=y.useRef(null),M=y.useRef(null),z=y.useRef(null),U=y.useRef(null),Z=y.useRef(null),[Q,G]=y.useState(null),[B,R]=y.useState(0),[D,N]=y.useState(!1),[E,$]=y.useState(null),[j,q]=y.useState(null),[H,A]=y.useState(!1),[Y,J]=y.useState(null),[he,de]=y.useState(null),ae=()=>{$(null),q(null),A(!1),J(null),de(null)},we=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",je=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",De=y.useCallback(()=>{const Ce=document.activeElement;return!(Ce instanceof Node&&(P.current?.contains(Ce)||F.current?.contains(Ce)))&&!T.current.edge&&!T.current.band},[]),We=DX(De),ke=m?.id??null,Le=y.useRef(null);Le.current=ke;const Ae=S0({currentTitle:m?.title??"",onCommit:Ce=>{const ut=PC(L.current,Le.current);L.current=null,ut&&J5(ut,Ce).then(()=>Ji(null)).then(fs).catch(()=>{})}});y.useEffect(()=>{!Ae.renaming||PC(L.current,ke)||(L.current=null,Ae.cancel())},[Ae,ke]),y.useEffect(()=>{if(!D)return;const Ce=new AbortController;return $(null),q(null),A(!0),eO(Ce.signal).then($).catch(ut=>{Ce.signal.aborted||q(ut instanceof Error?ut.message:"Unable to load environment details.")}).finally(()=>{Ce.signal.aborted||A(!1)}),()=>Ce.abort()},[D]),y.useEffect(()=>{if(!D)return;const Ce=dn=>{const jt=dn.target;!(jt instanceof Node)||k.current?.contains(jt)||O.current?.contains(jt)||(N(!1),ae())},ut=dn=>{dn.key==="Escape"&&(N(!1),ae(),k.current?.focus())};return document.addEventListener("pointerdown",Ce),document.addEventListener("keydown",ut),()=>{document.removeEventListener("pointerdown",Ce),document.removeEventListener("keydown",ut)}},[D]),y.useEffect(()=>{if(Q===null)return;const Ce=Q==="theater"?M:z,ut=jt=>{const ne=jt.target;!(ne instanceof Node)||Ce.current?.contains(ne)||Z.current?.contains(ne)||G(null)},dn=jt=>{jt.key==="Escape"&&(G(null),Ce.current?.focus())};return document.addEventListener("pointerdown",ut),document.addEventListener("keydown",dn),()=>{document.removeEventListener("pointerdown",ut),document.removeEventListener("keydown",dn)}},[Q]),y.useEffect(()=>{G(null)},[t.activeTheaterId,t.activeOperationId]),y.useLayoutEffect(()=>{if(Q===null)return;const Ce=()=>{const ut=U.current,dn=Z.current;if(!ut||!dn)return;const jt=Q==="operation"?z.current?.offsetLeft??0:0;R(hI(jt,ut.getBoundingClientRect().left,dn.getBoundingClientRect().width,window.innerWidth))};return Ce(),window.addEventListener("resize",Ce),()=>window.removeEventListener("resize",Ce)},[Q]),y.useEffect(()=>{t.channel!=="local"&&(N(!1),$(null),q(null),A(!1),J(null),de(null))},[t.channel]);const Me=Ce=>{navigator.clipboard.writeText(Ce).then(()=>{J(Ce),de(null)}).catch(()=>{de(Ce),J(null)})},et=()=>{m&&(G(null),L.current=m.id,Ae.begin())},dt=Ce=>{N(!1),ae(),G(ut=>ut===Ce?null:Ce)},Je=Ce=>{Q===null||!uI(Ce.currentTarget,Ce.relatedTarget)||G(null)},oe=Ce=>{G(null),M.current?.focus(),Ce!==t.activeTheaterId&&f0(Ce)},qe=Ce=>{G(null),z.current?.focus(),oc(Ce)},Ye=()=>{G(null),M.current?.focus(),BD()},Mt=()=>{p&&(G(null),z.current?.focus(),PD(p.id))},Wt=lI(t.operations,t.groups,t.activeTheaterId,f.operationOrder),hn=()=>{De()&&We.hideAfterLeave()},ct=Ce=>{const ut=Ce.relatedTarget;(!(ut instanceof Node)||!P.current?.contains(ut)&&!F.current?.contains(ut))&&!T.current.edge&&!T.current.band&&We.hideAfterLeave()},Yt=()=>{T.current.edge=!0,We.reveal()},bt=()=>{T.current.edge=!1,hn()},Se=()=>{T.current.band=!0,We.reveal()},Qe=()=>{T.current.band=!1,hn()},Ne=We.isFullscreen&&!We.isVisible;return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:F,type:"button",className:`command-band-edge-reveal${We.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:Yt,onPointerLeave:bt,onFocus:We.reveal,onBlur:ct,onKeyDown:Ce=>{Ce.key==="Tab"&&We.reveal()}}),c.jsxs("header",{ref:P,className:`command-band${e?" is-operations":" is-utility"}${We.isFullscreen?" is-fullscreen":""}${We.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":Ne||void 0,inert:Ne||void 0,onPointerEnter:Se,onPointerLeave:Qe,onFocus:We.reveal,onBlur:ct,children:[c.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[c.jsx(HI,{className:"command-band-brand"}),t.channel==="local"?c.jsxs("div",{className:"command-band-environment",children:[c.jsxs("button",{ref:k,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":D,onClick:()=>{G(null),ae(),N(Ce=>!Ce)},children:[c.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),c.jsx("span",{className:"command-band-local-chip-label",children:we?je:"Local"})]}),D?c.jsx("div",{ref:O,children:c.jsx(BX,{environment:E,error:j,loading:H,copiedValue:Y,copyFailedValue:he,desktopShell:we,onCopy:Me})}):null]}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>Xl(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,children:c.jsx(FE,{side:"left"})}):null,c.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:LT,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:c.jsx(PX,{})})]}),c.jsx("div",{className:"command-band-center",children:e&&p?c.jsxs("div",{ref:U,className:"command-band-switcher",onBlur:Je,children:[c.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${p.label}`,children:[c.jsxs("button",{ref:M,type:"button",className:`command-band-theater-segment command-band-segment-trigger${Q==="theater"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Q==="theater",title:"Switch Theater",onClick:()=>dt("theater"),children:[c.jsx("span",{className:"command-band-theater-mark",children:x0(p.label)}),c.jsx("span",{className:"command-band-segment-label",children:p.label}),c.jsx(S_,{})]}),c.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),m?c.jsxs(c.Fragment,{children:[Ae.renaming?c.jsx("input",{ref:Ae.inputRef,className:"command-band-rename-input",value:Ae.draftTitle,"aria-label":`${m.title} 이름 변경`,onChange:Ce=>Ae.setDraftTitle(Ce.target.value),onKeyDown:Ae.handleKeyDown,onBlur:Ae.handleBlur}):c.jsxs("button",{ref:z,type:"button",className:`command-band-operation-name command-band-segment-trigger${Q==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Q==="operation",title:"Switch operation — double-click to rename",onClick:()=>dt("operation"),onDoubleClick:et,children:[c.jsx("span",{className:"command-band-segment-label",children:m.title}),c.jsx(S_,{})]}),S?c.jsxs("span",{className:"command-band-operation-attribute",title:w?.title??S,children:[x?c.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:x}):null,S]}):null]}):c.jsxs("button",{ref:z,type:"button",className:`command-band-operation-placeholder command-band-segment-trigger${Q==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Q==="operation",title:"Select operation",onClick:()=>dt("operation"),children:[c.jsx("span",{className:"command-band-segment-label",children:"Select operation…"}),c.jsx(S_,{})]})]}),Q==="theater"?c.jsx(G8,{theaters:t.theaters,operations:t.operations,activeTheaterId:t.activeTheaterId,addingTheater:t.addingTheater,onSelectTheater:oe,onAddTheater:Ye,style:{left:B},containerRef:Z}):null,Q==="operation"?c.jsx(K8,{operations:Wt,activeOperationId:m?.id??null,theaterLabel:p.label,onSelectOperation:qe,onRenameOperation:m?et:null,onNewOperation:Mt,style:{left:B},containerRef:Z}):null]}):null}),c.jsxs("div",{className:"command-band-right",children:[We.isFullscreen?c.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:We.togglePin,"aria-label":"Pin command band","aria-pressed":We.isPinned,title:We.isPinned?"Unpin command band":"Pin command band",children:c.jsx(zX,{})}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:E0,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,children:c.jsx(FE,{side:"right"})}):null]})]})]})}function BX({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:u}){if(n)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return c.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 c.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[c.jsx("div",{className:"command-band-environment-title",children:"Environment"}),d.map(([f,p])=>c.jsxs("div",{className:"command-band-environment-row",children:[c.jsx("span",{children:f}),c.jsx("code",{children:p}),c.jsx("button",{type:"button",onClick:()=>u(p),children:i===p?"Copied":r===p?"Copy failed":"Copy"})]},f)),c.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function $X(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function PX(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function FE({side:e}){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function zX(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const HX=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function FX({state:e}){const[t,n]=y.useState(!1),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),u=e.theaters.length>0;if(y.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const m=i.current;i.current=null,m?.focus?.()}},[e.onboardingOpen]),y.useEffect(()=>{if(!e.onboardingOpen)return;const m=_=>{t||(_.key==="Escape"?(_.preventDefault(),fu()):_.key==="Tab"&&UX(_,o.current),_.stopImmediatePropagation())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const d=()=>{n(!0)},f=()=>{n(!1)},p=async m=>{n(!1),RT();try{const _=await Z5(m),b=await X5(_);NT(b)}catch(_){sy(_ instanceof Error?_.message:String(_))}};return c.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[c.jsx("button",{type:"button",className:"commissioning-scrim",onClick:fu,"aria-label":"Close setup guide"}),c.jsxs("section",{className:"commissioning-card",ref:o,children:[c.jsxs("header",{className:"commissioning-header",children:[c.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),c.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),c.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),c.jsxs("ol",{className:"commissioning-steps",children:[c.jsxs("li",{className:`commissioning-step commissioning-step--primary ${u?"is-complete":"is-current"}`,children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:u?"✓":"01"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Register a Theater"}),c.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),u?c.jsx(rh,{ref:m=>{r.current=m},className:"commissioning-primary-action",to:"/operations",onClick:fu,children:"Go to Operations →"}):c.jsx("button",{ref:m=>{r.current=m},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:d,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?c.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Open an Operation"}),c.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."}),c.jsx(rh,{className:"commissioning-secondary-link",to:"/operations",onClick:fu,children:"Go to Operations"})]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Monitor Carriers"}),c.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),c.jsxs("footer",{className:"commissioning-footer",children:[c.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),c.jsx("button",{type:"button",className:"commissioning-skip",onClick:fu,children:"Skip for now"})]})]}),c.jsx(zT,{open:t,onCancel:f,onConfirm:p})]})}function UX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(HX)),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()))}let Mb=null;function WX(e){Mb=e}function qX(){const e=Mb;return Mb=null,e}async function KL(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await VL(t),YL(await t.json(),t.status)}async function GX(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await VL(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new un(n.status,"Invalid global settings mutation response");return{state:YL(i.state,n.status)}}async function VL(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 un(e.status,t)}function YL(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!KX(n.consoleStaticPort)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!VX(n.language))throw new un(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,theme:n.theme,uiFont:_D(n.uiFont),language:n.language}}function KX(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function VX(e){return e==="auto"||e==="en"||e==="ko"}const jb=new Set;let vh={loading:!1,state:null,savingField:null,error:null};function k1(){return y.useSyncExternalStore(XX,Ep,Ep)}function Ep(){return vh}function YX(e){$o({loading:!1,state:e,error:null})}function XX(e){return jb.add(e),()=>{jb.delete(e)}}async function ZX(e){$o({loading:!0,error:null});try{const t=await KL(e);$o({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;$o({loading:!1,error:XL(t)})}}async function qo(e,t){if(vh.savingField!==null)return!1;const n=vh.state,i=n?{...n,[e]:t}:null;$o({state:i,savingField:e,error:null});try{const r=await GX({[e]:t});return $o({state:r.state,savingField:null,error:null}),!0}catch(r){return $o({state:n,savingField:null,error:XL(r)}),!1}}function $o(e){vh={...vh,...e};for(const t of jb)t()}function XL(e){return e instanceof Error?e.message:String(e)}const JX=[{id:"instrument",label:"Instrument"},{id:"maritime",label:"Maritime"},{id:"carbon",label:"Carbon"}];function QX(e){return e.startsWith(">")}function UE(e){return e.slice(1)}function eZ(e,t){const n=[],i=e.theaters.find(r=>r.id===e.activeTheaterId)??null;for(const r of e.theaters)n.push({commandId:`switch-theater:${r.id}`,label:`Switch theater: ${r.label}`,current:r.id===e.activeTheaterId,action:{kind:"switch-theater",theaterId:r.id}});i&&n.push({commandId:"new-operation",label:`New Operation in ${i.label}`,current:!1,action:{kind:"new-operation"}});for(const r of t)n.push({commandId:`open-rail-panel:${r.id}`,label:`Open panel: ${r.title}`,current:!1,action:{kind:"open-rail-panel",panelId:r.id}});n.push({commandId:"toggle-rail",label:"Toggle Activity Rail",current:!1,action:{kind:"toggle-rail"}}),n.push({commandId:"toggle-sidebar",label:"Toggle sidebar",current:!1,action:{kind:"toggle-sidebar"}});for(const r of JX)n.push({commandId:`switch-theme:${r.id}`,label:`Switch theme: ${r.label}`,current:r.id===e.activeTheme,action:{kind:"switch-theme",theme:r.id}});return n.push({commandId:"open-settings",label:"Open Settings",current:!1,action:{kind:"open-settings"}}),n.push({commandId:"open-keyboard-shortcuts",label:"Open keyboard shortcuts",current:!1,action:{kind:"open-keyboard-shortcuts"}}),e.releaseNotes.length>0&&n.push({commandId:"whats-new",label:"What's new",current:!1,action:{kind:"whats-new"}}),n}function tZ(e,t){const n=d0(t);return n.length===0?e:e.filter(i=>{const r=i.label.toLocaleLowerCase();return n.every(o=>r.includes(o))})}const nZ="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",WE="operation-search-listbox",ZL="__unassigned__",qE="operation-search-heading-commands";function iZ({state:e,railPanels:t}){const n=pc(),i=_s(),[r,o]=y.useState(""),[u,d]=y.useState(0),f=y.useRef(null),p=y.useRef(null),m=y.useRef(null),_=y.useRef(new Map),b=QX(r),S=y.useMemo(()=>ZD(e),[e]),w=y.useMemo(()=>oD(S,r),[S,r]),x=y.useMemo(()=>lD(w),[w]),k=y.useMemo(()=>eZ(e,t),[e,t]),O=y.useMemo(()=>b?tZ(k,UE(r)):k,[b,k,r]),P=y.useMemo(()=>d0(b?UE(r):r),[b,r]),F=b?O.length:w.length,T=GE(u,F),L=b?O[T]?.commandId:w[T]?.operationId,M=L===void 0?void 0:b?VE(L):KE(L);if(y.useEffect(()=>{if(!e.operationSearchOpen)return;m.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const Q=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>f.current?.focus(),0),()=>{document.body.style.overflow=Q,m.current?.focus()}},[e.operationSearchOpen]),y.useEffect(()=>{if(!e.operationSearchOpen){o(""),d(0);return}d(0)},[e.operationSearchOpen,r]),y.useEffect(()=>{!e.operationSearchOpen||L===void 0||_.current.get(L)?.scrollIntoView({block:"nearest"})},[L,e.operationSearchOpen]),!e.operationSearchOpen)return null;const z=Q=>{m.current=null,oc(Q),n("/operations"),Wd()},U=Q=>{const G=Q.action;switch(G.kind){case"switch-theater":{if(Q.current)break;m.current=null,f0(G.theaterId),n("/operations");break}case"new-operation":{m.current=null,i.pathname.startsWith("/operations")||n("/operations"),zD();break}case"open-rail-panel":{i.pathname.startsWith("/operations")||n("/operations"),Q8(G.panelId),rA(!0);break}case"toggle-rail":{i.pathname.startsWith("/operations")||n("/operations"),m.current=document.querySelector(".command-band-rail-toggle"),E0();break}case"toggle-sidebar":{i.pathname.startsWith("/operations")||n("/operations"),m.current=document.querySelector(".command-band-sidebar-toggle"),Xl(!tp().collapsed);break}case"switch-theme":{if(Q.current)break;const B=e.activeTheme;ac(G.theme),qo("theme",G.theme).then(R=>{R||ac(B)});break}case"open-settings":{m.current=null,n("/settings");break}case"open-keyboard-shortcuts":{WX(m.current),m.current=null,FD();break}case"whats-new":{MT();break}}Wd()},Z=Q=>{if(Q.key==="Escape"){Q.preventDefault(),Wd();return}if(Q.key==="ArrowDown"||Q.key==="ArrowUp"){Q.preventDefault(),d(G=>GE(G+(Q.key==="ArrowDown"?1:-1),F));return}if(Q.key==="Enter"){if(b){const B=O[T];if(!B)return;Q.preventDefault(),U(B);return}const G=w[T];if(!G)return;Q.preventDefault(),z(G.operationId);return}Q.key==="Tab"&&oZ(Q,p.current)};return c.jsx("div",{className:"operation-search-overlay",onMouseDown:Q=>{Q.target===Q.currentTarget&&Wd()},children:c.jsxs("section",{ref:p,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":b?"Console commands":"Operation quick search",tabIndex:-1,onKeyDown:Z,children:[c.jsxs("div",{className:"operation-search-field",children:[c.jsx(lZ,{}),c.jsx("input",{ref:f,id:"operation-search-input",type:"search",value:r,onChange:Q=>o(Q.target.value),placeholder:"Search Operations — type > for commands",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":WE,"aria-activedescendant":M,"aria-autocomplete":"list",spellCheck:!1}),c.jsx("kbd",{children:"esc"})]}),c.jsx("div",{id:WE,className:"operation-search-results",role:"listbox","aria-label":b?"Command results":"Operation results",children:b?O.length>0?c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":qE,children:[c.jsx("h2",{id:qE,className:"operation-search-section-heading",children:"Commands"}),O.map((Q,G)=>{const B=G===T;return c.jsxs("button",{id:VE(Q.commandId),ref:R=>{R?_.current.set(Q.commandId,R):_.current.delete(Q.commandId)},type:"button",className:`operation-search-result ${B?"is-active":""}`,role:"option","aria-selected":B,onMouseEnter:()=>d(G),onClick:()=>U(Q),children:[c.jsx("span",{className:"operation-search-command-glyph","aria-hidden":"true",children:"›"}),c.jsx("span",{className:"operation-search-result-text",children:c.jsx("strong",{children:_f(Q.label,P)})}),Q.current?c.jsx("span",{className:"operation-search-theater",children:"current"}):null]},Q.commandId)})]}):c.jsx("p",{className:"operation-search-empty",children:"No matching commands."}):x.length>0?x.map(Q=>{const G=rZ(Q.theaterId);return c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":G,children:[c.jsx("h2",{id:G,className:"operation-search-section-heading",children:_f(Q.theaterLabel,P)}),Q.entries.map(B=>{const R=w.indexOf(B),D=R===T;return c.jsxs("button",{id:KE(B.operationId),ref:N=>{N?_.current.set(B.operationId,N):_.current.delete(B.operationId)},type:"button",className:`operation-search-result ${D?"is-active":""}`,role:"option","aria-selected":D,onMouseEnter:()=>d(R),onClick:()=>z(B.operationId),children:[c.jsxs("span",{className:"operation-search-result-text",children:[c.jsx("strong",{children:_f(B.operationName,P)}),c.jsx("small",{children:sZ(B)})]}),c.jsx("span",{className:"operation-search-theater",children:_f(B.theaterLabel,P)})]},B.operationId)})]},Q.theaterId??ZL)}):c.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function GE(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function sZ(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function rZ(e){return`operation-search-heading-${E1(e??ZL)}`}function KE(e){return`operation-search-option-${E1(e)}`}function VE(e){return`operation-search-command-${E1(e)}`}function E1(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function _f(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=aZ(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(c.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function aZ(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const u=i.indexOf(o,n);u!==-1&&(!r||u<r.start)&&(r={start:u,end:u+o.length})}return r}function oZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(nZ)).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 lZ(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.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 cZ({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?c.jsx("div",{className:"app-toast-host",children:c.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[c.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),c.jsxs("div",{className:"app-toast-body",children:[c.jsx("p",{className:"app-toast-title",children:t}),n?c.jsx("p",{className:"app-toast-message",children:n}):null]}),r?c.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}let tc=null,Xu=0;function JL(e){tc?.abort();const t=new AbortController,n=++Xu;return tc=t,CD(),tO({...e,signal:t.signal}).then(i=>{n===Xu&&kD(i)}).catch(i=>{t.signal.aborted||n!==Xu||ED(i instanceof Error?i.message:String(i))}).finally(()=>{n===Xu&&(tc=null)})}function uZ(){tc!==null&&(tc.abort(),tc=null,Xu+=1)}function QL(e,t=hZ()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function hZ(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const eM=[{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"}],bv={id:"overview",label:"Overview"},dZ={id:"all-updates",label:"All updates"},fZ={id:"other-updates",label:"Other updates"};function tM(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=eM.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[bv,dZ]:t?[bv,...n,fZ]:[bv,...n]}function pZ(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 mZ(e){const t=eM.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(u=>u.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 gZ(e,t){return tM(e).some(n=>n.id===t)}const _Z=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Du=10;function vZ({state:e}){const t=y.useRef(null),n=y.useRef([]),i=y.useRef(null),r=y.useRef(null),o=y.useRef(new Map),[u,d]=y.useState("overview"),f=k1(),p=QL(f.state?.language??"auto"),m=e.selectedReleaseNoteKey??Ol(e.releaseNotes[0]?.version??"",0),_=e.releaseNotes.findIndex((U,Z)=>Ol(U.version,Z)===m),b=e.releaseNotes[_]??e.releaseNotes[0],S=b?Ol(b.version,_>=0?_:0):"",w=b?tM(b):[];y.useEffect(()=>{d("overview")},[S]),y.useEffect(()=>{b&&!gZ(b,u)&&d("overview")},[u,b]),y.useEffect(()=>{const U=Z=>{const Q=Z.target instanceof HTMLElement?Z.target:null;if(!Q||Q.closest(".whatsnew-card"))return;const G=n.current.filter(B=>B!==Q&&B.isConnected);n.current=[...G.slice(-4),Q]};return document.addEventListener("focusin",U,!0),()=>document.removeEventListener("focusin",U,!0)},[]);const x=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen||e.keyboardShortcutsOpen;if(e.whatsNewOpen&&!x&&t.current===null&&(t.current=document.activeElement),y.useEffect(()=>{if(!e.whatsNewOpen||x)return;const U=Z=>{Z.key==="Escape"?(Z.preventDefault(),qd()):wZ(Z,r.current,d)?Z.preventDefault():Z.key==="Tab"&&SZ(Z,r.current),Z.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",U,!0),()=>{window.removeEventListener("keydown",U,!0);const Z=t.current?.isConnected?t.current:[...n.current].reverse().find(Q=>Q.isConnected);t.current=null,Z?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const k=()=>{JL({force:!0,locale:p})},O=async U=>{await qo("language",U)},P=Math.max(1,Math.ceil(e.releaseNotes.length/Du)),F=Math.min(P-1,Math.floor((_>=0?_:0)/Du)),T=F*Du,L=e.releaseNotes.slice(T,T+Du),M=U=>{const Z=F+U;if(Z<0||Z>=P)return;const Q=Z*Du,G=e.releaseNotes[Q];G&&IC(Ol(G.version,Q))},z=U=>{d(U),requestAnimationFrame(()=>o.current.get(U)?.focus())};return c.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[c.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:qd,"aria-label":"Close What's new"}),c.jsxs("section",{className:"whatsnew-card",ref:r,children:[c.jsxs("header",{className:"whatsnew-header",children:[c.jsxs("div",{className:"whatsnew-heading-row",children:[c.jsx("h2",{id:"whatsnew-title",children:"What's new"}),c.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),c.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?c.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):c.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?c.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),c.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:qd,"aria-label":"Close What's new",children:"x"}),c.jsxs("div",{className:"whatsnew-body",children:[c.jsxs("div",{className:"whatsnew-version-selector",children:[c.jsx("select",{"aria-label":"Release version",value:S,onChange:U=>IC(U.currentTarget.value),children:L.map((U,Z)=>{const Q=T+Z;return c.jsxs("option",{value:Ol(U.version,Q),children:[U.version==="Unreleased"?"Unreleased":`v${U.version}`,U.date?` · ${U.date}`:""]},Ol(U.version,Q))})}),P>1?c.jsxs("div",{className:"whatsnew-pagination",children:[c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(-1),disabled:F===0,"aria-label":"Newer versions",children:"‹"}),c.jsxs("span",{className:"whatsnew-page-status",children:[F+1," / ",P]}),c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(1),disabled:F>=P-1,"aria-label":"Older versions",children:"›"})]}):null,c.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(U=>c.jsx("button",{type:"button",className:p===U?"is-active":"","aria-pressed":p===U,disabled:f.savingField==="language",onClick:()=>{O(U)},children:U==="en"?"EN":"한국어"},U))}),c.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:k,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),c.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(U=>c.jsx("button",{ref:Z=>{Z?o.current.set(U.id,Z):o.current.delete(U.id)},id:`whatsnew-tab-${U.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":U.id,"aria-selected":u===U.id,"aria-controls":"whatsnew-tab-panel",tabIndex:u===U.id?0:-1,onClick:()=>d(U.id),children:U.label},U.id))}),e.releaseNotesError?c.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,c.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${u}`,children:u==="overview"?c.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:mZ(b).map(U=>c.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>z(U.id),children:[c.jsx("span",{className:"whatsnew-overview-label",children:U.label}),c.jsxs("span",{className:"whatsnew-overview-count",children:[U.count," ",U.count===1?"update":"updates"]}),c.jsx("span",{className:"whatsnew-overview-summary",children:U.summary})]},U.id))}):pZ(b,u).map((U,Z)=>c.jsx(yZ,{section:U,index:Z},U.heading))})]}),c.jsx("footer",{className:"whatsnew-footer",children:c.jsx("button",{type:"button",className:"whatsnew-done",onClick:qd,children:"Close"})})]})]})}function yZ({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return c.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[c.jsx("h3",{children:c.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),c.jsx("ul",{children:e.items.map((r,o)=>c.jsx("li",{children:c.jsx(bZ,{item:r})},`${r.text}:${o}`))})]})}function bZ({item:e}){return c.jsxs(c.Fragment,{children:[e.packageTags.map((t,n)=>c.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),c.jsx("span",{children:e.text})]})}function Ol(e,t){return`${e}:${t}`}function SZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(_Z)),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 wZ(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 u=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,d=r[u],f=d.dataset.tabId;return f?(n(f),d.focus(),!0):!1}function nM(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function xZ(e,t=window){const n=i=>{if(!(FT()||nM(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 im(e=()=>{}){return{...A5(e),notifications:{emit:n=>OD(n),dismiss:n=>KD(n)},status:{set:(n,i)=>jD(n,i),clear:n=>AT(n)}}}async function CZ(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await kZ(t),EZ(await t.json(),t.status).routes}async function kZ(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 un(e.status,t)}function EZ(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new un(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>TZ(i,t))}}function TZ(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 un(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const Ob=new Set;let Db={loading:!1,state:null,error:null};function AZ(){return y.useSyncExternalStore(RZ,YE,YE)}function YE(){return Db}function RZ(e){return Ob.add(e),()=>{Ob.delete(e)}}async function NZ(e){Sv({loading:!0,error:null});try{const t=await CZ(e);Sv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Sv({loading:!1,error:LZ(t)})}}function Sv(e){Db={...Db,...e};for(const t of Ob)t()}function LZ(e){return e instanceof Error?e.message:String(e)}function MZ(){const e=AZ(),[t,n]=y.useState(!0),i=y.useMemo(()=>DZ(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return y.useEffect(()=>{const u=new AbortController;return NZ(u.signal),()=>u.abort()},[]),c.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[c.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:c.jsxs("div",{className:"settings-disclosure-head",children:[c.jsxs("div",{className:"backend-api-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),c.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."})]}),c.jsx("div",{className:"settings-disclosure-actions",children:c.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(u=>!u),children:t?"Hide":"Show"})})]})}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?c.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(u=>c.jsx(jZ,{group:u},u.category)):null,e.state&&i.length===0?c.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,c.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 jZ({group:e}){return c.jsxs("div",{className:"backend-api-group",children:[c.jsxs("div",{className:"backend-api-group-head",children:[c.jsx("span",{children:e.category}),c.jsx("span",{children:e.entries.length})]}),c.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>c.jsx(OZ,{entry:t},`${t.method}:${t.path}`))})]})}function OZ({entry:e}){return c.jsxs("div",{className:"backend-api-row",children:[c.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),c.jsx("code",{className:"backend-api-path",children:e.path}),c.jsx("span",{className:"backend-api-summary",children:e.summary}),c.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function DZ(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 IZ=[{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)"]}],BZ=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],$Z=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],PZ=1024,zZ=65535,XE=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function HZ(){const e=k1(),t=e.state,n=e.savingField!==null,[i,r]=y.useState("general"),o=_s(),u=pc(),d=yc(),f=WZ(d.plugins),p=qZ(f),m=_=>{r(_),u({pathname:"/settings",search:_==="general"?"":`?section=${encodeURIComponent(_)}`})};return y.useEffect(()=>{const _=new AbortController;return ZX(_.signal),()=>_.abort()},[]),y.useEffect(()=>{const _=new URLSearchParams(o.search).get("section"),b=new Set([...XE.map(w=>w.id),...f.map(w=>w.id)]),S=_&&b.has(_)?_:"general";r(S),_&&_!==S&&u({pathname:"/settings",search:""},{replace:!0})},[o.search,u,f]),c.jsxs("main",{className:"global-settings-page",children:[c.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[c.jsxs("div",{children:[c.jsx("p",{className:"bridge-kicker",children:"Console"}),c.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),c.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,c.jsxs("section",{className:"global-settings-grid",children:[c.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[c.jsx("p",{className:"global-settings-nav-group",children:"Console"}),XE.map(_=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${_.id===i?"is-active":""}`,"aria-pressed":_.id===i,onClick:()=>m(_.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:_.label}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:_.eyebrow})]},_.id)),f.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),p.map(_=>c.jsxs("div",{className:"global-settings-plugin-group",children:[c.jsx("p",{className:"global-settings-plugin-heading",children:_.pluginLabel}),_.sections.map(b=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>m(b.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},_.pluginId))]}):null]}),c.jsx("div",{className:"global-settings-detail",children:UZ(i,t,n,f)},i)]})]})}function FZ({render:e}){return c.jsx(c.Fragment,{children:e()})}function UZ(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?c.jsx(Kf,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:c.jsx(FZ,{render:r.render})}):c.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return c.jsxs(c.Fragment,{children:[c.jsx(KZ,{state:t,saving:n}),c.jsx(VZ,{state:t,saving:n}),c.jsx(YZ,{state:t,saving:n})]});case"backend-api":return c.jsx(MZ,{})}}function WZ(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:GZ(t.id),sectionTitle:n.title,render:n.render})))}function qZ(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 GZ(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function KZ({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(Ep().savingField!==null)return;const o=n;ac(r),qo("theme",r).then(u=>{u||ac(o)})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),c.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),c.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:IZ.map(r=>{const o=r.id===n;return c.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[c.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(u=>c.jsx("i",{style:{background:u}},u))}),c.jsx("span",{className:"theme-card-label",children:r.label}),c.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?c.jsx(JZ,{}):null})]},r.id)})})]}),c.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function VZ({state:e,saving:t}){const n=e?.uiFont??Ju,[i,r]=y.useState([]),[o,u]=y.useState(!0),[d,f]=y.useState(null);y.useEffect(()=>{const _=new AbortController;return uA({signal:_.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),f(null)}).catch(b=>{_.signal.aborted||(r([]),f(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{_.signal.aborted||u(!1)}),()=>_.abort()},[]);const p=_=>{if(Ep().savingField!==null)return;const b=n;ny(_),qo("uiFont",_).then(S=>{S||ny(b)})},m=_=>{const b=_.source==="builtin"?{source:"builtin",id:_.id,size:n.size}:{source:"system",familyName:_.familyName,size:n.size};p(b)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),c.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),c.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===Yl.defaultValue,onClick:()=>p(Ju),children:"Reset to Fleet default"})]}),c.jsx(lA,{builtIns:ep.map(({id:_,label:b,family:S,aliases:w,description:x})=>({id:_,label:b,family:S,aliases:w,description:x})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:wT(Ju),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:Yl,loading:o,error:d,disabled:!e||t,onSelectionChange:m,onSizeCommit:_=>p({...n,size:_})}),c.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function YZ({state:e,saving:t}){const n=Qs();return c.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?c.jsxs(c.Fragment,{children:[c.jsx(ZZ,{state:e,saving:t,consoleState:n}),c.jsx(XZ,{state:e,saving:t})]}):c.jsx("p",{className:"global-settings-help",children:"Loading settings."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function XZ({state:e,saving:t}){return c.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),c.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),c.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:$Z.map(n=>{const i=e.language===n.id;return c.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{qo("language",n.id)},children:n.label},n.id)})}),c.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function ZZ({state:e,saving:t,consoleState:n}){const[i,r]=y.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,u=n.portMode==="static"&&!n.portHonored,d=n.requestedPort,f=e.consolePortMode==="static"&&e.consoleStaticPort!==null,p=i.trim(),m=Number(p),_=p.length>0,b=_&&ZE(m),S=e.consolePortMode==="static"&&_&&!b;return y.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),c.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.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."})]}),c.jsxs("div",{className:"console-port-control",children:[c.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:BZ.map(w=>{const x=e.consolePortMode===w.id;return c.jsx("button",{type:"button","aria-pressed":x,className:`segmented-option ${x?"is-active":""}`,disabled:t,onClick:()=>{qo("consolePortMode",w.id)},children:w.label},w.id)})}),c.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:c.jsxs("div",{className:"console-port-reveal-inner",children:[c.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),c.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const x=w.target.value;r(x);const k=Number(x.trim());ZE(k)&&qo("consoleStaticPort",k)}}),c.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${S?"is-invalid":""}`,children:"1024–65535"})]})}),c.jsxs("div",{className:`console-port-effective ${u?"is-fallback":""}`,"aria-live":"polite",children:[c.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),c.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",c.jsx("span",{children:o||"..."}),u?" · Dynamic":""]})]})]}),u&&d?c.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",c.jsx("strong",{children:d})," was unavailable — the console fell back to a ",c.jsx("strong",{children:"Dynamic"})," port and is running on ",c.jsxs("strong",{children:["127.0.0.1:",o||"..."]}),"."," ",f?c.jsxs(c.Fragment,{children:["Next restart will try ",c.jsx("strong",{children:e.consoleStaticPort}),"."]}):c.jsx(c.Fragment,{children:"Next restart will use a dynamic port."})]}):null,c.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function ZE(e){return Number.isInteger(e)&&e>=PZ&&e<=zZ}function JZ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 QZ(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function yh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function eJ(e,t){return{...QZ(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const tJ=600,JE=360,QE="cubic-bezier(0.4, 0.14, 0.2, 1)";function iM(e){if(typeof document>"u"||Ip())return;const t=sM(e);if(!Ap(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=rM(e);Ap(i)&&aM(n,i.getBoundingClientRect(),()=>nJ(i))})}function Tp(e){if(typeof document>"u"||Ip())return;const t=rM(e);if(!Ap(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=sM(e);Ap(i)&&aM(n,i.getBoundingClientRect())})}function sM(e){return document.querySelector(`.canvas-operation[data-operation-id="${T1(e)}"]`)}function rM(e){return document.querySelector(`[data-side-bar-chip-id="${T1(e)}"]`)}function Ap(e){if(!e)return!1;const t=e.getBoundingClientRect();return t.width<=0||t.height<=0?!1:getComputedStyle(e).visibility!=="hidden"}function T1(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function aM(e,t,n){if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return;const i=document.createElement("div");if(i.className="panel-motion-ghost",i.setAttribute("aria-hidden","true"),i.style.left=`${e.left}px`,i.style.top=`${e.top}px`,i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,typeof i.animate!="function")return;document.body.appendChild(i);const{duration:r,easing:o}=iJ();let u=!1,d=null;const f=m=>{u||(u=!0,d!==null&&window.clearTimeout(d),i.remove(),m&&n?.())};let p;try{p=i.animate([{transform:"translate(0, 0) scale(1, 1)",opacity:.9},{transform:`translate(${t.left-e.left}px, ${t.top-e.top}px) scale(${t.width/e.width}, ${t.height/e.height})`,opacity:0}],{duration:r,easing:o})}catch{f(!1);return}d=window.setTimeout(()=>f(!0),r+120),p.onfinish=()=>f(!0),p.oncancel=()=>f(!1)}function nJ(e){e.classList.add("is-arrival-pulse"),window.setTimeout(()=>e.classList.remove("is-arrival-pulse"),tJ)}function iJ(){try{const e=getComputedStyle(document.documentElement);return{duration:sJ(e.getPropertyValue("--duration-slow"))??JE,easing:e.getPropertyValue("--ease-glide").trim()||QE}}catch{return{duration:JE,easing:QE}}}function sJ(e){const t=e.trim(),n=/^(\d+(?:\.\d+)?)(ms|s)$/.exec(t);if(!n)return null;const i=Number.parseFloat(n[1]);return n[2]==="s"?i*1e3:i}const e5=256,t5=176,wv=12,vf=220,oM="fleet-console.map.radarCollapsed";function rJ({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:r,onJump:o}){const u=y.useRef(null),d=y.useRef(!1),f=y.useRef(null),[p,m]=y.useState(aJ),_=Op();if(y.useEffect(()=>{if(_){f.current===null&&(f.current=p,m(!0));return}f.current!==null&&(m(f.current),f.current=null)},[p,_]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([E,$])=>({id:E,x:$.x,y:$.y,width:$.width,height:$.height})),...Object.entries(t).map(([E,$])=>({id:E,x:$.geometry.x,y:$.geometry.y,width:$.geometry.width,height:$.geometry.height}))];if(b.length===0)return null;const S=()=>{m(E=>{const $=!E;return _||oJ($),$})};if(p)return c.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:c.jsx(cJ,{})});const w=e5-wv*2,x=t5-wv*2,k={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let O=Math.min(k.x,...b.map(E=>E.x)),P=Math.min(k.y,...b.map(E=>E.y)),F=Math.max(k.x+k.width,...b.map(E=>E.x+E.width)),T=Math.max(k.y+k.height,...b.map(E=>E.y+E.height));O-=vf,P-=vf,F+=vf,T+=vf;const L=F-O,M=T-P,z=Math.min(w/L,x/M),U=(w-L*z)/2,Z=(x-M*z)/2,Q=E=>U+(E-O)*z,G=E=>Z+(E-P)*z,B=E=>{const $=u.current?.getBoundingClientRect();if(!$)return;const j=E.clientX-$.left,q=E.clientY-$.top;o({x:O+(j-U)/z,y:P+(q-Z)/z})},R=E=>{E.stopPropagation(),d.current=!0,E.currentTarget.setPointerCapture(E.pointerId),B(E)},D=E=>{d.current&&(E.stopPropagation(),B(E))},N=E=>{d.current=!1;try{E.currentTarget.releasePointerCapture(E.pointerId)}catch{}};return c.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:e5,height:t5},children:[c.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),c.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:c.jsx(lJ,{})}),c.jsxs("div",{ref:u,className:"canvas-minimap-inner",style:{inset:wv},onPointerDown:R,onPointerMove:D,onPointerUp:N,onPointerCancel:N,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(E=>c.jsx("div",{className:"canvas-minimap-operation",style:{left:Q(E.x),top:G(E.y),width:Math.max(2,E.width*z),height:Math.max(2,E.height*z),...n?.[E.id]?{"--user-accent":n[E.id]}:{}}},E.id)),c.jsx("div",{className:"canvas-minimap-view",style:{left:Q(k.x),top:G(k.y),width:k.width*z,height:k.height*z}})]})]})}function aJ(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(oM)==="true"}catch{return!1}}function oJ(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oM,String(e))}catch{}}function lJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 cJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),c.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function uJ({viewport:e}){return c.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[c.jsx("div",{className:"operations-canvas-sea"}),c.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 hJ=["n","ne","e","se","s","sw","w","nw"],xv=320,Cv=200,dJ=1500;function fJ({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:u=!1,renderHidden:d=!1,focusLayerTarget:f=!1,topEdge:p=!1,interactionDisabled:m=!1,accentKey:_=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:k,onRename:O,onSetAccent:P,onGeometryChange:F,onGeometryCommit:T,onRenderHiddenFocus:L}){const M=y.useRef(null),z=y.useRef(null),U=y.useRef(null),Z=y.useRef(null),Q=y.useRef(null),G=y.useRef(n),B=y.useRef(!1),[R,D]=y.useState(null),[N,E]=y.useState(!1),[$,j]=y.useState(!1),q=e.title,H=S0({currentTitle:e.title,onBegin:()=>{he()},onCommit:Se=>{O(Se),B.current=!0}}),A=_?Ka(_):null,Y=["canvas-operation",t?"is-active":"",o?"is-minimized":"",u?"is-maximized":"",p?"is-top-edge":"",$?"is-dragging":"",mJ(r)].filter(Boolean).join(" ");y.useEffect(()=>()=>{Q.current!==null&&window.clearTimeout(Q.current)},[]),y.useEffect(()=>{if(H.renaming||!B.current)return;B.current=!1;const Se=window.requestAnimationFrame(()=>z.current?.focus());return()=>window.cancelAnimationFrame(Se)},[H.renaming]),y.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const Se=R!==null;Se&&D(null),(Se||M.current?.contains(document.activeElement))&&L?.()},[R,d,L]);const J=()=>{Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null)},he=()=>{J(),E(!1)},de=()=>{J(),E(!0),Q.current=window.setTimeout(()=>{Q.current=null,E(!1)},dJ)};y.useEffect(()=>{!u&&!m&&!o||(U.current=null,Z.current=null,j(!1))},[u,m,o]);const ae=()=>{!U.current&&!Z.current||(U.current=null,Z.current=null,j(!1))},we=Se=>{he(),!(u||m)&&Se.button===0&&(Se.preventDefault(),Se.stopPropagation(),S(),U.current={pointerId:Se.pointerId,startX:Se.clientX,startY:Se.clientY,geometry:n,latest:n},j(!0),Se.currentTarget.setPointerCapture(Se.pointerId))},je=Se=>{if(u||m)return;const Qe=U.current;if(!Qe||Qe.pointerId!==Se.pointerId)return;Se.preventDefault(),Se.stopPropagation();const Ne={...Qe.geometry,x:Qe.geometry.x+(Se.clientX-Qe.startX)/i,y:Qe.geometry.y+(Se.clientY-Qe.startY)/i};Qe.latest=Ne,F(Ne)},De=Se=>{if(u||m){U.current=null,j(!1);return}const Qe=U.current;!Qe||Qe.pointerId!==Se.pointerId||(Se.preventDefault(),Se.stopPropagation(),U.current=null,j(!1),Se.currentTarget.releasePointerCapture(Se.pointerId),T(Qe.latest))},We=(Se,Qe)=>{u||m||(Qe.preventDefault(),Qe.stopPropagation(),S(),Z.current={direction:Se,pointerId:Qe.pointerId,startX:Qe.clientX,startY:Qe.clientY,geometry:n,latest:n},j(!0),Qe.currentTarget.setPointerCapture(Qe.pointerId))},ke=Se=>{if(u||m)return;const Qe=Z.current;if(!Qe||Qe.pointerId!==Se.pointerId)return;Se.preventDefault(),Se.stopPropagation();const Ne=pJ(Qe.geometry,Qe.direction,(Se.clientX-Qe.startX)/i,(Se.clientY-Qe.startY)/i);Qe.latest=Ne,F(Ne)},Le=Se=>{if(u||m){Z.current=null,j(!1);return}const Qe=Z.current;!Qe||Qe.pointerId!==Se.pointerId||(Se.preventDefault(),Se.stopPropagation(),Z.current=null,j(!1),Se.currentTarget.releasePointerCapture(Se.pointerId),T(Qe.latest))},Ae=Se=>{Se.stopPropagation()},Me=Se=>{Se.stopPropagation(),he()},et=Se=>{Se.stopPropagation(),S()},dt=Se=>{Se.stopPropagation()},Je=()=>{he();const Se=typeof document<"u"?document.activeElement:null;Se instanceof HTMLElement&&M.current?.contains(Se)&&Se.blur(),x()},oe=()=>{he(),k?.()},qe=Se=>{he(),S(),D(Se)},Ye=Se=>{Se.stopPropagation(),he(),S()},Mt=()=>{if(!N){de();return}he(),w()},Wt=Se=>{Se.stopPropagation(),H.begin()},hn=Se=>{Se.key!=="Enter"&&Se.key!=="F2"||(Se.preventDefault(),Se.stopPropagation(),H.begin())},ct=Se=>{Se.key==="Escape"&&(B.current=!0),H.handleKeyDown(Se)};o||(G.current=n);const Yt=o?G.current:n,bt={left:Math.round(Yt.x),top:Math.round(Yt.y),width:Math.round(Yt.width),height:Math.round(Yt.height),zIndex:Yt.zIndex,...d?{visibility:"hidden",pointerEvents:"none"}:{},...A?{"--user-accent":A}:{}};return c.jsxs("article",{ref:M,className:Y,style:bt,onPointerDown:S,"data-canvas-operation":!0,"data-operation-id":e.id,"data-focus-layer-target":f?"true":void 0,"aria-label":`Operation ${q}`,"aria-hidden":d||void 0,tabIndex:f?-1:void 0,inert:o||d?!0:void 0,children:[A?c.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!u&&!m?c.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:we,onPointerMove:je,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:ae,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,c.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:we,onPointerMove:je,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:ae,"data-canvas-blocker":!0,children:[A?c.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,H.renaming?c.jsx("input",{ref:H.inputRef,className:"canvas-operation-identity-input",value:H.draftTitle,"aria-label":`Rename operation ${q}`,onChange:Se=>H.setDraftTitle(Se.target.value),onKeyDown:ct,onBlur:H.handleBlur,onPointerDown:Me}):c.jsx("button",{ref:z,type:"button",className:"canvas-operation-identity-name",onPointerDown:Me,onDoubleClick:Wt,onKeyDown:hn,"aria-label":`Rename operation ${q}`,title:`${q} — Double-click, Enter, or F2 to rename`,children:q}),P?c.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:Ae,onClick:Se=>qe(Se.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${q}`,"aria-haspopup":"menu",title:"Set accent",children:c.jsx("span",{className:n5(r),"aria-hidden":"true"})}):c.jsx("span",{className:n5(r),onPointerDown:Ye,"aria-hidden":"true"}),c.jsxs("div",{className:"canvas-operation-window-controls",children:[c.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:Ae,onClick:Je,"aria-label":`Minimize operation ${q}`,title:"Minimize operation",children:c.jsx(gJ,{})}),k?c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${u?"is-active":""}`,onPointerDown:Ae,onClick:oe,"aria-label":u?`Restore operation ${q}`:`Maximize operation ${q}`,"aria-pressed":u,title:u?"Restore operation":"Maximize operation",children:u?c.jsx(vJ,{}):c.jsx(_J,{})}):null,c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${N?"is-armed-close":""}`,onPointerDown:Ae,onClick:Mt,"aria-label":N?`Confirm close operation ${q}`:`Close operation ${q}`,title:N?"Confirm close":"Close operation",children:N?"Close?":c.jsx(yJ,{})})]})]}),c.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:q}),c.jsx("div",{className:"canvas-operation-terminal",onPointerDown:et,onWheel:dt,"data-canvas-blocker":!0,children:b}),!u&&!m&&hJ.map(Se=>c.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${Se}`,onPointerDown:Qe=>We(Se,Qe),onPointerMove:ke,onPointerUp:Le,onPointerCancel:Le,onLostPointerCapture:ae,"data-canvas-blocker":!0,"aria-hidden":"true"},Se)),R&&P?c.jsx(TI,{anchor:R,accentKey:_,onSelect:P,onClose:()=>D(null)}):null]})}function pJ(e,t,n,i){let{x:r,y:o,width:u,height:d}=e;return t.includes("e")&&(u+=n),t.includes("s")&&(d+=i),t.includes("w")&&(r+=n,u-=n),t.includes("n")&&(o+=i,d-=i),u<xv&&(t.includes("w")&&(r-=xv-u),u=xv),d<Cv&&(t.includes("n")&&(o-=Cv-d),d=Cv),{...e,x:r,y:o,width:u,height:d}}function mJ(e){const t=Pp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function n5(e){const t=Pp(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 gJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function _J(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 vJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 yJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 bJ({rect:e,viewport:t}){const n=eJ(e,t);return c.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const SJ=.25,wJ=2,xJ=200,CJ=150,i5=5,kJ=.0018;function EJ({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:u,onClick:d}){const f=y.useRef(null),p=y.useRef(e),[m,_]=y.useState(null),[b,S]=y.useState(!1),[w,x]=y.useState(!1);y.useEffect(()=>{p.current=e},[e]),y.useEffect(()=>{const M=U=>{U.key==="Shift"&&x(!0),!TJ(U.target)&&U.code==="Space"&&(U.preventDefault(),S(!0))},z=U=>{U.key==="Shift"&&x(!1),U.code==="Space"&&S(!1)};return window.addEventListener("keydown",M),window.addEventListener("keyup",z),()=>{window.removeEventListener("keydown",M),window.removeEventListener("keyup",z)}},[]);const k=M=>{if(t||s5(M.target)||M.button!==0&&M.button!==1)return;if(M.preventDefault(),n){u?.();return}const z=Ev(M),U=M.shiftKey&&M.button===0&&!b?"create":"pan";f.current={pointerId:M.pointerId,mode:U,startScreen:z,currentScreen:z,startViewport:p.current},M.currentTarget.setPointerCapture(M.pointerId),U==="create"&&_(kv(z,z,p.current))},O=M=>{const z=f.current;if(!z||z.pointerId!==M.pointerId)return;M.preventDefault();const U=Ev(M);if(f.current={...z,currentScreen:U},z.mode==="pan"){i({...z.startViewport,x:z.startViewport.x+U.x-z.startScreen.x,y:z.startViewport.y+U.y-z.startScreen.y});return}_(kv(z.startScreen,U,p.current))},P=M=>{L(M,!0)},F=M=>{L(M,!1)},T=M=>{if(t||s5(M.target))return;M.preventDefault();const z=Ev(M),U=p.current,Z=AJ(U.zoom*Math.exp(-M.deltaY*kJ),SJ,wJ),Q=yh(z,U);r({x:z.x-Q.x*Z,y:z.y-Q.y*Z,zoom:Z})},L=(M,z)=>{const U=f.current;if(!U||U.pointerId!==M.pointerId||(f.current=null,M.currentTarget.releasePointerCapture(M.pointerId),_(null),!z))return;const Z=Math.abs(U.currentScreen.x-U.startScreen.x),Q=Math.abs(U.currentScreen.y-U.startScreen.y);if(Z<i5&&Q<i5){d?.();return}if(U.mode!=="create")return;const G=kv(U.startScreen,U.currentScreen,p.current),B={x:G.x,y:G.y,width:Math.max(G.width,xJ),height:Math.max(G.height,CJ)};o(B,U.currentScreen)};return{rubberBand:m,spaceActive:b,shiftActive:w,onPointerDown:k,onPointerMove:O,onPointerUp:P,onPointerCancel:F,onWheel:T}}function kv(e,t,n){const i=yh(e,n),r=yh(t,n),o=Math.min(i.x,r.x),u=Math.min(i.y,r.y);return{x:o,y:u,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function Ev(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function s5(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function TJ(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function AJ(e,t,n){return Math.min(n,Math.max(t,e))}const RJ="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",NJ=560,LJ=360,MJ=12;function jJ({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:u,onFocus:d,onRename:f,onSetAccent:p}){const m=y.useRef(null),_=s0(),b=rT(),S=Op(),w=iT(),x=sT(),k=LO(x),O=y.useRef(null),P=aT(),F=e.activeOperationId,[T,L]=y.useState(null),M=yc(),[z,U]=y.useState({width:0,height:0}),Z=PJ(),Q=!e.activeTheaterId||e.addingTheater;y.useEffect(()=>{const oe=m.current;if(!oe||typeof ResizeObserver>"u")return;const qe=()=>U({width:oe.clientWidth,height:oe.clientHeight});qe();const Ye=new ResizeObserver(qe);return Ye.observe(oe),()=>Ye.disconnect()},[]);const G=EJ({viewport:_.viewport,disabled:Q||S||x!==null,onViewportChange:Xv,onZoom:lT,onCreate:oe=>{if(L(null),e.activeTheaterId&&n){const qe=zJ(t);if(!qe)return;const Ye={...IJ(oe),zIndex:Po()};o(qe.pluginId,qe.kind,Ye)}},consumePointerDown:T!==null,onConsumePointerDown:()=>{L(null)},onClick:DJ}),B=(oe,qe)=>{const Ye=T?.canvasPoint;L(null),Ye&&r(oe,qe,Ye)},R=oe=>{if(oe.target instanceof Element&&oe.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;oe.preventDefault();const qe=m.current?.getBoundingClientRect();if(!qe)return;const Ye={x:oe.clientX-qe.left,y:oe.clientY-qe.top};L({anchor:Ye,canvasPoint:yh(Ye,_.viewport)})},D=new Set(P);y.useEffect(()=>{e.activeOperationId&&D.has(e.activeOperationId)&&Di(null)},[P,e.activeOperationId]);const N=Object.fromEntries(Object.entries(_.operations).filter(([oe])=>!D.has(oe))),E=(e.operations??[]).filter(oe=>oe.theaterId===e.activeTheaterId),$=M.operationKinds,q=w!==null&&E.some(oe=>oe.id===w&&!D.has(oe.id))?w:null,H=x===null?void 0:E.find(oe=>oe.id===x&&!D.has(oe.id)),A=H?$.find(oe=>oe.pluginId===H.pluginId&&oe.type===H.type):void 0;x===null&&(O.current=null),H&&A?.companions?.length&&(O.current={operation:H,descriptor:A});const Y=!H&&O.current?.operation.id===x?O.current:null,J=H??Y?.operation,de=(A??Y?.descriptor)?.companions??[],ae=de.filter(oe=>k[oe.id]??!oe.defaultHidden),we=de.filter(oe=>!ae.includes(oe)).map(oe=>oe.id),je=J&&de.length>0?J.id:null,De=H&&A?.companions?.length?H.id:null,We=J&&!E.some(oe=>oe.id===J.id)?[...E,J]:E,ke=We.length>0;y.useEffect(()=>{if(x===null||De!==null)return;const oe=setTimeout(()=>{O.current=null,Zs()},1500);return()=>clearTimeout(oe)},[x,De]);const Le=m0(E,e.groups.filter(oe=>oe.theaterId===e.activeTheaterId),_.operationOrder,[]).filter(oe=>!D.has(oe.id)).map(oe=>oe.id),Ae=S?DO({x:0,y:0,width:z.width,height:z.height},Le.length,void 0,void 0,void 0,void 0,b):[],Me=new Map(Le.map((oe,qe)=>[oe,Ae[qe]]));y.useEffect(()=>{if(!S||Ip())return;const oe=m.current;if(!oe)return;const qe=Le.map(Wt=>oe.querySelector(`.canvas-operation[data-operation-id="${T1(Wt)}"]`)).filter(Wt=>Wt!==null);qe.forEach((Wt,hn)=>{Wt.style.setProperty("--panel-stagger-delay",`${hn*40}ms`)});const Ye=()=>{for(const Wt of qe)Wt.style.removeProperty("--panel-stagger-delay")},Mt=window.setTimeout(Ye,600+qe.length*40);return()=>{window.clearTimeout(Mt),Ye()}},[S,b]);const et=q||je||S?1:_.viewport.zoom,dt=$J(_.operations)+1,Je=ae.length+1;return c.jsxs("main",{className:`operations-canvas ${G.spaceActive?"is-panning":""} ${G.shiftActive?"is-creating":""} ${Z?"is-glance":""} ${q?"is-panel-maximized":""} ${je?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:G.onPointerDown,onPointerMove:G.onPointerMove,onPointerUp:G.onPointerUp,onPointerCancel:G.onPointerCancel,onWheel:G.onWheel,onContextMenu:R,ref:m,tabIndex:-1,children:[c.jsx(uJ,{viewport:_.viewport}),c.jsx("div",{style:{transform:q||je||S?"none":`translate(${Math.round(_.viewport.x)}px, ${Math.round(_.viewport.y)}px) scale(${_.viewport.zoom})`},className:"operations-canvas-world",children:We.map(oe=>{const qe=_.operations[oe.id]??oe.geometry??Tv(oe),Ye=q===oe.id,Mt=je===oe.id,Wt=(q!==null||je!==null)&&!Ye&&!Mt,hn=Me.get(oe.id),ct=Ye?BJ(z,dt):Mt?r5(z,0,Je,dt):hn?{...qe,...hn}:qe,Yt=!Ye&&!Mt&&!hn&&_.viewport.y+ct.y*et<MJ*et;return HJ(oe,{active:F===oe.id,keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===oe.id?e.keyboardFocusRequest.requestId:0,geometry:ct,topEdge:Yt,operationKindRegistry:$,status:e.operationStatus[oe.id],theme:e.activeTheme,viewportZoom:et,minimized:D.has(oe.id),maximized:Ye,companion:Mt,companions:Mt?ae:[],companionGeometries:Mt?ae.map((bt,Se)=>r5(z,Se+1,Je,dt)):[],hiddenCompanionPanelIds:Mt?we:[],formation:S,focusLayerHidden:Wt,onRenderHiddenFocus:()=>{const bt=m.current?.querySelector("[data-focus-layer-target='true']");if(bt){bt.focus();return}m.current?.focus()},accentKey:_.operationAccent[oe.id]??o5(oe),onActivate:()=>{Di(oe.id),!Ye&&!Mt&&!S&&Zv(oe.id,_.operations[oe.id]??oe.geometry??Tv(oe))},onClose:()=>{e.activeOperationId===oe.id&&Di(null),q===oe.id&&Ga(),je===oe.id&&Zs(),u(oe.id)},onMinimize:()=>{e.activeOperationId===oe.id&&Di(null),iM(oe.id),cT(oe.id)},onMaximize:()=>{Ye?Ga():(Di(oe.id),r0(oe.id))},onRename:bt=>{f(oe.id,bt)},onSetAccent:bt=>{p(oe.id,bt)},onGeometryChange:bt=>{!Ye&&!Mt&&!S&&Zv(oe.id,bt)},onGeometryCommit:bt=>{!Ye&&!Mt&&!S&&UJ(oe.id,hr().operations[oe.id]??bt)}})})}),ke?null:c.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[c.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),c.jsx("p",{children:e.activeTheaterId?RJ:"Add a Theater from the top bar to start operations."})]}),G.rubberBand?c.jsx(bJ,{rect:G.rubberBand,viewport:_.viewport}):null,T?c.jsx($T,{anchor:T.anchor,viewportBounds:OJ(m.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:B,onClose:()=>L(null)},`${T.anchor.x}:${T.anchor.y}`):null,c.jsx(rJ,{operations:N,pluginOperations:Object.fromEntries(E.filter(oe=>!D.has(oe.id)).map(oe=>[oe.id,{theaterId:oe.theaterId,geometry:_.operations[oe.id]??oe.geometry??Tv(oe)}])),accents:Object.fromEntries(E.flatMap(oe=>{const qe=_.operationAccent[oe.id]??o5(oe),Ye=qe?Ka(qe):null;return Ye?[[oe.id,Ye]]:[]})),viewport:_.viewport,canvasSize:z,onJump:oe=>Xv({x:z.width/2-oe.x*_.viewport.zoom,y:z.height/2-oe.y*_.viewport.zoom,zoom:_.viewport.zoom})})]})}function OJ(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function DJ(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Di(null)}function IJ(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Tv(e){return e.geometry??{x:0,y:0,width:NJ,height:LJ,zIndex:0}}function BJ(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function r5(e,t,n,i){const r=Math.max(1,n),o=8,u=Math.max(0,(e.width-o*(r-1))/r);return{x:t*(u+o),y:0,width:u,height:Math.max(0,e.height),zIndex:i}}function $J(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function PJ(){const[e,t]=y.useState(!1),n=y.useRef(new Set);return y.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=d=>{!a5(d)||d.repeat||d.ctrlKey||d.metaKey||nM()||(n.current.add(d.code),t(!0))},o=d=>{a5(d)&&(n.current.delete(d.code),t(n.current.size>0))},u=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",u)}},[]),e}function a5(e){return e.code==="AltLeft"||e.code==="AltRight"}function zJ(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 o5(e){return typeof e.accent=="string"?e.accent:null}function HJ(e,t){const n=t.operationKindRegistry.find(d=>d.pluginId===e.pluginId&&d.type===e.type),i=t.geometry;if(!n?.render)return null;const r=im(()=>{Ji(null).then(fs).catch(()=>{})}),o=d=>{d?(Di(e.id),uT(e.id)):HO()},u=(d,f)=>{MO(e.id,d,f)};return c.jsxs(y.Fragment,{children:[c.jsx(fJ,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:c.jsx(Kf,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:c.jsx(l5,{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:n.render})})}),t.companions.map((d,f)=>c.jsx(FJ,{descriptor:d,geometry:t.companionGeometries[f],children:c.jsx(Kf,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:c.jsx(l5,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:d.render})})},d.id))]},e.id)}function l5({active:e,keyboardFocusRequestId:t,capabilities:n,geometry:i,operation:r,theme:o,viewportZoom:u,onActivate:d,onClose:f,onGeometryChange:p,onRequestCompanions:m,companionsOpen:_,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S,render:w}){return w({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:i,active:e,...t===void 0?{}:{keyboardFocusRequestId:t},zoom:u,theme:o,api:n.api,lifecycle:n.lifecycle,terminal:n.terminal,notifications:n.notifications,operations:n.operations,preferences:n.preferences,settings:n.settings,status:n.status,onActivate:d,onClose:f,onGeometryChange:p,onRequestCompanions:m,companionsOpen:_,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S})}function FJ({descriptor:e,geometry:t,children:n}){const i={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return c.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:i,"data-canvas-operation":!0,"aria-label":`Companion ${e.title}`,children:[e.hideCaption?null:c.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[c.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),c.jsx("span",{className:"canvas-companion-caption-title",children:e.title})]}),c.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:r=>r.stopPropagation(),onWheel:r=>r.stopPropagation(),"data-canvas-blocker":!0,children:n})]})}async function UJ(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function lM(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 cM(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function uM(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 Ib(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 hM(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const WJ={ended:"Ended","input-waiting":"Waiting for input"},qJ={id:"alerts",title:"Alerts",icon:()=>c.jsx(KJ,{}),render:()=>c.jsx(GJ,{})};function GJ(){const e=Qs(),t=pc(),[n,i]=y.useState(!1),r=y.useMemo(()=>cM(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=lM(e),u=uM(r,o).hidden,d=hM(u,e.notificationPreferences),f=Ib(d),p=Ib(u),m=Bb(f,"input-waiting"),_=Bb(f,"ended"),b=f.length===0,S=y.useCallback(w=>{oc(w.operationId),t("/operations")},[t]);return c.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[c.jsxs("div",{className:"alerts-panel-toolbar",children:[c.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[m>0?c.jsx("span",{className:"notification-tally is-input-waiting",children:m}):null,_>0?c.jsx("span",{className:"notification-tally is-ended",children:_}):null,b?c.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),c.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:c.jsx(ZJ,{})})]}),n?c.jsx(VJ,{groups:p}):null,b?c.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):c.jsx("div",{className:"notification-dock-deck",children:f.map(w=>c.jsxs("section",{className:"notification-cluster-group",children:[c.jsxs("header",{className:"notification-cluster-group-head",children:[c.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),c.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),c.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(x=>c.jsxs("li",{className:`notification-row is-${x.kind}`,children:[c.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),c.jsxs("span",{className:"notification-row-body",children:[c.jsx("span",{className:"notification-row-op",children:x.operationLabel}),c.jsx("span",{className:"notification-row-state",children:WJ[x.kind]})]}),c.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 KJ(){const e=Qs();aA();const t=y.useMemo(()=>cM(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=lM(e),i=uM(t,n).hidden,r=hM(i,e.notificationPreferences),o=Ib(r),u=o.reduce((p,m)=>p+m.notifications.length,0),d=Bb(o,"input-waiting"),f=u===0?"muted":d>0?"awaiting":"ended";return c.jsxs("span",{className:`alerts-icon is-${f}`,"aria-hidden":"true",children:[c.jsx(XJ,{}),u>0?c.jsx("span",{className:"alerts-icon-badge",children:u}):null]})}function VJ({groups:e}){const t=Qs(),n=YJ(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return c.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>VD(i.currentTarget.checked)}),c.jsx("span",{children:"Mute all"})]}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>YD(i.currentTarget.checked)}),c.jsx("span",{children:"Do not disturb"})]}),n.length>0?c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&XD(i.theaterId)}}),c.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function YJ(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 Bb(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function XJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[c.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"}),c.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function ZJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[c.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"}),c.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class A1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function JJ(e,t){const i=new URLSearchParams().toString();return Za(Vn(e,`/search${i?`?${i}`:""}`))}async function QJ(e,t,n){return Za(Vn(e,`/entry/${encodeURIComponent(t)}`))}async function dM(e,t="pending"){return Za(Vn(e,`/drydock?status=${encodeURIComponent(t)}`))}async function eQ(e,t){return Za(Vn(e,`/drydock/${encodeURIComponent(t)}`))}async function tQ(e){return Za(Vn(e,"/schema"))}async function nQ(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Za(Vn(e,n))}async function iQ(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),pQ(Vn(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function sQ(e){return Za(Vn(e,"/conflicts"))}async function rQ(e,t){return Za(Vn(e,`/conflicts/${encodeURIComponent(t)}`))}async function aQ(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),fM(Vn(e,`/cowork/options?${i}`))}async function c5(e,t,n){return Ja(Vn(e,"/cowork/sessions"),{entryId:t,...n})}async function oQ(e,t){try{return await fM(Vn(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof A1&&n.status===404)return null;throw n}}async function Av(e,t,n){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function lQ(e,t,n){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function u5(e,t,n){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function cQ(e,t,n){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function uQ(e,t){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function hQ(e,t,n){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function dQ(e,t){return Ja(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function fQ(e,t,n,i){const r=new EventSource(`${Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=u=>{try{const d=JSON.parse(u.data);if(!mQ(d))return;i(d,Number(u.lastEventId)||0)}catch{}};for(const u of["session","transcript","tool","done","error"])r.addEventListener(u,o);return()=>r.close()}function Vn(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function Za(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await mM(e,t));return t.json()}async function pQ(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 mM(e,n));return n.json()}async function fM(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await pM(t);return t.json()}async function Ja(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await pM(n);return n.json()}async function pM(e){const t=await e.json().catch(()=>null);return new A1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function mQ(e){if(!e||typeof e!="object")return!1;const t=e;return["session","transcript","tool","done","error"].includes(t.type??"")&&(t.session===void 0||t.session!==null&&typeof t.session=="object")}async function mM(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const $b=new Set;let zf=0;const nc={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function zl(){return nc}function gM(e){return $b.add(e),()=>$b.delete(e)}function h5(e){zf+=1,Hf({currentWorkspaceId:e,schemaCatalog:null})}async function Rp(){const e=nc.currentWorkspaceId,t=zf;Hf({loading:!0,error:null});try{const[n,i,r]=await Promise.all([JJ(e),dM(e,"pending").catch(()=>null),tQ(e).catch(()=>null)]);if(nc.currentWorkspaceId!==e||zf!==t)return;Hf({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(nc.currentWorkspaceId!==e||zf!==t)return;Hf({loading:!1,error:gQ(n)})}}function Hf(e){Object.assign(nc,e);for(const t of $b)t(nc)}function gQ(e){return e instanceof Error?e.message:String(e)}const _Q=120;function Ii(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vQ(e,t){if(!t)return Ii(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?Ii(e):Ii(e.slice(0,n))+`<mark>${Ii(e.slice(n,n+t.length))}</mark>`+Ii(e.slice(n+t.length))}function yQ(e){return`<span class="codex-nav-tag">${Ii(e)}</span>`}function bQ(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(yQ).join(""),o=Ii(e.status??"current"),u=Ii(e.updated??"");return`<button
|
|
230
|
+
class="codex-nav-entry${n?" is-current":""}"
|
|
231
|
+
data-entry-id="${Ii(e.id)}"
|
|
232
|
+
type="button"
|
|
233
|
+
${n?'aria-current="page"':""}
|
|
234
|
+
title="${Ii(e.title)}"
|
|
235
|
+
>
|
|
236
|
+
<span class="t">${vQ(e.title,i?"":t)}</span>
|
|
237
|
+
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
+
<span class="meta">${o} · ${u}</span>
|
|
239
|
+
</button>`}function SQ(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 wQ(e,t){let n="",i=null,r="entries",o=null;e.innerHTML=`
|
|
240
|
+
<div class="codex-navigator">
|
|
241
|
+
<div class="codex-nav-modes" role="tablist" aria-label="Codex catalog">
|
|
242
|
+
<button type="button" role="tab" data-mode="entries" aria-selected="true">Entries</button>
|
|
243
|
+
<button type="button" role="tab" data-mode="schema" aria-selected="false">Schema</button>
|
|
244
|
+
</div>
|
|
245
|
+
<div class="codex-nav-search">
|
|
246
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
|
|
247
|
+
<input
|
|
248
|
+
class="codex-nav-search-input"
|
|
249
|
+
type="search"
|
|
250
|
+
placeholder="Search entries"
|
|
251
|
+
autocomplete="off"
|
|
252
|
+
spellcheck="false"
|
|
253
|
+
aria-label="Search Codex entries"
|
|
254
|
+
/>
|
|
255
|
+
</div>
|
|
256
|
+
<div class="codex-nav-quick-row">
|
|
257
|
+
<button class="codex-nav-quick" data-action="drydock" type="button">
|
|
258
|
+
Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
|
|
259
|
+
</button>
|
|
260
|
+
<button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
|
|
263
|
+
<div class="codex-navigator-scroll">
|
|
264
|
+
<div class="codex-nav-list" id="codex-nav-list"></div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
`;const u=e.querySelector(".codex-nav-search-input"),d=e.querySelector("#codex-nav-list"),f=e.querySelector("#codex-nav-eyebrow"),p=e.querySelector("#codex-nav-drydock-badge");function m(w){if(e.querySelectorAll("[data-mode]").forEach(k=>k.setAttribute("aria-selected",String(k.dataset.mode===r))),u.hidden=r==="schema",r==="schema"){const k=w.schemaCatalog;f.textContent=`Schema · ${k?.templates.length??0} templates`,d.innerHTML=k?`
|
|
268
|
+
<button class="codex-nav-entry" type="button" ${k.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${k.schema.exists?Ii(k.schema.ref):"Unavailable"}</span></button>
|
|
269
|
+
${k.templates.map(O=>`<button class="codex-nav-entry" type="button" data-template-id="${Ii(O.id)}"><span class="t">${Ii(O.id)}</span><span class="meta">${Ii(O.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',p.textContent=String(w.pendingPatchCount);return}const x=SQ(w.index,n);if(f.textContent=`Entries · ${x.length}`,p.textContent=String(w.pendingPatchCount),p.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){d.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){d.innerHTML=`<div class="codex-nav-error" role="alert">${Ii(w.error)}</div>`;return}if(x.length===0){d.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}d.innerHTML=x.map(k=>bQ(k,n,k.id===i)).join("")}function _(w){const x=w.target;if(!(x instanceof Element))return;const k=x.closest("[data-mode]");if(k?.dataset.mode==="entries"||k?.dataset.mode==="schema"){r=k.dataset.mode,m(zl());return}if(x.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const P=x.closest("[data-template-id]");if(P?.dataset.templateId){t.onRequest({kind:"schema",templateId:P.dataset.templateId});return}const F=x.closest("[data-entry-id]");if(F?.dataset.entryId){i=F.dataset.entryId,m(zl()),t.onRequest({kind:"entry",id:i});return}const T=x.closest("[data-action]");if(T?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(T?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=u.value,m(zl())},_Q)}e.addEventListener("click",_),u.addEventListener("input",b);const S=gM(w=>m(w));return m(zl()),{destroy(){S(),e.removeEventListener("click",_),u.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,u&&(u.value=""),m(zl())}}}function xQ(e,t){t.initialTheaterId&&h5(t.initialTheaterId);const n=wQ(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=gM(()=>{});Rp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){h5(o),Rp(),n.setTheater(o)}}}function kt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function mr(e){return kt(e).replace(/"/g,""")}function CQ(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${kt(i)}</span>`).join(""),n=EQ(e);return`
|
|
270
|
+
<div class="meta-chips">
|
|
271
|
+
${t}
|
|
272
|
+
${n}
|
|
273
|
+
<span class="chip">Updated ${kt(kQ(e.updated))}</span>
|
|
274
|
+
</div>
|
|
275
|
+
`}function _M(e){return e.map(t=>`<span class="chip chip-muted">${kt(t)}</span>`).join("")}function kQ(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function EQ(e){const t=TQ(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${mr(t.title)}">${kt(t.label)}</span>`:""}function TQ(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 AQ="active";function Rv(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${mr(t.id)}" data-toc-id="${mr(t.id)}">${kt(t.text)}</a>`).join("")}function d5(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(p=>p.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(p=>r.has(p.id));if(i.length===0||o.length===0)return()=>{};const u=e.closest(".codex-reading-sheet-read"),d=new Set,f=new IntersectionObserver(p=>{for(const _ of p){const b=_.target instanceof HTMLElement?_.target.id:"";b&&(_.isIntersecting?d.add(b):d.delete(b))}const m=RQ(o,d)??NQ(o,u)??o[0]?.id??null;f5(i,m)},{root:u,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const p of o)f.observe(p);return f5(i,o[0]?.id??null),()=>f.disconnect()}function RQ(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function NQ(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 f5(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(AQ,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function Np(e){return`/entry/${encodeURIComponent(e)}`}const vM=1<<20;function LQ(e,t){const n=e.replace(/\r\n/g,`
|
|
276
|
+
`).split(`
|
|
277
|
+
`),i=t.replace(/\r\n/g,`
|
|
278
|
+
`).split(`
|
|
279
|
+
`),r=n.length+1,o=i.length+1;if(r*o>vM)return i.map((m,_)=>({text:m,changed:n[_]!==m}));const u=Array.from({length:r},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let _=i.length-1;_>=0;_-=1)u[m][_]=n[m]===i[_]?u[m+1][_+1]+1:Math.max(u[m+1][_],u[m][_+1]);const d=[];let f=0,p=0;for(;p<i.length;)f<n.length&&n[f]===i[p]?(d.push({text:i[p],changed:!1}),f+=1,p+=1):f<n.length&&u[f+1][p]>=u[f][p+1]?f+=1:(d.push({text:i[p],changed:!0}),p+=1);return d}function MQ(e,t){const n=p5(e),i=p5(t),r=n.length+1,o=i.length+1,u=[];if(r*o>vM){const m=Math.max(n.length,i.length);for(let _=0;_<m;_+=1){const b=n[_],S=i[_];S!==void 0&&S===b?u.push({markdown:S,kind:"same"}):(b!==void 0&&u.push({markdown:b,kind:"removed"}),S!==void 0&&u.push({markdown:S,kind:"added"}))}return m5(u)}const d=Array.from({length:r},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let _=i.length-1;_>=0;_-=1)d[m][_]=n[m]===i[_]?d[m+1][_+1]+1:Math.max(d[m+1][_],d[m][_+1]);let f=0,p=0;for(;f<n.length||p<i.length;)f<n.length&&p<i.length&&n[f]===i[p]?(u.push({markdown:i[p],kind:"same"}),f+=1,p+=1):f<n.length&&(p>=i.length||d[f+1][p]>=d[f][p+1])?(u.push({markdown:n[f],kind:"removed"}),f+=1):(u.push({markdown:i[p],kind:"added"}),p+=1);return m5(u)}function p5(e){const t=[];let n=[],i=null;for(const r of e.replace(/\r\n/g,`
|
|
280
|
+
`).split(`
|
|
281
|
+
`)){const o=r.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
|
|
282
|
+
`)),n=[]);continue}if(n.push(r),i)o.startsWith(i)&&(i=null);else{const u=o.match(/^(`{3,}|~{3,})/);u&&(i=u[1])}}return n.length&&t.push(n.join(`
|
|
283
|
+
`)),t}function m5(e){const t=[];for(const n of e){const i=t[t.length-1];i&&i.kind===n.kind?t[t.length-1]={markdown:`${i.markdown}
|
|
284
|
+
|
|
285
|
+
${n.markdown}`,kind:i.kind}:t.push(n)}return t}const yM="fleet.codex.cowork.settings",jQ="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",OQ=32;function DQ(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},u=zQ(),d=[],f="",p="",m="",_=null,b="",S="idle",w=!1,x=null,k=!1,O=!1,P=!1,F=null,T=!1,L=!1,M=!1,z=null,U="",Z="",Q="published",G=null,B=null;const R=()=>n?((!B||B.base!==n.baseDraft||B.draft!==n.draft)&&(B={base:n.baseDraft,draft:n.draft,lines:LQ(n.baseDraft,n.draft)}),B.lines):[],D=e.body.innerHTML,N=document.createElement("div");N.className="cowork-anchor";const E=document.createElement("div");E.className="cowork-dock-zone";const $=document.createElement("div");$.className="cowork-tip",$.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(N,E,$);const j=()=>{if(t)return;const ne=!!n&&n.state!=="closed",ce=ne?T?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(ce!==Q){if(Q=ce,!ne){e.body.innerHTML=D;return}e.body.innerHTML=T?`<div class="cowork-rendered-diff" aria-label="Draft changes">${BQ(Lv(n.baseDraft),Lv(n.draft))}</div>`:Bs(Lv(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:$e=>Np($e)}).html}},q=()=>{if(t)return;if(!x){N.innerHTML="";return}const ne=e.article.getBoundingClientRect().width||0,ce=k?Math.min(340,ne*.86)/2+8:56,$e=Math.min(Math.max(x.left,ce),Math.max(ne-ce,ce)),Oe=`style="top:${x.top}px;left:${$e}px"`;N.innerHTML=k?`<div class="cowork-composer" ${Oe} role="dialog" aria-label="Add a comment">
|
|
286
|
+
<blockquote>${kt(_5(x.quote,140))}</blockquote>
|
|
287
|
+
<textarea class="cowork-composer-input" rows="2" placeholder="What should change here?" aria-label="Comment"></textarea>
|
|
288
|
+
<div class="cowork-composer-actions">
|
|
289
|
+
<button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">Cancel</button>
|
|
290
|
+
<button type="button" class="cowork-solid" data-cowork-action="add-comment">Add</button>
|
|
291
|
+
</div>
|
|
292
|
+
</div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${Oe}><span aria-hidden="true">✦</span>Comment</button>`,k&&N.querySelector(".cowork-composer-input")?.focus()},H=()=>{if(t)return;const ne=!!n&&n.state!=="closed"&&n.state!=="applied";E.classList.add("is-open");const ce=M||ne&&n.state==="running"&&S!=="complete"&&S!=="stopped";e.body.classList.toggle("is-cowork-running",ce);const $e=ne&&n.baseDraft!==n.draft,Oe=$e?R().filter(Ge=>Ge.changed).length:0;we(`
|
|
293
|
+
${A(ce)}
|
|
294
|
+
${O?je():""}
|
|
295
|
+
${P?De():""}
|
|
296
|
+
${$e&&!ce?We(Oe):""}
|
|
297
|
+
<div class="cowork-bar${ce?" is-running":""}" data-cowork-form>
|
|
298
|
+
${ce?'<span class="cowork-glow" aria-hidden="true"></span>':""}
|
|
299
|
+
<button type="button" class="cowork-chip${O?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${O}" aria-label="Annotations" ${ce?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
|
|
300
|
+
<input class="cowork-dock-input" name="prompt" value="${mr(U)}" placeholder="${d.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${ce?"disabled":""}>
|
|
301
|
+
<button type="button" class="cowork-chip cowork-chip--config${P?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${P}" aria-label="Agent settings" ${ce?"disabled":""}>${kt(u.cli||"agent")}</button>
|
|
302
|
+
${ce?'<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="Stop"><span aria-hidden="true"></span></button>':'<button type="button" class="cowork-send" data-cowork-action="send" aria-label="Send to AI">↑</button>'}
|
|
303
|
+
</div>
|
|
304
|
+
${Z?`<p class="cowork-error" role="alert">${kt(Z)}</p>`:""}`)},A=ne=>{if(!(ne||S!=="idle"))return"";const $e=ne?"running":S,Oe=ne?"Editing entry":S==="complete"?"Revision complete":"Revision stopped",Ge=!!(b||f||ne);return`<section class="cowork-revision-stream is-${$e}${w?" is-collapsed":""}" aria-label="Cowork revision stream">
|
|
305
|
+
${ne?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
|
|
306
|
+
<header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${Oe}</small></span>${Ge?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!w}" aria-label="${w?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
|
|
307
|
+
${Ge?`<div class="cowork-revision-content" aria-hidden="${w}"><div class="cowork-revision-content-inner">
|
|
308
|
+
${b||f?`<div class="cowork-revision-body">
|
|
309
|
+
${b?`<p class="cowork-revision-instruction">${kt(b)}</p>`:""}
|
|
310
|
+
${f?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${m}</div></div>`:""}
|
|
311
|
+
</div>`:""}
|
|
312
|
+
${ne?'<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>Writing revision</strong></span></footer>':""}
|
|
313
|
+
</div></div>`:""}
|
|
314
|
+
</section>`},Y=()=>{_!==null&&window.clearTimeout(_),_=null},J=()=>{p!==f&&(p=f,m=f?Bs(f).html:"")},he=()=>{J();const ne=E.querySelector(".cowork-revision-output");if(!ne){H();return}ne.innerHTML=m;const ce=ne.closest(".cowork-revision-output-scroll");ce&&(ce.scrollTop=ce.scrollHeight)},de=()=>{_===null&&(_=window.setTimeout(()=>{_=null,t||he()},OQ))},ae=()=>{Y(),J()},we=ne=>{if(ne===G)return;G=ne;const ce=document.activeElement,$e=ce instanceof HTMLInputElement&&ce.name==="prompt"&&E.contains(ce)?"prompt":ce instanceof HTMLTextAreaElement&&ce.dataset.coworkComment&&E.contains(ce)?`comment:${ce.dataset.coworkComment}`:null;if(E.innerHTML=ne,$e==="prompt"){const Oe=E.querySelector(".cowork-dock-input");Oe?.focus(),Oe?.setSelectionRange(Oe.value.length,Oe.value.length)}else if($e?.startsWith("comment:")){const Oe=E.querySelector(`[data-cowork-comment="${CSS.escape($e.slice(8))}"]`);Oe?.focus(),Oe?.setSelectionRange(Oe.value.length,Oe.value.length)}},je=()=>`
|
|
315
|
+
<div class="cowork-popover cowork-panel" role="region" aria-label="Annotations">
|
|
316
|
+
${d.length===0?'<p class="cowork-empty">Select text in the document to add a comment.</p>':d.map(ne=>`
|
|
317
|
+
<article class="cowork-card is-${ne.status}">
|
|
318
|
+
<blockquote>${kt(_5(ne.quote,160))}</blockquote>
|
|
319
|
+
<textarea data-cowork-comment="${mr(ne.id)}" aria-label="Comment" placeholder="Add a comment" ${ne.status==="sent"?"disabled":""}>${kt(ne.comment)}</textarea>
|
|
320
|
+
<footer><span class="cowork-card-status">${ne.status==="sent"?"Sent":ne.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${mr(ne.id)}" aria-label="Delete annotation">×</button></footer>
|
|
321
|
+
</article>`).join("")}
|
|
322
|
+
</div>`,De=()=>`
|
|
323
|
+
<div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
|
|
324
|
+
${Nv("CLI","cli",o.clis,u.cli)}${Nv("Model","model",o.models,u.model)}${Nv("Effort","effort",o.efforts,u.effort)}
|
|
325
|
+
</div>`,We=ne=>F?`<div class="cowork-review is-confirm"><span>${F==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${F==="discard"?" cowork-solid--danger":""}" data-cowork-action="${F==="apply"?"apply-confirm":"discard-confirm"}">${F==="apply"?"Apply":"Discard"}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">Back</button></div>`:`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${ne>0?`${ne} changed line${ne===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${T?"View draft":"View diff"}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">Apply</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">Discard</button></div>`,ke=()=>{if(!t){for(const ne of[...e.body.querySelectorAll("mark.cowork-mark")]){const ce=ne.parentNode;if(ce){for(;ne.firstChild;)ce.insertBefore(ne.firstChild,ne);ce.removeChild(ne)}}if(e.body.normalize(),!T)for(const ne of d)ne.quote&&Le(ne)}},Le=ne=>{const ce=[],$e=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let Ft=$e.nextNode();Ft;Ft=$e.nextNode())ce.push(Ft);let Oe="";const Ge=[];for(const Ft of ce)Ge.push(Oe.length),Oe+=Ft.data;const Ht=Oe.indexOf(ne.quote);if(Ht<0)return;const pi=Ht+ne.quote.length;for(let Ft=0;Ft<ce.length;Ft+=1){const On=Ge[Ft],yn=On+ce[Ft].data.length,K=Math.max(Ht,On),pe=Math.min(pi,yn);if(K>=pe)continue;const be=document.createRange();be.setStart(ce[Ft],K-On),be.setEnd(ce[Ft],pe-On);const Xe=document.createElement("mark");Xe.className="cowork-mark",Xe.dataset.annotationId=ne.id;try{be.surroundContents(Xe)}catch{}}},Ae=ne=>{const ce=d.find(Ht=>Ht.id===ne.dataset.annotationId);if(!ce){$.hidden=!0;return}$.textContent=ce.comment.trim()||"No comment yet",$.hidden=!1;const $e=ne.getBoundingClientRect(),Oe=e.article.getBoundingClientRect(),Ge=$.offsetWidth/2+8;$.style.top=`${Math.max($e.top-Oe.top-6,0)}px`,$.style.left=`${Math.min(Math.max($e.left+$e.width/2-Oe.left,Ge),Math.max(Oe.width-Ge,Ge))}px`},Me=()=>{j(),H(),ke()},et=async()=>{o=await aQ(e.theaterId,u.cli,u.model||void 0);const ne=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",ce=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";u={cli:o.clis.includes(u.cli)?u.cli:o.clis[0]??"",model:o.models.includes(u.model)?u.model:ne,effort:o.efforts.includes(u.effort)?u.effort:ce},Mv(u)},dt=async ne=>{n=ne;const ce=ne.annotations.map($Q),$e=new Set(ce.map(Oe=>Oe.id));d=[...ce,...d.filter(Oe=>!$e.has(Oe.id))],(ne.cli||ne.model||ne.effort)&&(u={cli:ne.cli??u.cli,model:ne.model??u.model,effort:ne.effort??u.effort},Mv(u));try{await et()}catch{}if(!t){if(n&&(n.cli!==u.cli||n.model!==u.model||n.effort!==u.effort))try{n=await Av(e.theaterId,n.id,u)}catch{}t||(oe(),Me())}},Je=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const ne=await c5(e.theaterId,e.entryId,u);return await dt(ne),ne};H(),et().then(H).catch(()=>{}),(async()=>{try{const ne=await oQ(e.theaterId,e.entryId);!t&&ne&&await dt(ne)}catch{}})();function oe(){n&&(i?.(),i=fQ(e.theaterId,n.id,r,(ne,ce)=>{if(ce&&ce<=r)return;r=Math.max(r,ce);const $e=n?.state==="running";if(ne.session&&(n=ne.session),ne.type==="transcript"&&ne.text&&n?.state==="running"){f=S==="running"?f+ne.text:ne.text,S="running",de();return}ne.type==="done"&&(ae(),(!z?.cancelled||z.submitted)&&(S=$e||L||S==="stopped"||!!f||!!b?"complete":"idle",d=d.map(Ge=>Ge.status==="sent"?{...Ge,status:"done"}:Ge),L&&(L=!1,n&&n.baseDraft!==n.draft&&(T=!0)))),(ne.type==="error"||ne.type==="session"&&$e&&n?.state!=="running")&&(ae(),S="stopped",L=!1,d=d.map(Oe=>Oe.status==="sent"?{...Oe,status:"pending"}:Oe)),ne.type==="error"&&ne.text&&(Z=ne.text),Me()}))}async function qe(ne,ce){d=[...d,{id:PQ(),quote:ne,comment:ce,status:"pending"}],x=null,k=!1,q(),H(),ke();try{await Je(),await ct(()=>lQ(e.theaterId,n.id,ne)),await Mt()}catch{}}async function Ye(ne){d=d.filter(ce=>ce.id!==ne),H(),ke(),$.hidden=!0;try{await Mt()}catch{}}async function Mt(){n&&await ct(()=>u5(e.theaterId,n.id,d.map(g5)))}async function Wt(){if(M||n?.state==="running")return;const ne=d.filter(Ge=>Ge.status!=="done"),ce=U.trim(),$e=ce||(ne.length?jQ:"");if(!$e)return;const Oe={cancelled:!1,submitted:!1};z=Oe,M=!0,d=ne.map(Ge=>({...Ge,status:"sent"})),Y(),f="",p="",m="",b=ce,S="running",w=!1,U="",O=!1,P=!1,H(),ke();try{if(await Je(),Oe.cancelled||z!==Oe||(await ct(()=>u5(e.theaterId,n.id,d.map(g5))),Oe.cancelled||z!==Oe))return;Oe.submitted=!0,await ct(()=>cQ(e.theaterId,n.id,$e)),L=!0}catch{!Oe.cancelled&&z===Oe&&(L=!1,S="idle",d=d.map(Ge=>Ge.status==="sent"?{...Ge,status:"pending"}:Ge))}finally{!Oe.cancelled&&z===Oe&&(M=!1,z=null,H())}}async function hn(){if(!n)return;const ne=n.id;try{Z="",await dQ(e.theaterId,ne)}catch(ce){Z=ce instanceof Error?ce.message:"Cowork request failed.",H();return}i?.(),i=null,r=0,d=[],Y(),f="",p="",m="",b="",S="idle",w=!1,F=null,T=!1;try{await dt(await c5(e.theaterId,e.entryId,u))}catch{n=null,Me()}}async function ct(ne){try{Z="",n=await ne(),Me()}catch(ce){throw Z=ce instanceof A1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(ce.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":ce instanceof Error?ce.message:"Cowork request failed.",Me(),ce}}const Yt=ne=>{if(k||n?.state==="running"||ne.target instanceof Node&&N.contains(ne.target))return;const ce=window.getSelection(),$e=ce?.toString().trim()??"";if(!$e||!ce||ce.rangeCount===0||!e.body.contains(ce.anchorNode))return;const Oe=ce.getRangeAt(0).getBoundingClientRect(),Ge=e.article.getBoundingClientRect();x={quote:$e,top:Oe.bottom-Ge.top+8,left:Math.min(Math.max(Oe.left+Oe.width/2-Ge.left,0),Math.max(Ge.width,0))},q()},bt=ne=>{if(ne.target instanceof Element){if(ne.target.closest(".cowork-pill")){ne.preventDefault();return}!N.contains(ne.target)&&x&&(x=null,k=!1,q())}},Se=ne=>{if(ne.target instanceof Element&&ne.target.closest(".cowork-revision-output")){ne.stopPropagation();return}if(ne.key==="Escape"){x||k?(x=null,k=!1,q()):(O||P||F)&&(O=!1,P=!1,F=null,H());return}const ce=ne.target;ne.key==="Enter"&&!ne.shiftKey&&ce instanceof HTMLTextAreaElement&&ce.classList.contains("cowork-composer-input")&&(ne.preventDefault(),Qe()),ne.key==="Enter"&&ce instanceof HTMLInputElement&&ce.name==="prompt"&&(ne.preventDefault(),Wt())},Qe=()=>{const ne=N.querySelector(".cowork-composer-input")?.value.trim()??"";x&&qe(x.quote,ne)},Ne=ne=>{if(!(ne.target instanceof Element))return;const ce=ne.target.closest(".cowork-revision-output");ce&&ne.stopPropagation();const $e=ne.target.closest('[data-action="copy-code"]');if($e){const Ht=$e.closest("pre")?.getAttribute("data-code");if(!Ht)return;IQ($e,Ht);return}if(ce)return;const Oe=ne.target.closest("[data-cowork-action]");if(!Oe)return;const Ge=Oe.dataset.coworkAction;if(Ge==="comment"&&(k=!0,q()),Ge==="cancel-comment"&&(x=null,k=!1,q()),Ge==="add-comment"&&Qe(),Ge==="toggle-panel"&&(O=!O,P=!1,H()),Ge==="toggle-config"&&(P=!P,O=!1,H()),Ge==="toggle-revision"){w=!w;const Ht=Oe.closest(".cowork-revision-stream");Ht?.classList.toggle("is-collapsed",w),Oe.setAttribute("aria-expanded",String(!w)),Oe.setAttribute("aria-label",`${w?"Expand":"Collapse"} Cowork stream`),Ht?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(w))}if(Ge==="send"&&Wt(),Ge==="cancel-run"&&M&&z&&!z.submitted){z.cancelled=!0,M=!1,L=!1,S="stopped",d=d.map(Ht=>Ht.status==="sent"?{...Ht,status:"pending"}:Ht),H(),ke();return}Ge==="toggle-diff"&&(T=!T,Me()),Ge==="delete-annotation"&&Oe.dataset.annotationId&&Ye(Oe.dataset.annotationId),Ge==="apply-arm"&&(F="apply",H()),Ge==="discard-arm"&&(F="discard",H()),Ge==="confirm-back"&&(F=null,H()),Ge==="apply-confirm"&&n&&(F=null,ct(()=>hQ(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Ge==="discard-confirm"&&hn(),Ge==="cancel-run"&&n&&ct(()=>uQ(e.theaterId,n.id)).then(()=>{S="stopped",d=d.map(Ht=>Ht.status==="sent"?{...Ht,status:"pending"}:Ht),H()}).catch(()=>{})},Ce=ne=>{const ce=ne.target instanceof Element?ne.target.closest("mark.cowork-mark"):null;ce?Ae(ce):$.hidden||($.hidden=!0)},ut=()=>{$.hidden=!0},dn=ne=>{const ce=ne.target;if(ce instanceof Element&&ce.closest(".cowork-revision-output")){ne.stopPropagation();return}if(ce instanceof HTMLInputElement&&ce.name==="prompt"){U=ce.value;return}if(ce instanceof HTMLTextAreaElement&&ce.dataset.coworkComment){const $e=ce.dataset.coworkComment;d=d.map(Oe=>Oe.id===$e?{...Oe,comment:ce.value,status:"pending"}:Oe)}},jt=ne=>{const ce=ne.target;if(ce instanceof Element&&ce.closest(".cowork-revision-output")){ne.stopPropagation();return}if(ce instanceof HTMLSelectElement&&["cli","model","effort"].includes(ce.name)){if(u=ce.name==="cli"?{cli:ce.value,model:"",effort:""}:{...u,[ce.name]:ce.value},Mv(u),!n){ce.name!=="effort"&&et().then(H).catch(()=>{});return}ce.name!=="effort"?et().then(()=>ct(()=>Av(e.theaterId,n.id,u))).then(H).catch($e=>{Z=$e instanceof Error?$e.message:"Cowork request failed.",H()}):ct(()=>Av(e.theaterId,n.id,u)).catch(()=>{});return}ce instanceof HTMLTextAreaElement&&ce.dataset.coworkComment&&Mt().catch(()=>{})};return e.article.addEventListener("mouseup",Yt),e.article.addEventListener("mousedown",bt),e.article.addEventListener("keydown",Se),e.article.addEventListener("click",Ne),e.article.addEventListener("input",dn),e.article.addEventListener("change",jt),e.article.addEventListener("mouseover",Ce),e.article.addEventListener("mouseleave",ut),{destroy(){t=!0,Y(),i?.(),e.article.removeEventListener("mouseup",Yt),e.article.removeEventListener("mousedown",bt),e.article.removeEventListener("keydown",Se),e.article.removeEventListener("click",Ne),e.article.removeEventListener("input",dn),e.article.removeEventListener("change",jt),e.article.removeEventListener("mouseover",Ce),e.article.removeEventListener("mouseleave",ut),N.remove(),E.remove(),$.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Nv(e,t,n,i){return`<label class="cowork-selector"><span>${e}</span><select name="${t}" ${n.length?"":"disabled"}>${n.map(r=>`<option value="${mr(r)}" ${r===i?"selected":""}>${kt(r)}</option>`).join("")}</select></label>`}function IQ(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function BQ(e,t){return MQ(e,t).map(n=>{const i=Bs(n.markdown,{resolveWikiLink:r=>Np(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function g5(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||"Please revise this passage."}}function $Q(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function Lv(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function _5(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function PQ(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function zQ(){try{const e=JSON.parse(localStorage.getItem(yM)??"{}");return{cli:typeof e.cli=="string"?e.cli:"claude",model:typeof e.model=="string"?e.model:"",effort:typeof e.effort=="string"?e.effort:"medium"}}catch{return{cli:"claude",model:"",effort:"medium"}}}function Mv(e){try{localStorage.setItem(yM,JSON.stringify(e))}catch{}}const bM={create_wiki:"+",update_wiki:"↻"},SM={create_wiki:"Create",update_wiki:"Update"};function HQ(e,t){let n=!1,i=0,r=null,o=null,u=t,d="idle",f=null,p=null,m=null;Zp(e);function _(T){const L=T.target;if(!(L instanceof Element))return;const M=L.closest("[data-patch-id]");if(M){T.preventDefault();const Z=M.dataset.patchId||void 0;u.onPatchOpen?.(Z);return}const z=L.closest("[data-entry-id]");if(z?.dataset.entryId){T.preventDefault(),u.onRelatedClick(z.dataset.entryId);return}const U=L.closest("[data-drydock-action]");if(U){T.preventDefault(),b(U.dataset.drydockAction);return}}function b(T){if(T){if(T==="back"){u.onPatchOpen?.(void 0);return}if(T==="approve"){d="approving",f=null,w();return}if(T==="approve-confirm"){S("approve",void 0);return}if(T==="reject"){d="rejecting",f=null,w();return}if(T==="reject-submit"){const L=e.querySelector("#queue-reject-reason")?.value.trim();if(!L){f="Rejection reason is required.",w();return}S("reject",L);return}if(T==="cancel"){d="idle",f=null,w();return}}}async function S(T,L){if(m){d="submitting",f=null,w();try{await iQ(u.theaterId,m,T,L),u.onDecided?.()}catch(M){d=T==="approve"?"approving":"rejecting",f=M instanceof Error?M.message:String(M),w()}}}function w(){const T=e.querySelector("[data-decision-bar-wrap]");T&&(T.innerHTML=wM(d,f))}e.addEventListener("click",_);function x(){o?.destroy(),o=null,r?.(),r=null}async function k(T){if(!n){yf(e,t.tocContainer),x();try{const L=await QJ(u.theaterId,T);if(n)return;const{index:M}=zl(),{html:z,toc:U}=Bs(L.body,{omitDuplicateTitle:L.frontmatter.title,resolveWikiLink:G=>Np(G)});e.innerHTML=`
|
|
326
|
+
<article class="document">
|
|
327
|
+
<header class="document-header">
|
|
328
|
+
${FQ(L.frontmatter.title)}
|
|
329
|
+
<h1>${kt(L.frontmatter.title)}</h1>
|
|
330
|
+
${CQ(L.frontmatter)}
|
|
331
|
+
</header>
|
|
332
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
333
|
+
${z}
|
|
334
|
+
</div>
|
|
335
|
+
${UQ(L.frontmatter.id,L.frontmatter.tags,M)}
|
|
336
|
+
</article>
|
|
337
|
+
`,t.tocContainer.innerHTML=Rv(U);const Z=e.querySelector("article");Z&&U.length>0&&(r=d5(Z,U,t.tocContainer));const Q=e.querySelector("#codex-reader-body");Z&&Q&&(o=DQ({theaterId:u.theaterId,entryId:T,title:L.frontmatter.title,article:Z,body:Q,onApplied:()=>{k(T)}}))}catch(L){n||bf(e,t.tocContainer,L)}}}async function O(T){if(!n){yf(e,t.tocContainer),x(),p=null,m=null,d="idle",f=null;try{if(T){const L=await eQ(u.theaterId,T);if(n)return;p=L.meta,m=T;const{html:M,toc:z}=Bs(L.wikiEntry.body,{omitDuplicateTitle:L.wikiEntry.title,resolveWikiLink:Z=>Np(Z)});e.innerHTML=GQ(L,M),t.tocContainer.innerHTML=Rv(z);const U=e.querySelector("article");U&&z.length>0&&(r=d5(U,z,t.tocContainer))}else{const L=await dM(u.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=WQ(L.items,"Review queue — Pending patches")}}catch(L){n||bf(e,t.tocContainer,L)}}}async function P(T){if(!n){yf(e,t.tocContainer),x();try{if(T){const L=await rQ(u.theaterId,T);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=YQ(L)}else{const L=await sQ(u.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=XQ(L)}}catch(L){n||bf(e,t.tocContainer,L)}}}async function F(T){const L=++i,M=u.theaterId;yf(e,t.tocContainer),x();try{const z=await nQ(M,T);if(n||L!==i||M!==u.theaterId)return;const{html:U,toc:Z}=Bs(z.content);e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>Schema</span></li><li><span aria-current="page">${kt(T??"Workspace schema")}</span></li></ol></nav><h1>${kt(T??"Workspace schema")}</h1><span class="queue-dl-mono">${kt(z.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${U}</div></article>`,t.tocContainer.innerHTML=Rv(Z)}catch(z){!n&&L===i&&M===u.theaterId&&bf(e,t.tocContainer,z)}}return t.kind==="entry"&&t.initialEntryId?k(t.initialEntryId):t.kind==="drydock"?O(t.subId):t.kind==="conflicts"?P(t.subId):t.kind==="schema"&&F(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",_),x(),o?.destroy()},async setEntry(T){await k(T)},async navigateSub(T){t.kind==="drydock"?await O(T):t.kind==="conflicts"?await P(T):t.kind==="schema"&&await F(T)},refreshCallbacks(T){u={...u,...T}}}}function yf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function bf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${kt(i)}</div>`,t.innerHTML=""}function FQ(e){return`
|
|
338
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
339
|
+
<ol>
|
|
340
|
+
<li><span>Codex</span></li>
|
|
341
|
+
<li><span aria-current="page">${kt(e)}</span></li>
|
|
342
|
+
</ol>
|
|
343
|
+
</nav>
|
|
344
|
+
`}function UQ(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(u=>i.has(u))})).filter(o=>o.matchingTags.length>0).sort((o,u)=>u.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(u.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
|
|
345
|
+
<section class="related-list">
|
|
346
|
+
<h2>Related entries</h2>
|
|
347
|
+
<div class="related-items">
|
|
348
|
+
${r.map(o=>`<button class="related-card" type="button" data-entry-id="${mr(o.entry.id)}">
|
|
349
|
+
<strong>${kt(o.entry.title)}</strong>
|
|
350
|
+
<span>${_M(o.matchingTags)}</span>
|
|
351
|
+
</button>`).join("")}
|
|
352
|
+
</div>
|
|
353
|
+
</section>
|
|
354
|
+
`}function WQ(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
355
|
+
<article class="document">
|
|
356
|
+
<header class="document-header">
|
|
357
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
358
|
+
<ol>
|
|
359
|
+
<li><span>Codex</span></li>
|
|
360
|
+
<li><span aria-current="page">Review queue</span></li>
|
|
361
|
+
</ol>
|
|
362
|
+
</nav>
|
|
363
|
+
<h1>${kt(t)}</h1>
|
|
364
|
+
</header>
|
|
365
|
+
<div class="queue-row-list">
|
|
366
|
+
${e.map(qQ).join("")}
|
|
367
|
+
</div>
|
|
368
|
+
</article>
|
|
369
|
+
`}function qQ(e){const t=e.op??"create_wiki",n=bM[t]??"?",i=SM[t]??"Patch",r=e.target??e.id,u=[ZQ(e.meta.createdAt)].filter(Boolean);return`
|
|
370
|
+
<button class="queue-row" type="button" data-patch-id="${mr(e.id)}" aria-label="${mr(i+": "+r)}">
|
|
371
|
+
<span class="queue-row-badge" aria-hidden="true">
|
|
372
|
+
<span class="op-badge">${n}</span>
|
|
373
|
+
</span>
|
|
374
|
+
<span class="queue-row-body">
|
|
375
|
+
<span class="queue-row-target">${kt(r)}</span>
|
|
376
|
+
${e.summary?`<span class="queue-row-summary">${kt(e.summary)}</span>`:""}
|
|
377
|
+
${u.length>0?`<span class="queue-row-meta">${u.map(kt).join(" · ")}</span>`:""}
|
|
378
|
+
</span>
|
|
379
|
+
</button>
|
|
380
|
+
`}function GQ(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,u=n.frontmatter.op,d=bM[u]??"?",f=SM[u]??"Patch",p=o?"기존 문서 대체":"신규 문서 생성",m=i.status==="pending";return`
|
|
381
|
+
<article class="document">
|
|
382
|
+
<header class="document-header">
|
|
383
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
384
|
+
<ol>
|
|
385
|
+
<li><span>Codex</span></li>
|
|
386
|
+
<li><span>Review queue</span></li>
|
|
387
|
+
<li><span aria-current="page">${kt(f)}</span></li>
|
|
388
|
+
</ol>
|
|
389
|
+
</nav>
|
|
390
|
+
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
391
|
+
<h1><span class="op-badge">${d}</span> ${kt(r.title)}</h1>
|
|
392
|
+
<p class="eyebrow">${kt(n.frontmatter.target)} · v${r.version} · ${kt(p)}</p>
|
|
393
|
+
${KQ(n.frontmatter.proposer,r.tags)}
|
|
394
|
+
</header>
|
|
395
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
396
|
+
${t}
|
|
397
|
+
</div>
|
|
398
|
+
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
399
|
+
${m?wM("idle",null):VQ(i)}
|
|
400
|
+
</div>
|
|
401
|
+
</article>
|
|
402
|
+
`}function KQ(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${kt(e)}</span>`),t.length>0&&n.push(_M(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function wM(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
403
|
+
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
404
|
+
<div class="queue-action-buttons">
|
|
405
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
406
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
407
|
+
</div>
|
|
408
|
+
${t?`<p class="queue-action-error">${kt(t)}</p>`:""}
|
|
409
|
+
`:e==="rejecting"?`
|
|
410
|
+
<div class="queue-reject-form">
|
|
411
|
+
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
412
|
+
<div class="queue-action-buttons">
|
|
413
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
414
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
415
|
+
</div>
|
|
416
|
+
${t?`<p class="queue-action-error">${kt(t)}</p>`:""}
|
|
417
|
+
</div>
|
|
418
|
+
`:`
|
|
419
|
+
<div class="queue-action-buttons">
|
|
420
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
421
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
422
|
+
</div>
|
|
423
|
+
`}function VQ(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${kt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function YQ(e){return`
|
|
424
|
+
<article class="document">
|
|
425
|
+
<header class="document-header">
|
|
426
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
427
|
+
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
428
|
+
</nav>
|
|
429
|
+
<h1>${kt(e.id)}</h1>
|
|
430
|
+
<p class="eyebrow">Conflict · ${kt(e.meta?.status??"open")}</p>
|
|
431
|
+
</header>
|
|
432
|
+
<div class="markdown-body">
|
|
433
|
+
${e.current?`<h2>Current</h2><pre><code>${kt(e.current)}</code></pre>`:""}
|
|
434
|
+
${e.proposed?`<h2>Proposed</h2><pre><code>${kt(e.proposed)}</code></pre>`:""}
|
|
435
|
+
</div>
|
|
436
|
+
</article>
|
|
437
|
+
`}function XQ(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
438
|
+
<article class="document">
|
|
439
|
+
<header class="document-header">
|
|
440
|
+
<h1>Conflicts</h1>
|
|
441
|
+
</header>
|
|
442
|
+
<div class="markdown-body">
|
|
443
|
+
<ul class="queue-list">
|
|
444
|
+
${e.map(t=>`<li class="queue-item">
|
|
445
|
+
<strong>${kt(t.title||t.id)}</strong>
|
|
446
|
+
<span class="eyebrow">${kt(t.status)}</span>
|
|
447
|
+
</li>`).join("")}
|
|
448
|
+
</ul>
|
|
449
|
+
</div>
|
|
450
|
+
</article>
|
|
451
|
+
`}function ZQ(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 Ro=null,bh=null,xM=null,Fa=null,No=null,Pa=null,Ff=null,jv=null,Uf,Pb=0;function v5(e){xM=e}function JQ(e,t){const n=tee();n.parentElement!==e&&e.appendChild(n),bh||(bh=xQ(n,{initialTheaterId:t,onRequest:i=>xM?.(i)}))}function QQ(e){bh?.setTheater(e)}function CM(e,t,n){const i=nee(),r=iee(),o=i.parentElement,u=n.kind==="entry"&&Ff==="entry"&&n.initialEntryId===jv;o&&o!==e&&(Pb=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Pa||Ff!==n.kind?(Pa?.destroy(),Pa=HQ(i,{...n,tocContainer:r}),Ff=n.kind,Uf=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==jv?Pa.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==Uf&&(Uf=n.subId,Pa.navigateSub(n.subId)),jv=n.kind==="entry"?n.initialEntryId??null:null,Pa.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=u?Pb:0;requestAnimationFrame(()=>{e.scrollTop=d})}function eee(){const e=Fa?.parentElement;e&&(Pb=e.scrollTop)}function kM(){Pa?.destroy(),Pa=null,Ff=null,Uf=void 0,Fa?.parentElement&&Fa.parentElement.removeChild(Fa),No?.parentElement&&No.parentElement.removeChild(No)}function y5(){kM(),bh?.destroy(),bh=null,Ro?.parentElement&&Ro.parentElement.removeChild(Ro)}function tee(){return Ro||(Ro=document.createElement("div"),Ro.className="codex-host"),Ro}function nee(){return Fa||(Fa=document.createElement("div"),Fa.className="codex-reader-host"),Fa}function iee(){return No||(No=document.createElement("div"),No.className="codex-toc-host"),No}const see={id:"codex",title:"Codex",icon:()=>c.jsx(cee,{}),render:e=>c.jsx(ree,{theaterId:e.theaterId})};function ree({theaterId:e}){const t=Qs(),n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),o=y.useRef(""),[u,d]=y.useState(null),f=t.codexReader,p=f!==null,m=t.codexReaderExpanded,_=t.theaters.find(O=>O.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=u?.contextKey===S&&u.hasWiki?u.id:null,x=w!==null,k=f?`${f.kind}:${f.kind==="entry"?f.entryId:f.kind==="drydock"?f.patchId??"":f.kind==="conflicts"?f.id??"":f.templateId??""}`:null;return y.useEffect(()=>{if(o.current=S,b_(),!e){d({contextKey:S,hasWiki:!1,id:null});return}oee(e).then(O=>{o.current===S&&d({contextKey:S,...O})}).catch(()=>{o.current===S&&d({contextKey:S,hasWiki:!1,id:null})})},[S,e]),y.useEffect(()=>{u?.contextKey===S&&!u.hasWiki&&y5()},[S,u]),y.useEffect(()=>()=>y5(),[]),y.useEffect(()=>{if(!x||!w)return;const O=n.current;if(O)return JQ(O,w),v5(P=>{P.kind==="entry"?ur({kind:"entry",entryId:P.id}):P.kind==="drydock"?ur({kind:"drydock",patchId:P.patchId}):P.kind==="conflicts"?ur({kind:"conflicts",id:P.id}):P.kind==="schema"&&ur({kind:"schema",templateId:P.templateId})}),()=>{v5(null)}},[x,w,p]),y.useEffect(()=>{x&&w&&QQ(w)},[x,w]),y.useEffect(()=>{if(!x||!w||!p||m||!i.current||!r.current||!f)return;const O=f.kind,P=O==="drydock"?f.patchId:O==="conflicts"?f.id:O==="schema"?f.templateId:void 0;CM(i.current,r.current,{initialEntryId:O==="entry"?f.entryId:"",kind:O,subId:P,theaterId:w,onRelatedClick:F=>ur({kind:"entry",entryId:F}),onClose:()=>b_(),onPatchOpen:F=>ur({kind:"drydock",patchId:F}),onDecided:()=>{Rp(),ur({kind:"drydock",patchId:void 0})}})},[x,w,p,m,k]),y.useEffect(()=>{p||kM()},[p]),x?p?c.jsxs("div",{className:"codex-rail-host is-split",children:[c.jsxs("div",{className:"codex-doc-pane",children:[c.jsxs("div",{className:"codex-doc-pane-head",children:[c.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:Ef,children:"⤢ Expand"}),c.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:b_,children:"✕"})]}),c.jsx("div",{ref:i,className:"codex-doc-scroll"}),c.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),c.jsx("div",{ref:n,className:"codex-nav-pane"})]}):c.jsx("div",{ref:n,className:"codex-rail-host"}):c.jsx(aee,{activeTheater:_,hasTheaters:b})}function aee({activeTheater:e,hasTheaters:t}){return t?c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),c.jsx("h1",{children:e?.label||"This Theater"}),c.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),c.jsx("h1",{children:"Add a Theater"}),c.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function oee(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 lee(await t.json())}function lee(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 cee(){return c.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:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),c.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),c.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function uee(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(r=>i===""||r.name.toLocaleLowerCase().includes(i)||r.title.toLocaleLowerCase().includes(i)?n==="all"?!0:r.tasksTotal<=0?!1:n==="complete"?r.tasksDone>=r.tasksTotal:r.tasksDone<r.tasksTotal:!1)}function hee(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function zb(e){return e.replace(/\s+/g," ").trim()}function dee(e,t){const n=i=>zb(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function EM(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function fee(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 pee(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function mee(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function gee(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(mee)?"ready":"blocked"}const _ee="plans-changed",vee=3e4;function yee(e,t){let n=null,i=null,r=!1,o=!0;const u=()=>{const d=o;o=!1;let f=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener(_ee,()=>{t()}),n.onopen=()=>{f+=1,d&&f===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(r||t(),i=setTimeout(()=>{i=null,r||u()},vee))}};return u(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const bee=360,See={id:"plans",title:"Plans",icon:Tee,render:e=>c.jsx(wee,{...e})};function wee(e){const t=e.theaterId;return c.jsx(xee,{...e},t)}function xee(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=y.useState({kind:"no-theater"}),[o,u]=y.useState({kind:"loading"}),[d,f]=y.useState(null),[p,m]=y.useState(0),[_,b]=y.useState(0),[S,w]=y.useState(()=>new Set),x=y.useRef(0),k=y.useRef(0),O=y.useRef(null),P=y.useRef(o),F=y.useRef(null),T=y.useRef(!1),L=y.useRef(!1),M=y.useRef(null),z=y.useRef(null),U=d?.theaterId===n?d.name:null;y.useEffect(()=>{M.current=U},[U]),y.useEffect(()=>{const D=++x.current;if(!n){r({kind:"no-theater"});return}const N=O.current!==null,E=L.current;L.current=!1,N||r({kind:"loading"}),rO(n).then($=>{if(D!==x.current)return;const j=new Map($.plans.map(A=>[A.name,hee(A)])),q=O.current;if(q){const A=new Set($.plans.filter(Y=>q.get(Y.name)!==j.get(Y.name)).map(Y=>Y.name));A.size>0&&(z.current&&clearTimeout(z.current),w(A),z.current=setTimeout(()=>w(new Set),1200))}O.current=j,r({kind:"ready",plans:$.plans});const H=M.current;H&&(j.has(H)?j.get(H)!==F.current&&b(A=>A+1):(F.current=null,T.current=!0,b(A=>A+1)))}).catch(()=>{D===x.current&&(!N||E)&&r({kind:"error"})})},[n,p]),y.useEffect(()=>{const D=++k.current;if(!n||!U)return;const N=T.current;T.current=!1,!N&&P.current.kind==="ready"&&P.current.plan.name===U||(F.current=null,P.current={kind:"loading"},u({kind:"loading"})),aO(n,U).then($=>{if(D===k.current){F.current=O.current?.get($.name)??null;const j={kind:"ready",plan:$};P.current=j,u(j)}}).catch(()=>{D===k.current&&(P.current={kind:"error"},u({kind:"error"}))})},[_,U,n]),y.useEffect(()=>{if(n)return yee(n,()=>{m(D=>D+1)})},[n]),y.useEffect(()=>()=>{z.current&&clearTimeout(z.current)},[]),y.useLayoutEffect(()=>(t?.(U?bee:null),()=>t?.(null)),[t,U]);const Z=y.useCallback(D=>{n&&f({theaterId:n,name:D})},[n]),Q=y.useCallback(()=>{f(null),F.current=null,P.current={kind:"loading"},u({kind:"loading"})},[]),B=y.useCallback(()=>{L.current=!0,m(D=>D+1)},[]),R=y.useCallback(()=>b(D=>D+1),[]);return c.jsx("div",{className:"plans-panel-shell",children:c.jsxs("div",{className:`plans-root${U?" is-reader-open":""}`,onKeyDown:D=>{D.key==="Escape"&&U&&Q()},children:[U&&c.jsx(kee,{state:o,onClose:Q,onRetry:R}),U&&c.jsx("div",{className:"plans-divider","aria-hidden":"true"}),c.jsx(Cee,{selectedName:U,state:i,onRetry:B,onSelect:Z,pulsedNames:S})]})})}function Cee({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,u]=y.useState(""),[d,f]=y.useState("all"),[p,m]=y.useState(null),_=y.useRef(new Map);if(t.kind==="no-theater")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Ov,{children:"Select a Theater to browse plans."})});if(t.kind==="loading")return c.jsx("div",{className:"plans-list-pane",children:c.jsx("div",{className:"plans-loading",children:"Loading plans…"})});if(t.kind==="error")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(TM,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Ov,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=uee(t.plans,o,d),S=(k,O)=>{const P=(k+O+b.length)%b.length;_.current.get(b[P]?.name??"")?.focus()},w=(k,O)=>{(k.key==="ArrowDown"||k.key==="ArrowUp")&&(k.preventDefault(),S(O,k.key==="ArrowDown"?1:-1))},x=(k,O)=>{k.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${O}`).then(()=>{m(O),window.setTimeout(()=>m(P=>P===O?null:P),1200)}).catch(()=>{})};return c.jsxs("div",{className:"plans-list-pane",children:[c.jsxs("div",{className:"plans-toolbar",children:[c.jsxs("label",{className:"plans-search-label",children:[c.jsx("span",{children:"Search plans"}),c.jsx("input",{className:"plans-search",value:o,onChange:k=>u(k.target.value)})]}),c.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(k=>c.jsx("button",{type:"button",className:`plans-filter${d===k?" is-active":""}`,"aria-pressed":d===k,onClick:()=>f(k),children:k==="all"?"ALL":k==="in-progress"?"IN PROGRESS":"COMPLETE"},k))}),c.jsx("button",{type:"button",className:"plans-refresh",onClick:n,children:"REFRESH"})]}),c.jsxs("div",{className:"plans-list","aria-label":"Plans",children:[b.length===0&&c.jsx(Ov,{children:"No matching plans."}),b.map((k,O)=>{const P=fee(k.tasksDone,k.tasksTotal),F=P===100;return c.jsxs("div",{className:`plans-row${e===k.name?" is-selected":""}${r.has(k.name)?" is-pulsing":""}`,children:[c.jsxs("button",{ref:T=>{T?_.current.set(k.name,T):_.current.delete(k.name)},type:"button",className:"plans-row-select",onClick:()=>i(k.name),onKeyDown:T=>w(T,O),children:[c.jsx("span",{className:"plans-row-name",children:k.name}),c.jsxs("span",{className:"plans-row-meta",children:[k.waveCount," waves · ",k.tasksDone,"/",k.tasksTotal," tasks · ",EM(k.updatedAt),k.executionMode==="parallel"?" · parallel":""]}),P!==null&&c.jsx("span",{className:"plans-progress-track","aria-label":`${P}% complete`,children:c.jsx("span",{className:`plans-progress-fill${F?" is-complete":""}`,style:{width:`${P}%`}})})]}),c.jsx("button",{type:"button",className:"plans-copy",onClick:T=>x(T,k.name),"aria-label":p===k.name?`Copied plans/${k.name}`:`Copy plans/${k.name}`,children:p===k.name?"COPIED":"COPY"})]},k.name)})]})]})}function kee({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(Hb,{onClose:t})]}),c.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(Hb,{onClose:t})]}),c.jsx(TM,{message:"Unable to load plan.",onRetry:n})]}):c.jsx(Eee,{plan:e.plan,onClose:t})}function Eee({plan:e,onClose:t}){const n=y.useMemo(()=>{const d=new DOMParser().parseFromString(Bs(e.content).html,"text/html");return Dv(d.body),d.body.innerHTML},[e.content]),i=y.useRef(null),r=y.useRef(null),o=y.useCallback((d,f)=>{const p=i.current;if(!p)return;const m=[...p.querySelectorAll(d)].find(b=>d==="h3"?dee(b.textContent??"",f):zb(b.textContent??"")===zb(f));if(!m)return;const _=window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.scrollIntoView({behavior:_?"auto":"smooth",block:"start"}),m.classList.remove("plans-heading-flash"),m.getBoundingClientRect(),m.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>m.classList.remove("plans-heading-flash"),1200)},[]),u=y.useCallback(d=>{const f=d.target.closest('[data-action="copy-code"]');if(!f)return;const p=f.closest("pre")?.getAttribute("data-code");if(!p)return;navigator.clipboard?.writeText(p);const m=f.textContent;f.textContent="Copied",window.setTimeout(()=>{f.textContent=m},1200)},[]);return y.useEffect(()=>{const d=i.current;if(!d)return;Zp(d),Dv(d);const f=new MutationObserver(()=>Dv(d));return f.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>f.disconnect()},[n]),y.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsxs("div",{className:"plans-reader-heading",children:[c.jsx("h2",{className:"plans-reader-title",children:e.title}),c.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&c.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",EM(e.updatedAt)]})]}),c.jsx(Hb,{onClose:t})]}),c.jsxs("div",{className:"plans-reader-body",children:[c.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,f)=>{const p=pee(d.tasksDone,d.tasksTotal);return c.jsxs("div",{className:`plans-wave is-${p}`,children:[c.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>o("h2",d.heading),children:d.heading}),d.tasksTotal>0&&c.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&c.jsx("div",{className:"plans-lane-list",children:d.lanes.map((m,_)=>{const b=gee(e.waves,f,m);return c.jsxs("div",{className:`plans-lane is-${b}`,children:[c.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",m.heading),children:m.id??m.heading}),m.tasksTotal>0&&c.jsxs("span",{className:"plans-lane-count",children:[m.tasksDone,"/",m.tasksTotal]}),b==="ready"&&c.jsx("span",{className:"plans-lane-ready",children:"READY"})]},m.id??`${d.index}-${_}`)})})]},d.index)})}),c.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:u,dangerouslySetInnerHTML:{__html:n}})]})]})}function Hb({onClose:e}){return c.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Ov({children:e,detail:t}){return c.jsxs("div",{className:"plans-empty",children:[c.jsx("span",{children:e}),t&&c.jsx("span",{className:"plans-empty-detail",children:t})]})}function TM({message:e,onRetry:t}){return c.jsxs("div",{className:"plans-error-state",children:[c.jsx("span",{children:e}),c.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Dv(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 Tee(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),c.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 AM=[qJ,see,See];function Aee(e="right"){const{railPanels:t}=yc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const Ree=360;function Nee(e){const{codexReader:t}=Qs();return e==="codex"&&t!==null?Ree:0}const RM=240,Lee=312,NM="fleet-console.rail.panelWidth",b5="Theater";function Mee(){try{const e=localStorage.getItem(NM);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=RM)return t}}catch{}return Lee}function jee({theaterId:e,api:t}){const n=y.useSyncExternalStore(TT,()=>zo().theaters.find(L=>L.id===e)?.label??b5,()=>b5),i=y.useRef(null),r=aA(),o=oA(),u=y.useRef(o),d=Aee(),f=AM,m=[...f,...d].find(L=>L.id===r)??null,_=m!==null,b=Nee(r)+(m?.preferredExtraWidth??0)+n7(),S=y.useRef(b);S.current=b;const[w,x]=y.useState(Mee),k=y.useRef(w),[O,P]=y.useState(!1);y.useLayoutEffect(()=>{u.current&&!o&&PT(i.current,".command-band-rail-toggle"),u.current=o},[o]);const F=y.useCallback(L=>{L.preventDefault();const M=L.clientX,z=k.current;P(!0);const U=Q=>{const G=M-Q.clientX,B=window.innerWidth-148-S.current,R=Math.max(RM,Math.min(B,z+G));k.current=R,x(R)},Z=()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",Z),P(!1);try{localStorage.setItem(NM,String(k.current))}catch{}};document.addEventListener("pointermove",U),document.addEventListener("pointerup",Z)},[]),T=y.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:n},api:t,requestExtraWidth:L=>{r!==null&&t7(r,L)}}),[e,n,t,r]);return c.jsxs("div",{ref:i,className:`right-rail${_?" is-open":""}${o?" is-expanded":" is-closed"}${O?" is-dragging":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${_?w+b:0}px`},children:[c.jsxs("div",{className:"right-rail-panel-slot",style:_?{width:w+b}:void 0,children:[_&&c.jsx("div",{className:"right-rail-resize-handle",onPointerDown:F,"aria-hidden":"true"}),m&&c.jsx(Oee,{activePanel:m,activeId:r,ctx:T})]}),c.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:c.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[f.map(L=>c.jsx(S5,{panel:L,isActive:r===L.id},L.id)),f.length>0&&d.length>0?c.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,d.map(L=>c.jsx(S5,{panel:L,isActive:r===L.id},L.id))]})})]})}const Oee=y.memo(function({activePanel:t,activeId:n,ctx:i}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"right-rail-panel-head",children:[c.jsx("span",{className:"right-rail-panel-title",children:t.title}),c.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:e7,children:"✕"})]}),c.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:t.render(i)})]})});function S5({panel:e,isActive:t}){const n=y.useCallback(()=>J8(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return c.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 Dee='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Iee(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=Qs(),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),u=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.kind==="conflicts"?e.id??"":e.templateId??""}`:null,d=e!==null&&t,f=y.useCallback(()=>{eee(),GD()},[]);return y.useEffect(()=>{if(!d)return;const p=e;document.body.setAttribute("data-codex-reading","true");const m=document.querySelector(".operations-canvas"),_=document.querySelector(".operations-side-bar");m?.setAttribute("inert",""),_?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),f();return}S.key==="Tab"&&Bee(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),m?.removeAttribute("inert"),_?.removeAttribute("inert");const S=p?.kind==="entry"?p.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 p=e.kind,m=p==="drydock"?e.patchId:p==="conflicts"?e.id:p==="schema"?e.templateId:void 0;CM(r.current,o.current,{initialEntryId:p==="entry"?e.entryId:"",kind:p,subId:m,theaterId:n,onRelatedClick:_=>{ur({kind:"entry",entryId:_}),Ef()},onClose:f,onPatchOpen:_=>{ur({kind:"drydock",patchId:_}),Ef()},onDecided:()=>{Rp(),ur({kind:"drydock",patchId:void 0}),Ef()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[d,u]),d?Ya.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"codex-reading-scrim",onClick:f,"aria-hidden":"true"}),c.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[c.jsxs("div",{className:"codex-reading-sheet-head",children:[c.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),c.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:f,children:"✕"})]}),c.jsxs("div",{className:"codex-reading-sheet-body",children:[c.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),c.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function Bee(e,t){if(!e)return;const n=[...e.querySelectorAll(Dee)].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 Sf=im().api,Fb=560,Ub=360,Wf=new Set;function $ee({state:e,claimBootPanelMinimization:t}){const n=y.useRef(null),i=iT(),r=sT(),o=Op(),u=aT(),d=yc(),[f,p]=y.useState([]),m=y.useMemo(()=>Pee(e).map(j=>j.id),[e.operations,e.activeTheaterId]),_=y.useRef(e),b=y.useRef(0);_.current=e,y.useEffect(()=>{PO(e.activeTheaterId)},[e.activeTheaterId]),y.useEffect(()=>{if(!e.activeTheaterId){p([]);return}k5().then(p).catch(()=>{})},[e.activeTheaterId]),y.useEffect(()=>{const j=q=>{if(!OI()||!q.altKey||q.metaKey||q.ctrlKey)return;const H=document.activeElement;if(H instanceof HTMLElement&&H.matches("input, textarea, [contenteditable='true']")&&!H.closest(".xterm"))return;if(q.code==="KeyF"&&!q.shiftKey){q.preventDefault(),q.stopImmediatePropagation(),FO();return}if(q.shiftKey||q.key!=="ArrowLeft"&&q.key!=="ArrowRight")return;const A=_.current,Y=hr(),J=qD(A.operations.filter(ae=>ae.theaterId===A.activeTheaterId),A.groups.filter(ae=>ae.theaterId===A.activeTheaterId),Y.operationOrder,Y.collapsedGroups,ps()===null&&Vs()===null?Y.minimized:[]);if(q.preventDefault(),q.stopImmediatePropagation(),J.length===0)return;const he=ps()??Vs()??_.current.activeOperationId,de=WD(J,he,q.key==="ArrowRight"?1:-1);de&&Iv(de,d.operationKinds,Sf,b,()=>{Y.minimized.includes(de)&&(Tp(de),Jf(de)),oc(de)})};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[r,o,i,d.operationKinds]),y.useEffect(()=>{for(const H of m)BO(H);if(!e.operationsHydrated||($O(m),!e.activeTheaterId))return;const j=t(e.activeTheaterId);if(j===null)return;const q=new Set([_.current.pendingOperationFocus,ps(),Vs()].filter(H=>H!==null));IO(j.filter(H=>!q.has(H)))},[t,m,e.activeTheaterId,e.operationsHydrated]);const S=y.useCallback(j=>{const q=_.current.operations.find(he=>he.id===j);if(!q)return;const H=hr(),A=H.operations[j]??q.geometry??Hee(q);H.operations[j]||Zv(j,A),H.minimized.includes(j)&&Tp(j),Jf(j),Di(j);const J=zee(n.current);J&&zO(j,J)},[]);y.useEffect(()=>{const j=e.pendingOperationFocus;j!==null&&(Iv(j,d.operationKinds,Sf,b,()=>S(j)),ID())},[S,d.operationKinds,e.pendingOperationFocus]);const w=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(j=>j.theaterId===e.activeTheaterId);const x=y.useCallback((j,q)=>d.plugins.find(A=>A.id===j)?.renderLaunchIcon?.(q)??null,[d.plugins]),k=y.useCallback((j,q,H)=>{if(!_.current.activeTheaterId)return;const A={...w5(H),zIndex:Po()};Bv(j,q,A,_.current.activeTheaterId,d.plugins)},[d.plugins]),O=y.useCallback((j,q)=>{if(!_.current.activeTheaterId)return;const H=Fee(n.current),A={...w5(H),zIndex:Po()};Bv(j,q,A,_.current.activeTheaterId,d.plugins)},[d.plugins]),P=y.useCallback((j,q,H)=>{_.current.activeTheaterId&&Bv(j,q,H,_.current.activeTheaterId,d.plugins)},[d.plugins]),F=y.useCallback(()=>{lT({x:0,y:0,zoom:1})},[]),T=y.useCallback(j=>{const q=_.current.operations.find(H=>H.id===j);if(q){if(q.theaterId!==_.current.activeTheaterId){b.current+=1,oc(j);return}Iv(j,d.operationKinds,Sf,b,()=>S(j))}},[S,d.operationKinds]),L=y.useCallback(j=>{_.current.activeOperationId===j&&Di(null),iM(j),cT(j)},[]),M=y.useCallback((j,q)=>{kf(j,{accent:q}).then(()=>Ji(null)).then(fs).catch(()=>{})},[]),z=y.useCallback((j,q)=>{J5(j,q).then(()=>Ji(null)).then(fs).catch(()=>{})},[]),U=y.useCallback((j,q)=>{kf(j,{groupId:q}).then(()=>Ji(null)).then(fs).catch(()=>{})},[]),Z=y.useCallback((j,q,H)=>{lO({theaterId:j,name:q,color:"blue"}).then(A=>H?kf(H,{groupId:A.id}).then(()=>{}):void 0).then(()=>Promise.all([Ji(null).then(fs),xo().then(Co)])).catch(()=>{})},[]),Q=y.useCallback((j,q)=>{q&&g_(j,{color:q}).then(()=>xo()).then(Co).catch(()=>{})},[]),G=y.useCallback((j,q)=>{g_(j,{name:q}).then(()=>xo()).then(Co).catch(()=>{})},[]),B=y.useCallback(j=>{const q=new Map(_.current.groups.map(A=>[A.id,A])),H=j.flatMap((A,Y)=>{const J=q.get(A);return!J||J.order===Y?[]:[g_(A,{order:Y})]});H.length!==0&&Promise.allSettled(H).then(()=>xo()).then(Co).catch(()=>{})},[]),R=y.useCallback(j=>{const q=new Map(_.current.theaters.map(A=>[A.id,A])),H=j.flatMap((A,Y)=>{const J=q.get(A);return!J||J.order===Y?[]:[iO(A,Y)]});H.length!==0&&Promise.allSettled(H).then(()=>xC(null)).then(iy).catch(()=>{})},[]),D=y.useCallback(j=>{cO(j).then(()=>Promise.all([Ji(null).then(fs),xo().then(Co)])).catch(()=>{})},[]),N=y.useCallback(j=>{if(Wf.has(j))return;ps()===j&&Zs(),Wf.add(j);const q=_.current.operations.find(A=>A.id===j)?.pluginId,H=(q?d.plugins.find(A=>A.id===q):null)??null;Uee(j,H).finally(()=>Wf.delete(j))},[d.plugins]),E=y.useCallback(async j=>{RT();try{const q=await Z5(j),H=await X5(q);NT(H),xC(null).then(iy).catch(()=>{})}catch(q){sy(q instanceof Error?q.message:String(q))}},[]),$=y.useCallback(async j=>{const q=()=>Promise.all([Ji(null).then(fs),xo().then(Co)]).then(()=>{}).catch(()=>{});try{await oO(j),$C(j),await q()}catch(H){if(H instanceof un&&H.status===404){$C(j),await q();return}sy(H instanceof Error?H.message:String(H))}},[]);return c.jsxs("div",{className:"console-body is-canvas",children:[c.jsx(j8,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:u,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:f,canLaunch:w,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:x,onLaunchKind:O,onResetView:F,onClose:N,onMinimize:L,onFocus:T,onSetAccent:M,onRename:z,onSetGroupId:U,onCreateGroup:Z,onSetGroupColor:Q,onRenameGroup:G,onReorderGroups:B,onReorderTheaters:R,onUngroupAll:D,onSelectTheater:f0,onAddTheater:E,onCancelAddTheater:DD,onForgetTheater:$}),c.jsx("div",{className:"operations-center-stage",ref:n,children:c.jsx(jJ,{state:e,catalog:f,canLaunch:w,renderKindIcon:x,onLaunchKind:k,onLaunchAtGeometry:P,onClose:N,onFocus:T,onRename:z,onSetAccent:M})}),c.jsx(jee,{theaterId:e.activeTheaterId,api:Sf}),c.jsx(Iee,{})]})}async function Iv(e,t,n,i,r){const o=++i.current,u=TC(),d=ps();if(d!==null){if(d===e){Di(e),vo(e);return}const f=zo().operations.find(b=>b.id===e),p=hr().minimized.includes(e),m=f&&t.find(b=>b.pluginId===f.pluginId&&b.type===f.type);let _=!0;if(f&&m?.companions?.length&&m.canOpenCompanions){try{_=await m.canOpenCompanions({api:n,operation:f})}catch{_=!1}const b=zo(),S=b.operations.find(x=>x.id===e),w=!p&&hr().minimized.includes(e);if(i.current!==o||TC()!==u||ps()!==d||b.activeTheaterId!==f.theaterId||nT()!==f.theaterId||w||Wf.has(e)||!S||S.pluginId!==f.pluginId||S.type!==f.type||S.theaterId!==f.theaterId)return}if(f&&(!m||!m.companions?.length||!_)){if(Zs(),Zf()){hr().minimized.includes(e)&&Tp(e),Jf(e),Di(e),vo(e);return}r(),vo(e);return}Di(e),uT(e),vo(e);return}if(Vs()!==null){Di(e),r0(e),vo(e);return}if(Zf()){hr().minimized.includes(e)&&Tp(e),Jf(e),Di(e),vo(e);return}r(),vo(e)}function Pee(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(ry)}function zee(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Hee(e){return e.geometry??{x:0,y:0,width:Fb,height:Ub,zIndex:0}}function Fee(e){const t=hr(),n=e?.clientWidth??800,i=e?.clientHeight??600;return yh({x:n/2,y:i/2},t.viewport)}function w5(e){return{x:e.x-Fb/2,y:e.y-Ub/2,width:Fb,height:Ub}}async function Bv(e,t,n,i,r){const o=r.find(_=>_.id===e),d=im(()=>{Ji(null).then(fs).catch(()=>{})});let f=null;if(o?.launch?f=(await o.launch({theaterId:i,kind:t,geometry:n,operations:d.operations})).id:f=(await d.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Ji(null).then(fs).catch(()=>{}),!f)return;const p=nT()===i,m=zo().operations.some(_=>_.id===f);NO(i)===null&&(p&&m&&Vs()!==null?(Di(f),r0(f)):oc(f))}async function Uee(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Ji(null).then(fs).catch(()=>{})}const Wee=3e4;let wf=1e3,Iu=null,$v=null,Pv=!1;function LM(){Iu!==null&&(clearTimeout(Iu),Iu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);qee(i.operation)&&MD(i.operation)}catch{}}),e.addEventListener("update:available",()=>{Sh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{qL(JSON.parse(n.data))}catch{HE()}}),e.onopen=()=>{wf=1e3,Sh()},e.onerror=()=>{e.close(),HE(),Iu=setTimeout(()=>{Iu=null,wf=Math.min(wf*2,Wee),Ji().then(fs).catch(()=>{}).finally(LM)},wf)}}function Sh(){if($v){Pv=!0;return}$v=Qj(zo().activeTheaterId).then(xD).catch(()=>{}).finally(()=>{$v=null,Pv&&(Pv=!1,Sh())})}function qee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Gee=6e3;function Kee(){const e=Qs(),t=y.useRef(new Set),n=y.useRef(null),i=_s(),r=yc(),o=k1(),u=QL(o.state?.language??"auto"),f=i.pathname.startsWith("/operations"),p=y.useMemo(()=>[...AM,...r.railPanels.filter(b=>(b.side??"right")==="right")].map(b=>({id:b.id,title:b.title})),[r.railPanels]),m=y.useCallback(b=>n.current===null||t.current.has(b)?null:(t.current.add(b),n.current),[]);y.useEffect(()=>{const b=im(()=>{Ji().then(fs).catch(()=>{})}),S=r.plugins.map(w=>w.install?.(b)).filter(w=>typeof w=="function");return()=>{for(const w of S)w()}},[r.plugins]),y.useEffect(()=>{wD(f)},[f]),y.useEffect(()=>{const b=new AbortController;Y5(b.signal).then(x=>{ND(x),BC()}).catch(x=>{b.signal.aborted||(lt({theaterError:x instanceof Error?x.message:String(x)}),BC())});const S=Date.now();Ji(null,b.signal).then(x=>{n.current=x.filter(k=>k.ts.createdAt<S).map(k=>k.id),LD(x)}).catch(()=>{}),xo(null,b.signal).then(Co).catch(()=>{}),Sh();const w=window.setTimeout(Sh,Gee);return()=>{window.clearTimeout(w),b.abort()}},[]),y.useEffect(()=>(JL({locale:u}),uZ),[u]);const _=y.useRef(null);return y.useLayoutEffect(()=>{e.keyboardShortcutsOpen&&(_.current=qX()??(document.activeElement instanceof HTMLElement?document.activeElement:null))},[e.keyboardShortcutsOpen]),y.useEffect(()=>{if(e.keyboardShortcutsOpen)return;const b=_.current;_.current=null,b?.isConnected&&b.focus()},[e.keyboardShortcutsOpen]),y.useEffect(()=>xZ({getSideBarCollapsed:()=>tp().collapsed,setSideBarCollapsed:Xl,toggleOperationSearch:LT,toggleRailChrome:E0}),[]),c.jsxs("div",{className:"console-shell",children:[c.jsx(IX,{operationsViewVisible:f}),c.jsx("main",{className:"console-route-content",children:c.jsxs(vj,{children:[c.jsx(Dl,{path:"/",element:c.jsx(p_,{to:"/operations",replace:!0})}),c.jsx(Dl,{path:"/operations",element:c.jsx($ee,{state:e,claimBootPanelMinimization:m})}),c.jsx(Dl,{path:"/carrier-settings",element:c.jsx(p_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),c.jsx(Dl,{path:"/settings",element:c.jsx(HZ,{})}),c.jsx(Dl,{path:"*",element:c.jsx(p_,{to:"/operations",replace:!0})})]})}),c.jsx(iZ,{state:e,railPanels:p}),e.keyboardShortcutsOpen?c.jsx(UT,{onClose:UD}):null,c.jsx(vZ,{state:e}),c.jsx(FX,{state:e}),c.jsx(cZ,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:qf,"react/jsx-runtime":B6,"@fleet-console/sdk/plugin/browser":i4,"@fleet-console/sdk/settings/browser":u4,"@fleet-console/sdk/operations/browser":q6,"@fleet-console/sdk/notifications/browser":d4,"@fleet-console/sdk/react/browser":p4};ac("instrument");AD();try{const e=await KL();ac(e.theme),ny(e.uiFont),YX(e)}catch{}const Vee=await xX();LM();const x5=document.querySelector("#app");x5&&b4.createRoot(x5).render(c.jsx(y.StrictMode,{children:c.jsx(Fj,{basename:"/console",children:c.jsx(wX,{value:Vee,children:c.jsx(Kee,{})})})}));export{WU as _,Yee as a,Wb as g,sn as k,nh as p};
|